- Home /
Animate Script Properties with Animator
Well, this might be an incredibly simple thing and I can work around it with scripting, however, I'd like to animate script properties with the animator. I write in JS and my properties aren't available in the animation window. The only property that's available is 'enabled.'
Some imported scripts in C# have properties available in the animation window, but as I said, I usually use JavaScript. If need be, there's really not an issue converting everything to C# except for the time aspect.
Of course, as I always do, I scoured the internet for clues and, as usual, I'll probably fix the problem before anyone answers :)
I'll just show what I'm using just to test it:
#pragma strict
var GlitchProbability : int;
function Update () {
if (GetComponent(GUITexture)) GUIGlitch();
if (SpriteRenderer) SpriteGlitch();
}
function GUIGlitch () {
if (Random.Range(0, GlitchProbability) == 1) GetComponent(GUITexture).enabled = !GetComponent(GUITexture).enabled;
}
function SpriteGlitch () {
if (Random.Range(0, GlitchProbability) == 1) GetComponent(SpriteRenderer).enabled = !GetComponent(SpriteRenderer).enabled;
}
Answer by zafadadynamic · Mar 16, 2015 at 02:47 PM
Well, I'm answering my own question here. You can only use the animation window for floats and bools. I think I knew that. Thank you for your time.
Love, me.
Your answer
Follow this Question
Related Questions
Have some minor problems. Cant tell if its a script issue or a animator issue. 1 Answer
Bug? Adding properties disabled for every animation except first 0 Answers
How can i change the color of my Mesh Renderer, after Color Animation. 0 Answers
Issue with animation and gravity. 1 Answer
2D Animation does not start 1 Answer