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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug ArgumentNullException: Value cannot be null. Parameter name: _unity_self [Fixed]

Discussion in 'Editor & General Support' started by luukbraijmakers, Jul 20, 2023.

  1. luukbraijmakers

    luukbraijmakers

    Joined:
    Feb 11, 2021
    Posts:
    7
    Hi everybody, I made a 2d (URP) scene for Unity 2022.3.5f1 to make a simple prototype. But when I try to enter the victory trigger (pasted below) with my player I got the error: ArgumentNullException: Value cannot be null. Parameter name: _unity_self

    How can Unity itself give a Null Exception? And how can I fix this?

    Victory Trigger script:
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.SceneManagement;
    6.  
    7. public class VictoryTrigger : MonoBehaviour
    8. {
    9.     private void OnTriggerEnter(Collider collider)
    10.     {
    11.         Debug.Log("Working");
    12.         if (collider.CompareTag("Player"))
    13.         {
    14.             Debug.Log("Enter Code");
    15.             SceneManager.LoadScene("MainMenu");
    16.         }
    17.     }
    18. }
    19.  
    20.  
    Before asking: Yes the player has the player tag, and yes there is a scene (in the build settings) with the name MainMenu. The debugs do not get written down.

    Entire Error:
    ArgumentNullException: Value cannot be null.
    Parameter name: _unity_self
    UnityEditor.SerializedObject.FindProperty (System.String propertyPath) (at <bf6080dbf0564cf1b405dfd6e0dac725>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindPropertyRelative (UnityEngine.UIElements.IBindable field, UnityEditor.SerializedProperty parentProperty) (at <68ddc6fd093848298397957a5969af5e>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <68ddc6fd093848298397957a5969af5e>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <68ddc6fd093848298397957a5969af5e>:0)
    UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation+BindingRequest.Bind (UnityEngine.UIElements.VisualElement element) (at <68ddc6fd093848298397957a5969af5e>:0)
    UnityEngine.UIElements.VisualTreeBindingsUpdater.Update () (at <a053cdfb5a094ce2b5935515091f978f>:0)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <a053cdfb5a094ce2b5935515091f978f>:0)
    UnityEngine.UIElements.Panel.UpdateBindings () (at <a053cdfb5a094ce2b5935515091f978f>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <a053cdfb5a094ce2b5935515091f978f>:0)
    UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <a053cdfb5a094ce2b5935515091f978f>:0)
    UnityEditor.RetainedMode.UpdateSchedulers () (at <68ddc6fd093848298397957a5969af5e>:0)

    I can also place down the 2d Movement Script I use, but I don't think that makes any difference.

    Thanks for reading!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,962
  3. luukbraijmakers

    luukbraijmakers

    Joined:
    Feb 11, 2021
    Posts:
    7
    Fixed!

    -1 _Unity _Self Error: I put my entire project in a package and past them into another project. That project was a downgrade. I went from 2022.3.5f1 > 2021.3.28f. The error is fixed now!

    -2 Victory trigger not working: It was a 2d scene, but I used a 3d OnTriggerEnter. Small mistake :)
     
  4. luukbraijmakers

    luukbraijmakers

    Joined:
    Feb 11, 2021
    Posts:
    7