Quantcast
Channel: Answers for "An instance of type "x" is required to access non-static variable "y""
Viewing all articles
Browse latest Browse all 4

Answer by Berenger

$
0
0

What do you mean it works with objects transform ? I tried the scripts in an empty project, two empty game objects and those two scripts. There is indeed the non-static error with w, but I got the same with

var t : Transform = Shift.transform;

And it makes sense. Those variables must be used with an instance of the Shift script, meaning :

var shift_instance : shift;

function Update () 
{
    var t : float = shift_instance .w; // or var t : Transform = shift_instance .transform;
}

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images