Search Unity

Why does this script not do anything?

Discussion in 'Scripting' started by doomlazy, Jul 28, 2014.

  1. doomlazy

    doomlazy

    Joined:
    Aug 24, 2013
    Posts:
    44
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var deadScene : String;
    4.  
    5. function Start () {
    6.  
    7. }
    8.  
    9. function Update () {
    10.  
    11. }
    12.  
    13. function OnCollisionEnter(other : Collision) {
    14.     if(other.gameObject.tag == "Player") {
    15.         Application.LoadLevel(deadScene);
    16.     }
    17. }
     
  2. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    Do you have two colliders, one with at least a rigidbody, on your two objects? If you have a mesh collider it might need the convex option checked.