• 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 /
This question was closed Oct 13, 2014 at 02:59 AM by MC HALO for the following reason:

I fixed the problem myself

avatar image
0
Question by MC HALO · Oct 13, 2014 at 01:57 AM · ontriggerexit

Unity 3D OnTriggerExit No Collision??

Hi all,

I have used unity for a long time and I have come across this when i upgraded my unity to 4.5. Basically in the older unity my OnTrigger stuff worked just fine, now a couple of days ago I was making something using triggers and the OnTriggerEnter worked just fine. Now when it comes to OnTriggerExit nothing really happens, nothing happens at all it just displays my Debug but after that its nothing.

My player has a Character Controller on it and it still would not do anything. When I added a rigidbody to the player it then started to display the debug but if i remove it it wont show it.

Here is my current scrip I would appreciate if someone could have a look for me thank you.


CODE _------------------------------------

  var HUDPos: float[];
  var HUDTexture : GUISkin;
   
  private var guiRatio: float;
  
  private var sWidth: float;
  
  private var guiRatioHeight: float;
  
  private var sHeight: float;
  
  private var GUIsf: Vector3;
  
  var Out_Zone: boolean = false;
  
 
 function Update () {
 
 
    sWidth = Screen.width;
    
    sHeight = Screen.height;
    
    guiRatio = sWidth/2560;
    
    guiRatioHeight = sHeight/1440;
    
    GUIsf = new Vector3( guiRatio, guiRatioHeight, 1);
 
 }
 
 
 function OnGUI(){
     if( Out_Zone == true){
     GUI.matrix = Matrix4x4.TRS( new Vector3( Screen.width - HUDPos[0] * GUIsf.x, Screen.height - HUDPos[1] * GUIsf.y, 0), Quaternion.identity, GUIsf);
     GUI.Label( new Rect ( 0, 0, HUDPos[2], HUDPos[3])," YOUR OUT", HUDTexture.customStyles[0]);
     }
     
 }
 
 
 function OnTriggerEnter (col : Collider) {
 
    
     if( col.collider.gameObject.CompareTag( "Player" )){
     Debug.Log(" You are In");
       Out_Zone = true;
      }
     
 
 }
 
 function OnTriggerExit (other : Collider) {
 
    
     
       Debug.Log(" YDDD");
      
       if( other.collider.gameObject.CompareTag( "Player" )){
       Out_Zone = false;
      }
     
     
 
 
 }
 
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

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

28 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 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

How to Apply a script During collison? 3 Answers

Triggerexit, behaviour issue 1 Answer

Get WHICH trigger for OnTriggerEnter? 1 Answer

On trigger exit: player speed value not changing, why?? 1 Answer

How to destroy an instantiated prefab object and keep instantiating it 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