playMaker

Author Topic: Set Property for UISprite object  (Read 4092 times)

weilies

  • Junior Playmaker
  • **
  • Posts: 74
Set Property for UISprite object
« on: February 18, 2015, 02:26:12 AM »
Dear gurus,

I would like to change images based on different button clicked.
How can I assign the sprite object (as shown in attachment) via playmaker ?
It's an atlas > sprite.


Kindly assist


Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Set Property for UISprite object
« Reply #1 on: February 18, 2015, 04:35:49 AM »
Hi,

You can get the action "UGUI Set image sprite" from the Ecosystem. It will allow you do this.

then you use the UGui proxy to fire a PlayMaker event when the button is clicked.

Let me know if you have still issues.

 Bye,

 Jean

weilies

  • Junior Playmaker
  • **
  • Posts: 74
Re: Set Property for UISprite object
« Reply #2 on: March 08, 2015, 11:53:50 AM »
hi Jean,

i downloaded uGui Image Set Sprite action (as you can see from screenshot)
it doesn't change my Hand image to Rock image

but if you check on another image, if i am calling the action as 'Owner', i am able to change the Hand image to Rock (via Set Property)
Target Obj: Sprite
Object Type: UISprite
Property: spriteName
Sprite Name: rock_gesture (as it's an image from Atlas)

i prefer not to use set property because my gameobject has to be FSM object. I prefer to have an action in my master control gameObject like GameManager, control overall of the game logic.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Set Property for UISprite object
« Reply #3 on: March 09, 2015, 02:26:00 AM »
Hi,

 You are getting confused with NGUI. These actions only works with the new Unity UI system, and nothing else. So you need to look for the "Image" component. Make sure you read the Unity Manual ( not the reference manual) on the new Unity UI system to understand what are the new components and where to get them ( menu GameObject/UI/xxx)


 Bye,

 Jean

weilies

  • Junior Playmaker
  • **
  • Posts: 74
Re: Set Property for UISprite object
« Reply #4 on: March 09, 2015, 02:39:48 AM »
hi Jean,

Thanks for your reply again. I would prefer to deal with NGUI(Graphic)+ Playmaker (logic) rather than Unity UI (i heard there is performance issue on mobile)

Also, i love the friendly features from Ngui. I am able to compose images into Atlas and call out via 'spriteName' method. Which i found it really resource friendly.

My only problem is not able to update spriteName via Playmaker. the limitation is i can only set spriteName via "Owner".
E.g. I have a button FSM and i would like the button clicked action to change 5 sprite object, then i have to get my button action to sendEvent to 5 other FSM object, each of them set spriteName as Owner in order to change sprite graphic.

My question is, how can i get the button click FSM to change 5 sprites directly?
The Get/Set property just couldn't work


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Set Property for UISprite object
« Reply #5 on: March 09, 2015, 02:53:56 AM »
Hi,

 that's fine, you can use NGUI, but then the sert of actions you'll need is totally different and dedicate to NGUI. So make sure you are still no confused as to what action to use.

Check the wiki for the free set of actions and bridge to work with NGUI, while you'll find paid assets covering ngui and PlayMaker as well on the Asset Store.

 Bye,

 Jean

weilies

  • Junior Playmaker
  • **
  • Posts: 74
Re: Set Property for UISprite object
« Reply #6 on: March 09, 2015, 03:17:16 AM »
hi Jean,

i am currently using this package
https://hutonggames.fogbugz.com/default.asp?W1111

NGUI / ON CLICK event which i used a lot.
But what i am suffering is to make the sprite change from an Apple Sprite to Orange Sprite (both under same atlas) when a button gameObject clicked.

It is suppose to be easy but.... i just can't figure out... :s

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Set Property for UISprite object
« Reply #7 on: March 09, 2015, 03:24:14 AM »
Hi,

 I am not sure why you do't have this action ( I'll have to update the package maybe).

 I have attached the action for this to this post. It could be already on a different thread, but I haven't found it.


 Bye,

 Jean

weilies

  • Junior Playmaker
  • **
  • Posts: 74
Re: Set Property for UISprite object
« Reply #8 on: March 09, 2015, 03:26:30 AM »
Thanks Jean!

I will try out first!