c# - Unity 3D - GameObject.GetComponent error -


i working google cardboard plugin in unity 3d (version 5.3.2). have c# script set supposed access variable "target" script "gvrhead.cs". part of script (it called "crystaldrop.cs"):

        12. public transform target2;         13. private gameobject headobj;         14. private gvrhead myscript;         15.         16.         17. void start () {         18.     headobj = gameobject.find ("gvrheadobj");         19.     myscript = headobj.getcomponent(gvrhead);         20.     myscript.target = target2;         21. } 

but when run project in unity, error:

assets/crystaldrop.cs(19,49): error cs0119: expression denotes type, variable, value or method group expected.

does know going on?

use this:

    12. public transform target2;     13. private gameobject headobj;     14. private gvrhead myscript;     15.     16.     17. void start () {     18.     gvrhead.target = target2;     21. } 

Comments