Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

NEED HELP ASAP Deadline is midnight tonight.

Discussion in 'Editor & General Support' started by unity_gOB3Wh72XOPe2Q, Feb 24, 2020.

  1. unity_gOB3Wh72XOPe2Q

    unity_gOB3Wh72XOPe2Q

    Joined:
    Feb 15, 2019
    Posts:
    3
    I have a team of middle school students who have been working on their video game design competition for the past three months. Their deadline is today at midnight. Everything was working fine until they added their door trigger. Now it won't work and we can't figure out why. IF there is ANYONE that can help us, I would greatly appreciate it. They taught themselves how to use UNITY, so I know nothing about it and feel helpless. I don't want their hard work to be in vain. Pics below show their code and the error message
    https://drive.google.com/file/d/1x-mZ1ocAzPOFCEt4cPzXUWDQCRkgCtjE/view?usp=sharing
    https://drive.google.com/file/d/1VGKRDQIf4vrl-cb6_V75PGGPph-a1hWH/view?usp=sharing
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    I doubt anyone will be able to read the messages, as the images you've uploaded are extremely low resolution. Any chance you can copy/paste the errors and code, instead of taking a picture of a screen?
     
  3. unity_gOB3Wh72XOPe2Q

    unity_gOB3Wh72XOPe2Q

    Joined:
    Feb 15, 2019
    Posts:
    3
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    The console warning you're seeing can probably be ignored. Just make sure that you've dragged a reference into that field in the inspector.

    As for why the trigger isn't firing, there are various possible reasons.
    • Make sure you've put that DoorTrigger script on the exact same object that has the trigger collider on it. A common mistake is to put the script on a child or parent object, but in that case, OnTriggerEnter won't be called. The fact that you have two objects in your "door" makes me wonder if the collider is on one of the "door" objects, while the script is on the other.
    • Make sure the collider has Is Trigger checked in the inspector.
    • Look at the bottom of this page for a complex table that explains what kinds of objects will cause triggers to fire on collision: https://docs.unity3d.com/Manual/CollidersOverview.html In short, the object hitting your trigger probably needs to have a rigidbody on it, or OnTriggerEnter won't fire.
     
  5. unity_gOB3Wh72XOPe2Q

    unity_gOB3Wh72XOPe2Q

    Joined:
    Feb 15, 2019
    Posts:
    3
    ok. I will have them try that. THey have me from 1:05-2:30 today, so maybe they can see if that will fix it. Thank you so much!!
     
  6. Kragh

    Kragh

    Joined:
    Jan 22, 2008
    Posts:
    656
    It looks like your C# solution is buggy. The built-in class names are in white in your screenshots (MonoBehaviour, Collider). This essentially means that this script will not work, even if nothing else is wrong.
    Try and close the project AND visual studio, delete the .sln file in the root of the project, and restart everything. This is only fixed when the word "MonoBehaviour" is the same color as "DoorTrigger".
    Google it, if my solution doesn't help!