Script Object Decleration?

Having one of those days today... another silly little problem I can't seem to square away.

What is the correct deceleration for script components (eg those returned from GetComponent)

In javaScript I've tried

scriptObject : Component;

But sadly that's way wrong.

Thanks in advance!


Since each component can have totally different nature there is no variable type for it. You have to know what is the component you want to store and declare the variable according to that.

Lets say you want to store a MeshFilter Component. So you'll declare your variable as Mesh.

Found it!

Basically your scripts can be variable types themselves so for us, or script was called GameController so...

scriptObject : GameController;