Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nitza12345 on May 01, 2016, 02:21:47 PM

Title: sprite renderer color alpha interpolate[SOLVED]
Post by: nitza12345 on May 01, 2016, 02:21:47 PM
guys i tried to interpolate sprite renderer color alpha with set property and float interpolation in fsm everything works fine but the sprite renderer color alpha doesnt change... i face so many problems with playmaker...
Title: Re: sprite renderer color alpha interpolate
Post by: ransomink on May 01, 2016, 04:10:45 PM
I've used the same method for applying damage color to enemies and fading in/out messages.

Make sure you have a Object variable and its object type is set to Image. Drag the sprite you wish to change to this variable inside the inspector (only if you set it available within the Inspector).

If you can't set it in the Inspector (a prefab—dynamically changes) you have to use the Get Component action to obtain the Image component from the gameobject first. Now, when you use set property it will update the property on that component.

You could snap a screenshot of your FSM with the state selected so we can check the code?
Title: Re: sprite renderer color alpha interpolate
Post by: nitza12345 on May 01, 2016, 11:11:37 PM
Right now i cant post a picture but when I can I will,it's not a prefab,if you drag and drop sprite renderer in to fsm state action Windows it makes you select  get or set property and I selected set property of color.a every frame from a global float variable that is changed by float interpolation every frame,it should work like charm but I will try your method too
Title: Re: sprite renderer color alpha interpolate
Post by: ransomink on May 02, 2016, 04:52:11 AM
Oh, I thought you were using a Image component. If you attempt my method just make sure the object type of your Object variable is set to Sprite Renderer instead...
Title: Re: sprite renderer color alpha interpolate
Post by: Natty on February 05, 2019, 04:28:34 AM
Just adding to - since the comments above partially solved my attempt to fade a sprite colour- Don't forget to check update each frame :P or it will look like its not working when in-fact it is! But only colouring the first frame then moving on.
Hopefully this helps somebody else fade their sprites!