How can I do to get transform, in the script attached to the object spawned, of point where the object is spawned? C#

Hi everyone,

I need your help.
I want to instantiate an object randomly in one of the 3 spawn point which I created.
After do that I need to call “Transform” (with GetComponent) of the point where the object is spawned, in the script attached to the object spawned.

My question is: How can I do to get transform, in the script attached to the object spawned, of point where the object is spawned?
I need something like OnTriggerEnter?

Thanks :slight_smile:

void OnTrigger(Collider col)
{
col.GetComponent().position = YourSpawnsVector3
}

I’m really not understanding what you’re asking because the order of words make no sense. However I assume you mean getting the Transform that was just instantiated. It’s simple:

Transform t = Instantiate(prefab, position, prefab.rotation) as Transform;

// then

t.GetComponent<BlahBlah>