- Home /
Attached script component with public parameters not showing up in Animation Add Property menu
I'm using NGUI and created script components that expose UISprite parameters (scale, color, position) so that I can properly animate them using Unity's animation system. I added the script components to the UISprite, but the scripts (and their public properties) aren't appearing in the Animation Window when I click "Add Property." I have an Animator component with the proper Animation Controller and animation attached to the UISprite. Here's my code for modifying UISprite color and a screen grab of the animation window. In this case, "Animated Color (Script)" should be in the list but it's not. If I hit the Record button in the animation window then manually modify the color in the hierarchy it appears in the property list. Any thoughts?
[ExecuteInEditMode]
public class AnimatedColor : AnimatedProperty
{
public Color color = Color.white;
void OnEnable()
{
LateUpdate();
}
void LateUpdate()
{
if (widget != null)
{
widget.color = color;
widget.alpha = color.a;
}
if (panel != null)
panel.alpha = color.a;
}
}
Answer by Wrymnn · Feb 09, 2016 at 07:01 AM
I believe you have to foldout the UI Sprite (Script) property in that window.
If that doesn`t show up the fields, then you just change color in that script while recording, and it should automatically put those records into animation, then you can tweak them.
$$anonymous$$y parameters are in a script called AnimatedColor which is attached to the object I'm animating. The problem is that my script isn't appearing in the list alongside UIScript. I was able to get my params to show when I manually changed them while recording, just wondering why my script isn't appearing in the list.
Okay, it seems that Unity will display only first script in this window. SO when OU have components on this gameobject like this:
Transform
ABehaviour (Script)
BBehaviour (Script)
Only ABehaviour will show up. If you would move BBehaviour above ABehaviour, BBheaviour would show up. That is really strange, could you please file a bug report on this? So Unity gets this fixed
Yep, confirmed that placing my script above UISprite made it appear in the list. Bug will be reported, thanks!
Your answer
Follow this Question
Related Questions
Unity 4.3 - 2D Animation - Dope Sheet Not Working!! 2 Answers
animations stop working when changed? 0 Answers
have anyone import 3d shade animation in unity?? 0 Answers
How can I make my model invisible before trigging the animation ??? 0 Answers
Animation state could not be played because it couldn't be found! 0 Answers