I am instantiating a prefab from one script, but i want to destroy it from another. But I don’t know how since an instantiated object is private. For example
Instantiate.js
function OnMouseUpAsButton () {
var blank : GameObject = Instantiate(dotgrey, transform.position, transform.rotation);
}
Destroy.js
InvokeRepeating("CleanUp",0,1);
function CleanUp () {
Destroy(blank);
}
The second script will obviously not know what blank is because it is private. How do I circumvent this problem?
Thank You.