- Home /
Animations on Instantiated Prefabs not working
I've got an Instantiated Prefab containing numerous children. Namely, 1 object has a "Image" component, and the other 3 objects contains a "Sprite Renderer" component.
I'm trying to get the entire prefab to fade in on load. Normally I use Canvas Group - Alpha, however this only worked for the planet (I assume because the Sprite Renderer has it's own alpha - and I need to use Sprite Renderer as it allows me to easily change the layer the sprite is drawn on as I'm not comfortable with having lots of canvases (I get the idea that having many sub-canvases for 1 object can be a pain to manage for a UI later on?) )
Anywho, Canvas group only works for 1 / 4 game objects.
So I tried attaching the animator directly to the Prefab parent itself. Then just change the alpha of the sprite colour of each of the 3 objects (as well as the canvas group). Canvas group no longer works, and it states that the 3 other objects are missing....when they arent.
Now I DO manipulate these objects in a script going as far as deleting my 'unused' objects.....but that shouldn't affect all 3 should it? And the animator should try to execute before the script (as the animation is the first action take after entry) anyway if I understand what "Entry" actually is? (IE as soon as the prefab has loaded/enabled in scene, proceed to the first animation state etc). However instantly the objects are "missing".
Is it not possible to apply animations to instantiated prefabs in this way? Or is there an easier way? (Preferably where I just need to change 1 thing - such as a Canvas Group on the prefab parent)
Or am I just being stupid and forgot something important/obvious? (I rarely use animations...they annoy me but they make UIs look nicer :) )
Your answer
Follow this Question
Related Questions
Animator has not been initialized!!!!!! Help!! 2 Answers
UFPS - Player Animation Setup 0 Answers
How to handle multiple animation variants 1 Answer
Animator parameter does not pick the value of the animation curve with the same name 2 Answers
Setting animator parameter on a single instance of a prefab sets the parameter for all instances 3 Answers