For some reason I can’t see the variables in inspector
Somewhere on the open forums says that it might have compiling error:
Label with image works, I’ve seen it on a video, but could be outdated…
i assign it to my main camera -This is my code:
#pragma strict
public Texture2D crosshair; (tried with public var crosshair:Texture; )
public Texture2D crosshair_small;
function OnGUI()
{
GUI.Label (new Rect(Screen.width/3, Screen.height/2, 100, 100), crosshair);
GUI.Label (new Rect(Screen.width/3*2, Screen.height/2, 100,100), crosshair_small);
}
i removed the script and i still get the compiler error 0.o… all i have is 2 cubes on the scene
For real… i cant believe the reason for error… it seems as i have copied the text from other editor it has caught a hidden char or sth… when i retyped it and deleted the old one it worked 0.o …
Actually it shouldn’t work!
Your variable definitions are c# syntax while your function has js syntax.
Oh, and as for OnGUI code itself. Using the new gui for something like a crosshair is total overkill and can cause clutter in your scene. OnGUI is the much better approach in this case IMO.