calling prefabs from vars?

I've got all my collision detection in one script. The problem is every object (many of them made into prefabs) needs every var target assigned in editor.

What I want to do, is instead of having a tranform var, and adding the prefab name in the editor to each object/prefab, is to instead have the var call the prefab directly (so it's hard coded).

so for var fire I want to add my prefab name Fire instead of a Transform, haven't been able to figure out how to call it successfully though. Any ideas?

a small code snippet:

//vars for all collisions

var explosion : Transform;

var fire : Transform;

function OnTriggerEnter(hit : Collider) //onTriggerEnter | collider {

if(hit.gameObject.tag == "non_destroyable")
        var burn = Instantiate (fire, gameObject.transform.position, Quaternion.identity);


I didn't realize.

But you can select the script, scroll all the way down and add prefabs to the var on the script. Then there's no need to add the prefab per object containing script.


if I do understand your question then all you have to do is to declare that var as GameObject:

var fire : GameObject;