- Home /
Wearied Error
Wearied Error comes Like: BCE0026:'void'cannot be used in boolen context.
Here's the code
var msg="Make your choice!";
var Background : Texture;
var RockG : Texture;
var Rock : Texture;
var PaperG : Texture;
var Paper : Texture;
var ScissorG : Texture;
var Scissor : Texture;
var Player : Texture;
var Computer : Texture;
function OnGUI() {
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height), Background);
if (GUI.DrawTexture(Rect(Screen.width/2 - Rock.width * 2,Screen.height/2 + Screen.height/10,Rock.width,Rock.height), Rock))
{
}
GUI.DrawTexture(Rect(Screen.width/2 - Rock.width + Rock.width/2,Screen.height/2 + Screen.height/10,Rock.width,Rock.height), Paper);
GUI.DrawTexture(Rect(Screen.width/2 + Rock.width,Screen.height/2 + Screen.height/10,Rock.width,Rock.height), Scissor);
On line 15 the error comes
Thanxx in advance
Comment
Answer by $$anonymous$$ · Feb 10, 2013 at 10:01 AM
GUI.DrawTexture()
returns nothing (`void`), so you can't use it in a boolean context (an if
statement). Remove the if
from around that call, and use buttons or something else that can be clicked to check for user input.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092442im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Need help with Enabling/Disabling GUITextures with script 1 Answer
Issue with Drawing a GUI texture 0 Answers
GUI Texture error. 1 Answer
if for array 1 Answer
Show GUI texture then not 0 Answers