var textureToDisplay : Texture2D;
function OnGUI () {
GUI.Label (Rect (10, 40, textureToDisplay.width, textureToDisplay.height),
textureToDisplay);
}
The Unity doesn’t support this! WTF?
var textureToDisplay : Texture2D;
function OnGUI () {
GUI.Label (Rect (10, 40, textureToDisplay.width, textureToDisplay.height),
textureToDisplay);
}
The Unity doesn’t support this! WTF?
What are you talking about?
This has nothing to do with operators and nothing to do with what Unity supports. It has everything to do with your code being wrong.
You are trying to create a label, the label class does not support a texture2D.
You want to use:
GUI.DrawTexture(Rect (10, 40, textureToDisplay.width, textureToDisplay.height),textureToDisplay)
Dude, you already making two mistakes in your code. Can you figure it out?
Guys there’s more to this.
Firstly, Labels absolutely support Textures. Secondly, the code he has is taken directly from an example on the documentation page.
The real issue, I believe, begins with the fact that you have a script named Camera in your project. There is already a Unity class named Camera so you have a conflict. First thing I would do is change the name of that script to something else.
He didn’t ask anyone to fix his code, nor did he ask what was wrong with it. From what I gather, the entire point of this post was an anger vent.
Be reasonable. If someone posts code and a screenshot of an error in the console what do you think they are asking? I understand that the post was not written very well, but honestly…
I get annoyed when I spend too long on these forums. I apologise.
Are you referring to stupidity?
You’re absolutely right! Unity doesnt support that!
![]()