playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
Changing the color of an object for every frame with Playmaker[SOLVED]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Changing the color of an object for every frame with Playmaker[SOLVED] (Read 5310 times)
boragungor
Playmaker Newbie
Posts: 17
Who really wrote Beethoven's music to begin with?
Changing the color of an object for every frame with Playmaker[SOLVED]
«
on:
October 22, 2014, 07:50:03 AM »
Hi all,
I've been trying to change a cube's color for every frame and I've accomplished this with a script named changeColor which I've come across on Unity forums (
http://answers.unity3d.com/questions/314737/how-to-randomly-change-a-color-on-an-object-in-c.html
)
The code follows as below:
public class ChangeColor : MonoBehaviour {
public float timer = 0.0f;
public float timer_set = 0.5f;
void Start ()
{
}
void Update ()
{
timer += Time.deltaTime;
if (timer >= timer_set)//change the float value here to change how long it takes to switch.
{
// pick a random color
Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f );
// apply it on current object's material
renderer.material.color = newColor;
timer = 0;
}
}
What I'm trying to accomplish is to have the same effect without this script but with Playmaker Color Interpolation or Animate Colors but for reasons I can't understand I have not been able to do it. Any help is appreciated.
Thank You
«
Last Edit: October 25, 2014, 01:17:26 PM by boragungor
»
Logged
600
Beta Group
Hero Member
Posts: 715
Re: Changing the color of an object for every frame with Playmaker
«
Reply #1 on:
October 22, 2014, 11:04:03 AM »
Hello,
before animation use Get Material Color action,
use "Color" variable type to save a color,
then animate those variables in one state with SetMaterialColor every frame as the last action.
Logged
-
Car and Traffic
Playmaker assets
-
Flashing Lights: Police, Fire, EMS
[Steam]
-
YouTube
boragungor
Playmaker Newbie
Posts: 17
Who really wrote Beethoven's music to begin with?
Re: Changing the color of an object for every frame with Playmaker
«
Reply #2 on:
October 22, 2014, 12:55:25 PM »
Thank for the reply 600 but actually I can't see Get Material Color action in the action browser, there is only Set Material Color.
Logged
600
Beta Group
Hero Member
Posts: 715
Re: Changing the color of an object for every frame with Playmaker
«
Reply #3 on:
October 22, 2014, 12:59:49 PM »
oh sorry I forgot that it was not with the base install,
Here:
http://hutonggames.com/playmakerforum/index.php?topic=1996.0
Logged
-
Car and Traffic
Playmaker assets
-
Flashing Lights: Police, Fire, EMS
[Steam]
-
YouTube
boragungor
Playmaker Newbie
Posts: 17
Who really wrote Beethoven's music to begin with?
Re: Changing the color of an object for every frame with Playmaker
«
Reply #4 on:
October 25, 2014, 01:15:26 PM »
Thanks 600
Actually I could'nt manage to do it using fsm but rather modified the code I'd mentioned above and turned it into an action, I'm sharing it as an attachment.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
Changing the color of an object for every frame with Playmaker[SOLVED]