Horje
oncollisionenter unity Code Example
oncollisionenter unity
void OnCollisionEnter(Collision collision) {
       if (collision.gameObject.tag == "Door")
       {
               // DoorScript is the name you gave to the script on the door
               DoorScript script = collision.gameObject.GetComponent<DoorScript>();
               // OpenDoor is a method in your door object's script
               script.OpenDoor();
       }
}




Csharp

Related
unity create cube in script Code Example unity create cube in script Code Example
c# round number down Code Example c# round number down Code Example
c# how to add newline on text box Code Example c# how to add newline on text box Code Example
increase variable C# Code Example increase variable C# Code Example
c# and Code Example c# and Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13