Gun position is always at the original Cactus instead of new Cactus

When I instantiate a new Cactus that works fine, but all the Zucchini projectiles come from the original cactus. My code matches Rick’s example, but I am using Unity 2019v17, so maybe a difference in Unity versions causes the behavior difference. With each Cactus I spawn I get more Zucchini’s but only from the original position.

How can I get this to fire from the position of the new Cactus?

have you applied all overrides to prefab?

Yes, if I drag the prefab up it ends up being exactly like the one that is already there.

So if you pause the game during runtime and you click an instantiated cactus it has a zucchini object applied to it?

Thanks for the suggestions. I was able to find that the Animation itself had a position set for it, so no matter where I tried to place it the animation would override the position I set when instantiating it.

Removing that allowed it to start at the correct spot.

Another issue was that the rotation makes it behave like a boomerang instead of going straight. I fixed this by creating a game object and making the zucchini a child of it. Changing the script to be on the GameObject to it moves from left to right I now get a spinning zucchini that goes from left to right.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms