Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by dgoelitz · Apr 01, 2013 at 03:07 AM · guimenu

I have been struggling with a GUI texture for over a week now. What am I doing wrong?

 #pragma strict
 
 /* Silence MonoBehaviour Warnings*/ 
 private function SilenceWarnings() : void { 
     var al : ArrayList; 
     if(al == null); 
     var ae : AccelerationEvent; 
     if(ae == 0); 
     var dcm : DrawCameraMode; 
     if(dcm == 10) SilenceWarnings(); 
 }
 
 var menuState : int = 0;
 var titleTex : GUITexture;
 
 function Update () {
 
 if ((Timer.timeCount >= 7) && (menuState == 0)) {
     menuState = 1;
     print(menuState);
     }
     
 if (menuState == 1) {
     titleTex.enabled = true;
     }
 }
Comment
Add comment · Show 8
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 · Apr 01, 2013 at 03:18 AM 0
Share

We usually don't copy your script and ran it in our PC. Please put in more details about your problem (What is expected, what had happened), then we will inspect your script to see which line might cause the problem.

avatar image Loius · Apr 01, 2013 at 04:21 AM 0
Share

I would remove that SilenceWarnings function before it infinite-loop crashes your Unity. If that's there to silence warnings caused by those particular variables, you might want to address those warnings elsewhere. They don't sound harmless :P

There's nothing wrong in your update, just be sure titleTex is in visible range of the camera.

avatar image Kacho · Apr 01, 2013 at 04:32 AM 1
Share

Atleast eloborate your problem regarding the script.

avatar image dgoelitz · Apr 01, 2013 at 08:13 AM 0
Share

Sorry about that. I'm trying to make a GUI texture appear on my screen and it doesn't appear at all. This is on an empty object so, if I'm not mistaken, the placement of the object in regards to the camera shouldn't matter. The texture appears when I enable it manually. So far I can't enable it through a script. I'll make the warning silencer a start function. It was to remove an annoying warning about not using system.collections.

avatar image Shankar · Apr 01, 2013 at 08:38 AM 0
Share

If u don't $$anonymous$$d can please tell me correct requirement. so that will help u. Or else can please mail me ur requirement or project. i will see and if possible i will fix that and send to u. u can reach shankarraopilli@gmail.com or skype : shankar.clite

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Shankar · Apr 01, 2013 at 05:19 PM

Hi Mr Dgoelitz,

please find this code once:

 var isTextureVisible : boolean;
       var someTexture : GUITexture;
 
       function Update()
      {
 if(isTextureVisible)
     someTexture.gameObject.active = true;
 else
     someTexture.gameObject.active = false;
       }


if u want scene : https://www.dropbox.com/s/qeq8hq8yong32wn/GuiTexture.unitypackage

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 dgoelitz · Apr 01, 2013 at 10:18 PM 0
Share

Awesome! It finally worked. I didn't know that I needed a boolean for this. Also It turned out that I had to have the checkbox in the texture marked, and setting it to active was something different. Shankar, I can't thank you enough.

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

14 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

Related Questions

Game Menus WIth Keyboard Input Control 1 Answer

Creating a Main Menu: 3 Answers

Bringing window to back GUI.BringWindowToBack() 0 Answers

Accessing the Asset's setting from code using Wizards/Editor classes? 0 Answers

How to make a simple menu button with C Sharp 1 Answer


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