- Home /
Instantiating to gameobject.transform.position
When I try to instantiate an GO to the position of another GO like so. The effect I get is that the GO to be instantiated doesn't end up where bulletSpawnPoint is. It's like the bullet isn't showing up at the true 0,0,0 but it some other coordinate system.
star = (GameObject)Instantiate(Resources.Load("Bullet"), GameObject.Find("bulletSpawnPoint").transform.position,Quaternion.identity);
Though if I try to make a createPrimitive and make it go to 0,0,0 it works.
Answer by YeOldeSnake 1 · Feb 04, 2011 at 04:17 PM
You might have another gameobject called bulletSpawnPoint , i would do it with assigning a prefab of the bullet to bulletPrefab and assigning the bulletspawnpoint to bulletspawnpoint variable
var star:GameObject; var bulletPrefab:GameObject; var bulletSpawnPoint:GameObject; //we're using gameobject in case we want to do more stuff with these
star=Instantiate(bulletPrefab,bulletSpawnPoint.transform.position,transform.rotation);
EDIT:Sorry code is in JS , you can easily edit it to C# though