Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
-1
Question by KieranG · May 18, 2013 at 03:06 AM · c#scripting problemguiguitexture

What am I doing wrong? C#

 using UnityEngine;
 using System.Collections;
 
 public class MainGUI : MonoBehaviour {
     
     public GUITexture redKey;
     public GUITexture greenKey;
     public GUITexture pinkKey;
     public GUITexture yellowKey;
     public GUITexture purpleKey;
     public GUITexture orangeKey;
     
     public Vector2 redCoord;
     public Vector2 greenCoord;
     public Vector2 pinkCoord;
     public Vector2 yellowCoord;
     public Vector2 purpleCoord;
     public Vector2 orangeCoord;
     
     //other script with bool seing if you have a key
     public doors d; 
     
     
     // Use this for initialization
     void Start () {
         
         redKey.enabled = true;
         greenKey.enabled = false;
         pinkKey.enabled = false;
         yellowKey.enabled = false;
         purpleKey.enabled = false;
         orangeKey.enabled = false;
         
     
     }
     
     // Update is called once per frame
     void Update () {
     
         if (d.aredKey == true){
             redKey.enabled = true;    
         }
         
         if (d.agreenKey == true){
             greenKey.enabled = true;    
         }
         
         if (d.apinkKey == true){
             pinkKey.enabled = true;    
         }
         
         if (d.apinkKey == true){
             pinkKey.enabled = true;    
         }
         
         if (d.ayellowKey == true){
             yellowKey.enabled = true;    
         }
         
         if (d.apurpleKey == true){
             purpleKey.enabled = true;    
         }
         
         if (d.aorangeKey == true){
             orangeKey.enabled = true;    
         }
     
     }
     
 }


Im trying to get my GUITexture to display when I hit a key but nothing is happening

Comment
Add comment · Show 4
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
avatar image Chronos-L · May 18, 2013 at 03:06 AM 0
Share

Post the code of your other script as well.

avatar image KieranG · May 18, 2013 at 03:15 AM 0
Share
 using UnityEngine;
 using System.Collections;
 
 public class doors : $$anonymous$$onoBehaviour {
     
     public bool ared$$anonymous$$ey = false;    
 
 
 void OnTriggerEnter(Collider other) {
         if (other.gameObject.tag == "ered$$anonymous$$ey") {
             ared$$anonymous$$ey = true;
             Destroy(other.gameObject);
         }
         }
 }
avatar image Chronos-L · May 18, 2013 at 03:43 AM 0
Share

Where are the agreenkey, apink$$anonymous$$ey, etc? And what do you mean by when you hit a key (Press keyboard, press a UI button, click on a gameobject etc)?

avatar image numberkruncher · May 26, 2013 at 01:53 PM 0
Share

"What am I doing wrong? C#" type questions are better addressed in forums since they are typically not useful for future readers in the Q&A format. When posting a question here you should be more specific so as to help future readers. Please also spend a little more time explaining your question in greater detail ins$$anonymous$$d of just pasting a large chunk of source code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SubatomicHero · May 20, 2013 at 07:00 AM

Have you noticed the mis-spelling on the tag in your OnTriggerEnter() function in comparison to your other script at all?

Comment
Add comment · Show 1 · 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
avatar image KieranG · May 20, 2013 at 11:14 AM 0
Share

ered$$anonymous$$ey is the correct tag

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.

Follow this Question

Answers Answers and Comments

16 People are following this question.

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

Related Questions

Erroe when resizing GUITextures in C# file 1 Answer

3 Days and I still can't figure out c# reflection, please help? Trying to use a protected Type and method. 1 Answer

Toggle GuiTexture 1 Answer

What is frame, How OnGuI is called every frame? 2 Answers

UFPS:ultimate fps cameraGUI texture wont show in game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges