is it possible to give an instantiated object a variable from another script?

Ok So I have my player that locks onto a game object with a recast and signs it to a gameObject variable called “LockedOn” then It instantiates a Missile that I need to send the LockedOn Object from my player script to the Missil script so it dose not accrue other players targets so i cannot use
gam object = script.gameObject act, is this possible any examples?

so you want to spawn the misile then asign the target right?
you need do something like this

                GameObject misile = Instantiate(gameobject prefab, new Vector3(spawnPoint.transform.position.x, spawnPoint.transform.position.y, spawnPoint.transform.position.z), Quaternion.identity) as GameObject;

you can then use

misile .script.lockedOn = player.script.lockedOn

API is here

if you scroll down like a litle over half the way down you should find it

hope this helps :slight_smile: