# Unity animation editor having trouble to animate twice the same component

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

This is what I want to do:

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.

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.

• 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? – Candid Moon _Max_ Feb 8 '19 at 19:40

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.

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.

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.