How do i define the random instantiated objects coordinates
I need to know the instantiated clone objects current location on the screen, thanks a lot .
Answer by oStaiko · Nov 10, 2016 at 12:50 AM
GameObject myObject;
myObject = Instantiate(prefab, position, rotation);
myObject.transform.position = new Vector3();
You can set it with the initial instantiation, as you need to give it the position to instantiate at. You can also create a reference to the instantiated object, and then set it later in the code using the reference.
Thanks , but i instantiated objects randomly, and i need to know where are they exactly spawned at..
Alright, well I just showed you how to do that.
myObject.transform.position;
That's the coordinates, what else do you need? myObject is the object you just instantiated randomly, it stores all the values for it like any GameObject would have.
Oh! my bad , i couldnt explain myself as good enough. Lemme try again, i instantiated objects as clones in game. $$anonymous$$y wish is want to know the cloned gameobjects coordinates on the scene. If its possible may i ask you my question via mail or skype etc. $$anonymous$$aybe i can show you the problem and you can answer more easily.
Could you just post your scripts that you're using here to instantiate them? I could probably help you with those. Just press the 101010 button and paste it there.
Your answer
Follow this Question
Related Questions
Instantiate changes position 1 Answer
Simple Prefab Instantiate "(Clone)" Question 3 Answers
I'm having problems instaniating 0 Answers