Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

detect trigger in unity

// Trigger must be checked on one of the Colliders
private void OnTriggerEnter(Collider hit) {    
  Debug.Log(gameObject.name + " just hit " + hit.name); 
}
private void OnTriggerStay(Collider hit) { 
  Debug.Log(gameObject.name + " is hitting " + hit.name); 
}
private void OnTriggerExit(Collider hit) { 
  Debug.Log(gameObject.name + " stopped hitting " + hit.name); 
}
// For 2D 
private void OnTriggerEnter2D(Collider2D hit) { }
private void OnTriggerStay2D(Collider2D hit) { }
private void OnTriggerExit2D(Collider2D hit) { }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# ascii to char 
Csharp :: C# aspnet how to run a migration 
Csharp :: C# delete last enviroment new line 
Csharp :: fair division 
Csharp :: unity get textmesh pro component 
Csharp :: ++ operator c# 
Csharp :: get enum int by name 
Csharp :: exit a method c# 
Csharp :: transfer ownership photon2 
Csharp :: unity move object to mouse position 
Csharp :: button action asp net 
Csharp :: get logged in user name c# 
Csharp :: convert int to uint c# 
Csharp :: How to get the world position of the edge of an object? 
Csharp :: regex c# password numbers and letters 
Csharp :: DateTime previous day c# 
Csharp :: unity detect any key 
Csharp :: c# encrypt decrypt string 
Csharp :: c# dictionary first 
Csharp :: how to convert from hexadecimal to binary in c# 
Csharp :: c# hex to console color 
Csharp :: unity clamp rotation 
Csharp :: how to map datatable to list in c# 
Csharp :: how to save a c# dictionary 
Csharp :: dotnet ef database update connection string 
Csharp :: how to change the color of a sprite in unity 
Csharp :: how to make an object appear and disappear in unity 
Csharp :: covert char[] to string C# 
Csharp :: mvc 5 dropdownlist 
Csharp :: c# multiply string 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =