- Home /
Animator preventing correct spawn position?
The code I'm using to spawn my gameobject(sprite with an animation/animator) at the position of whatever gameobject the script is attached to but it seems to not spawn it on the gameobject that has the attached to it script? My theory is maybe the animator which has an animation that I'm using for an arcade style scoring when the player gets a point, is interfering with the code? I say this because every time the object spawns it spawns at the location wherever I made the animation at in the scene?
This code is attached to the game object where I want my object with the animation to spawn, and this code is inside of an OnMouseDown function
Instantiate(doubleScoreUp, Vector2(gameObject.transform.position.x, gameObject.transform.position.y), Quaternion.identity);
Answer by MousePods · Mar 19, 2014 at 02:00 PM
Spawn an Empty GameObject, place it where you want your object to go, then child your object to the Empty GameObjecy. (I had this issue too but I was using a collectable and manually placing it!)
Hope it helps!!!