Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scripting help floor killing

Discussion in 'Scripting' started by Shyless21, Jul 26, 2016.

  1. Shyless21

    Shyless21

    Joined:
    Jul 26, 2016
    Posts:
    2
    So its the ending of my game and im trying to set it so that when the enemy object hits the Floor it is destroyed and is counted in the destroyed setting, However its not being destroyed and its not counting in the destroyed counter. I've uploaded the script files if you need any more to help me solve the problem just ask. Thanks!
     

    Attached Files:

  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    Try putting a debug.log line as the first line of the OnCollisionEnter2D(..) it'll confirm if the collision is being detected. Does the floor have a Collider2D?
     
  3. Shyless21

    Shyless21

    Joined:
    Jul 26, 2016
    Posts:
    2
    Yes it does, i finally found the error it was that my referenced audio clip wasnt assigned in the inspector Thanks for helping me! sorry i was dumb haha.