- Home /
Question by
NutellaDaddy · May 02, 2014 at 04:23 AM ·
c#instantiatetranform.position
How to hold an objects transform in a variable and than instantiate another object at it's point?
I want to make it so that I can hold an objects Tranform(x,y,z) and than instantiate an object at it's point. How could I do this. I know how to instantiate the object ,but it only instatiates at the mouses position at the moment. Can someone help?
Comment
I think you are asking for:
Instantiate(prefab, transform.position, transform.rotation);
...but I'm not really sure.
Best Answer
Answer by bansalgirish8 · May 02, 2014 at 05:25 AM
I think you are asking for:
public Vector3 PositionWhereYouWantToGetYourObjectInstantiated;
as robertbu says:
Instantiate(prefab,PositionWhereYouWantToGetYourObjectInstantiated,transform.rotation);
you can pass the cordinates of PositionWhereYouWantToGetYourObjectInstantiated in the inspector