Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

PLZ HELP I KEEP GETTING A NULL REFRENCE ERROR

Discussion in 'Visual Scripting' started by bladetechtips, Aug 27, 2020.

  1. bladetechtips

    bladetechtips

    Joined:
    Aug 18, 2020
    Posts:
    3
    hi i am having some issues with this script down below i keep getting a null reference error and i don't know how to fix it Screenshot (26).png
     
  2. willemsenzo

    willemsenzo

    Joined:
    Nov 15, 2012
    Posts:
    578
    You posted in the wrong category. Anyway, only problem I can imagine by looking at the image is that you forgot to assign a spawnpoint in the inspector.
     
  3. bladetechtips

    bladetechtips

    Joined:
    Aug 18, 2020
    Posts:
    3
    yeah no everything is assigned
     
  4. Ex-Crow

    Ex-Crow

    Joined:
    Aug 14, 2020
    Posts:
    111
    1. You've posted in the wrong category, like willemsenzo said.
    2. When you're asking for help with errors, paste in the actual errors.
    3. My guess is that the raycast is not hitting anything and both your if conditions before destroy function are true if nothing is hit so when it tries do destroy that nothing you're getting null reference errors.
     
    Last edited: Aug 31, 2020
  5. bladetechtips

    bladetechtips

    Joined:
    Aug 18, 2020
    Posts:
    3
    it wouldn't let me post anywhere else
     
  6. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    473
    I find that hard to believe..
     
  7. faisal0608

    faisal0608

    Joined:
    Jul 13, 2020
    Posts:
    1
    first you should add an if statement to check your Raycast is not equal to null before you check if it didnt hit the ground or player
     
unityunity