• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Appppppppp · Feb 10, 2013 at 09:49 AM · guierrortextureifcondition

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
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

GUI.DrawTexture

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A Button, A Boolean and 2 Textures. 2 Answers

if for array 1 Answer

Compnent.guiTexture is obsolete 1 Answer

Need help with Enabling/Disabling GUITextures with script 1 Answer

Issue with Drawing a GUI texture 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges