0
\$\begingroup\$

I'm not getting warm with the Unity animation editor.

This is what I want to do:enter image description here

The 2 lasers should be like this, rotating 360 degrees over and over. .The classname laser2 doesn't mean anything, I implemented 2 concepts therefore this is the laser2 class. However, the animation editor seems to have a problem with having the same component more than once. I'm only able to animate the first laser. enter image description here

As soon as I open the Laser2 section, it opens both lasers and changes in it are only stored in the first laser. Is there way to make them seperate? Having the exact same class twice (with different name) will help but that's an unbelievable dirty solution. I did not do much with the animation editor so far so maybe there is some easy fix that. Edit: Startangle is the value which must be animated on both.

\$\endgroup\$
  • \$\begingroup\$ Same goes for UnityEvents. If you try to set up one in inspector - you only get 1 reference option even if you have 2 components of the same type on the game object. Basically, my guess is that Unity doesn't catch reference to instance if you change values via recording but instead takes the first instance it finds. Have you tried to add keyframes explicitly by pressing Add Property and changing key frames data? \$\endgroup\$ – Candid Moon _Max_ Feb 8 at 19:40
1
\$\begingroup\$

Make them separate game objects with a shared parent node, so you only have 1 instance of the script on each object. Put the Animation component on the parent, and you can animate each child independently.

\$\endgroup\$
0
\$\begingroup\$

Is one laser object the parent of the other by chance? If so then it's animations will always override the child laser, so be sure to make them two separate objects. I'd suggest placing them inside one empty parent GameObject alongside all of the level terrain/walls.

\$\endgroup\$
0
\$\begingroup\$

The animator uses the NAME as reference. Not the GUID. The solution is simple:

  1. Make a Gameobject without the Laser-scripts
  2. Make 2 or more Children (with different Gameobject-names).
  3. Add the Laser Script to the children.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.