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 BlackWingsCorp · Dec 29, 2012 at 06:01 PM · guifunctionenable

GUItexture not showing on runtime or trigger

hey devs how r u? I'm having some problem with enabling a GUItexture on the runtime in my game. the texture must appear when the player either collides with the door or when he picks up a cell but the texture does not appear on both sides I think it's an error in my HUDon function I dunno... so here:

TriggerZone Script:

 function Start () {
 
 }
 
 function Update () {
 
 }
 
 function OnTriggerEnter (col : Collider) {
     var lockedSound : AudioClip;
 
     if(col.gameObject.tag == "Player") {
         if(Inventory.charge == 4) {
             transform.FindChild("door").SendMessage("DoorCheck");
         } else {
             transform.FindChild("door").audio.PlayOneShot(lockedSound);
             col.gameObject.SendMessage("HUDon");
         }
     }
 }
 

And this is the Inventory script:

 static var charge : int = 0; 
 var collectSound : AudioClip; 
 var hudCharge : Texture2D[];  
 var chargeHudGUI : GUITexture;
 
 function Start () {
     charge = 0;
 }
 
 function Update () {
 
 }
 
 function CellPickup () { 
     HUDon(); 
     AudioSource.PlayClipAtPoint(collectSound, transform.position);
     charge++;
     chargeHudGUI.texture = hudCharge[charge];   
 }
 
 function HUDon(){
     if(!chargeHudGUI.enabled){ 
         chargeHudGUI.enabled = true;
     }  
 }

Thanks in advance guys

Comment
Add comment · Show 3
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 Piflik · Dec 29, 2012 at 06:12 PM 0
Share

Please format your code correctly on future posts. Fixed it for you this time.

avatar image VicM · Dec 29, 2012 at 06:15 PM 0
Share

what if you add some Debug.log messages to see if the proper functions are being called.

Also, have you check if you colliders as the "on trigger" enabled inside the inspector?

avatar image BlackWingsCorp · Dec 29, 2012 at 07:33 PM 0
Share

@Piflik 10x I just learned how to do that lol :P

@Vc$$anonymous$$ the trigger option is enabled in the inspector, the door is opening when the player collects all 4 cells so basically everything is working just right, when I check the GUITexture's box (the 1 at left of it's title in the inspector) it appears at the start of the game & works well. $$anonymous$$y goal is to make it appear only when the player enters the trigger without cells or when he captures 1 for the 1st time.

0 Replies

· Add your reply
  • Sort: 

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

11 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

Related Questions

Multiple Cars not working 1 Answer

How do i merge these things? 1 Answer

Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers

Help! Why doesn't this work? GUI/Static vars Help! Javascript 1 Answer

Creation of checkbox next to text 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