fbpx

 

How to spawn a game...
 

How to spawn a game object anywhere on x value?  

   RSS

0
  1. How can we spawn a game object anywhere on the x axis, keeping the Y same?
1 Answer
0

Hi Avik Das! You can do this through a kept reference to the object. After instantiating it, just change the x value of the transform:

 

GameObject gameObject = Instantiate(prefab);
gameObject.transform.position = new Vector3([value for x here],  0, gameObject.transform.position.z);

Share:

 

 

Scroll to Top

Please Login or Register