playMaker

Author Topic: Set "Sprite" Property on a Different Game Object  (Read 3923 times)

acornbringer

  • Junior Playmaker
  • **
  • Posts: 75
    • Acornbringer.com
Set "Sprite" Property on a Different Game Object
« on: June 21, 2016, 01:30:12 PM »
Hey there!

I'm trying to create a button that will switch the sprite element in a Sprite Renderer component of another object. I've made a button out of a cube and attached the FSM to that but when I create the "Set Property" action to the cube's fsm, I don't get the option to select the new sprite. However, when I create an FSM on the sprite object, it lets me choose a sprite.

When I drag the Sprite Renderer component to the state list, I select "Sprite Renderer > Get Property". Then under the "Property" drop down, I select "sprite > Sprite". Instead of an image box appearing like I would like, I am left with a "Store Object" option.

Any help would be appreciated!

Thanks.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Set "Sprite" Property on a Different Game Object
« Reply #1 on: June 21, 2016, 02:00:05 PM »
Hi,
You can find a custom action called "swap Sprite"
on the Ecosystem
install this and search for "swap Sprite"

acornbringer

  • Junior Playmaker
  • **
  • Posts: 75
    • Acornbringer.com
Re: Set "Sprite" Property on a Different Game Object
« Reply #2 on: June 21, 2016, 02:25:32 PM »
Holy smokes! First time hearing about the Ecosystem. Very useful. That particular action worked perfectly as well.

Thanks a lot! You opened up a whole new world for me  ;D

I'm still kind of curious as to why the "Set Property" action wasn't suitable. Is it only meant to be used on the owner of the FSM?

Take care!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Set "Sprite" Property on a Different Game Object
« Reply #3 on: June 21, 2016, 05:38:15 PM »
Hi,
indeed...and not only on sprite, but on all it seems.

i have send a bug report.

But just for your information it is better to use (custom) actions that get/set properties :)

when you build for example to a web build the get/set sometimes do not work atm.

strange_aeons

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set "Sprite" Property on a Different Game Object
« Reply #4 on: June 21, 2016, 09:05:11 PM »
i was unable to find the swap sprite action some days ago, but managed to work out a way to swap the sprite using the Set Object action and setting the type to Sprite

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Set "Sprite" Property on a Different Game Object
« Reply #5 on: June 22, 2016, 02:15:00 AM »
Hi,
i got a reply from alex

Code: [Select]
This is an issue with the new drag and drop context menus.
A Set Property made by dragging an object into the State View and
selecting Set Property is broken.

This is fixed in the next update (coming soon).
In the meantime I posted a patch in another thread that fixes
the issue with a custom action editor.

he also attached a fix here if you need it.

acornbringer

  • Junior Playmaker
  • **
  • Posts: 75
    • Acornbringer.com
Re: Set "Sprite" Property on a Different Game Object
« Reply #6 on: June 23, 2016, 01:49:05 PM »
i was unable to find the swap sprite action some days ago, but managed to work out a way to swap the sprite using the Set Object action and setting the type to Sprite

Good to know! I'm sure that would have helped me as well and I'll keep it in mind for other situations. For now, I was able to download the "swap sprite" action and use that.

acornbringer

  • Junior Playmaker
  • **
  • Posts: 75
    • Acornbringer.com
Re: Set "Sprite" Property on a Different Game Object
« Reply #7 on: June 23, 2016, 01:51:39 PM »
Hi,
i got a reply from alex

Code: [Select]
This is an issue with the new drag and drop context menus.
A Set Property made by dragging an object into the State View and
selecting Set Property is broken.

This is fixed in the next update (coming soon).
In the meantime I posted a patch in another thread that fixes
the issue with a custom action editor.

he also attached a fix here if you need it.

Awesome! Thanks for inquiring about it. It did seem funny that it wasn't working but I'm too new to Playmaker to properly diagnose something as a bug.

I look forward to the update but the fix you recommended works just fine for now.

nikosurfing

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Set "Sprite" Property on a Different Game Object
« Reply #8 on: June 23, 2016, 07:25:19 PM »
Can you help me to solve my problem: http://hutonggames.com/playmakerforum/index.php?topic=13065.0

Basicly i need to save sprite variable to persist on disk so that even my app has been closed the image / sprite still remain