I want to create a general and public variable that will hold a script.
like: “var obj : GameObject;” will hold a GameObject.
(it will probably be something like “var s : Script” but a bit diffrent)
Is anyone knows this syntax?
I want to create a general and public variable that will hold a script.
like: “var obj : GameObject;” will hold a GameObject.
(it will probably be something like “var s : Script” but a bit diffrent)
Is anyone knows this syntax?
If you need a variable that holds a reference to any kind of script you can use the base class, MonoBehaviour.
// UnityScript
var someVar : MonoBehaviour;
// C#
public MonoBehaviour someVar;
Keep in mind that you can’t access script specific stuff in this case. “someVar” only has the base variables / functions.
Btw: It’s way easier to answer the question or give an alternate solution if we know what you need this for. The less you write the more general the answers will be.
var s : “ScriptType”;
An example follows
Enemy.js
var enemyScript : Enemy;
var myScript : NameOfScript;
(By the way, don’t just blindly type “NameOfScript”; you’re supposed to actually use the name of the actual script.)