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

Bug System.ArgumentNullException : Value cannot be null. Parameter name: _unity_self

Discussion in 'UI Toolkit' started by amateurd, Jun 12, 2023.

  1. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    95
    I get this error sometimes. When it happens it repeats like hundreds of times.

    The debugging lists UIElements as the cause:
    ArgumentNullException: Value cannot be null.
    Parameter name: _unity_self
    UnityEditor.SerializedObject.FindProperty (System.String propertyPath) (at <582c35e8f45345d395e99f8e72e3c16d>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindPropertyRelative (UnityEngine.UIElements.IBindable field, UnityEditor.SerializedProperty parentProperty) (at <af95451922f042e9a8d1a10956fb36a2>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <af95451922f042e9a8d1a10956fb36a2>:0)
    UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <af95451922f042e9a8d1a10956fb36a2>:0)
    UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation+BindingRequest.Bind (UnityEngine.UIElements.VisualElement element) (at <af95451922f042e9a8d1a10956fb36a2>:0)
    UnityEngine.UIElements.VisualTreeBindingsUpdater.Update () (at <d293f45b4ec64e6c9e762fe89794e7a5>:0)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <d293f45b4ec64e6c9e762fe89794e7a5>:0)
    UnityEngine.UIElements.Panel.UpdateBindings () (at <d293f45b4ec64e6c9e762fe89794e7a5>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <d293f45b4ec64e6c9e762fe89794e7a5>:0)
    UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <d293f45b4ec64e6c9e762fe89794e7a5>:0)
    UnityEditor.RetainedMode.UpdateSchedulers () (at <af95451922f042e9a8d1a10956fb36a2>:0)


    I'm not using UIElements yet so I've disabled it in Package Manager to get round it but still getting the error. Only noticed this since switching to Unity 2022.3.1.
     
    Last edited: Jun 12, 2023
  2. reoby

    reoby

    Joined:
    Jan 11, 2022
    Posts:
    2
    Same thing with 2022.3.0f1
    Nothing works.

    And quality of the picture looks worst now...

    UPDATE 2023-06-14: quality of picture is OK, it was other problem, I've solved it. Only
    ArgumentNullException: Value cannot be null. Parameter name: _unity_self bug appers 8 times after start of the game.

    UPDATE 2023-06-15: I've changed editor version to 2022.3.2f1 - the same
     
    Last edited: Jun 15, 2023
  3. frc3design

    frc3design

    Joined:
    Sep 10, 2017
    Posts:
    4
    For me, the error only appears if I have an instance of the scriptable object selected or if any selected object has a scriptable object reference.
    And it only triggers the error if it has a stored float value.
     
    wattse13, reoby and amateurd like this.
  4. reoby

    reoby

    Joined:
    Jan 11, 2022
    Posts:
    2
    Thanx, bro! I have the same behaviour. At least some solution to run the game without errors.
     
  5. Isaaccy

    Isaaccy

    Joined:
    Apr 11, 2020
    Posts:
    1
    Do you have any update to this? I want to start a project but I've had this problem also. Not sure if I should go with an older version or if this is a simple fix/if this issue does anything substantial?
     
    amateurd likes this.
  6. Use3rname

    Use3rname

    Joined:
    Feb 11, 2023
    Posts:
    3
    This happens more often for me if I have selected debug view in the inspector.
     
    amateurd likes this.
  7. Use3rname

    Use3rname

    Joined:
    Feb 11, 2023
    Posts:
    3
    Also started happening only after updating to the recent version as well
     
    daneobyrd and amateurd like this.
  8. Use3rname

    Use3rname

    Joined:
    Feb 11, 2023
    Posts:
    3
    This bug also sometimes disables scripts' exposed variables from view in the inspector.. really annoying
     
    daneobyrd and amateurd like this.
  9. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    95
    Does anyone know if this affects standalone builds or just the Editor? I don't think I get it on 2022.3.1 but I frequently get it on 2022.3.2 and 2022.3.3 (LTS).

    I don't use ScriptableObjects.
     
  10. Natzke

    Natzke

    Joined:
    Feb 5, 2017
    Posts:
    7
    Ran into this error and after reading this thread I was reminded of an issue I was having with exposed variables.

    IF I hit Play while a script with an exposed variable is visible in the Editor I get the error, but if I play with nothing selected (or something selected that doesn't have an exposed variable, like the Directional Light) I don't get the error.

    The Unity BUG is that it is having a problem with exposed variables that are visible in the Editor at the time we hit Play. (At least for me)
     
  11. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    95
    That's helpful and suggests maybe it won't affect standalone builds, which is reassuring.
     
  12. seancrwhite

    seancrwhite

    Joined:
    Apr 4, 2021
    Posts:
    1
    I can confirm I'm also running into this on 2022.3.0f when starting the game in the editor with one specific GameObject selected (player controlled GO in my case). It seemed to stop when deleting it and recreating it in the same way in the editor, but popped up again one day when starting work on the project, i.e. after making no changes from the last run.
     
    amateurd likes this.
  13. IsaaK-Devs23

    IsaaK-Devs23

    Joined:
    Feb 9, 2023
    Posts:
    3
    its a bug from new LTS, beacause i update my editor too and was the first time i get this error
     
  14. IsaaK-Devs23

    IsaaK-Devs23

    Joined:
    Feb 9, 2023
    Posts:
    3
    I think it can mess with your script functionality, even methods
     
  15. IsaaK-Devs23

    IsaaK-Devs23

    Joined:
    Feb 9, 2023
    Posts:
    3
    U can use Debug Inspector to see hiden variables
     
    Kadir- likes this.
  16. TonCoder

    TonCoder

    Joined:
    Nov 27, 2016
    Posts:
    12
    Was this reported? I am experiencing the same issue when selecting a SO (Scriptable Object) and playing, didn't have this problem on 2020 version
     
  17. unity_0GlwZ4j_Ggr0lA

    unity_0GlwZ4j_Ggr0lA

    Joined:
    Nov 30, 2019
    Posts:
    8
    I'm also having this issue.

    I found it is intermittent. However, it is possible to make the error occur if you rapidly run your mouse pointer over the exposed variables in the inspector as the game is 'booting up' in playmode.

    I did report this bug through the editor bug report system.
     
  18. CharlieCook

    CharlieCook

    Joined:
    May 10, 2019
    Posts:
    13
    Problem was reoccurring after every Play.
    I removed the Library Folder, then the files in the Root:
    .vsconfig
    assebly-csharp
    asssembly-csharp-editor
    .sln

    so far hasn't reoccurred, so far
     
  19. CharlieCook

    CharlieCook

    Joined:
    May 10, 2019
    Posts:
    13
    Well, that didn't work. After about 10 tries it came back...ha ha ha
     
  20. cidmodder

    cidmodder

    Joined:
    Dec 9, 2010
    Posts:
    21
    Same error for me as well. It seems like what Natzke said was the source for me. As long as I'm not clicking on an Object that can show me an exposed variable in the inspector, it plays fine without any errors and I can see everything in the inspector after that.
     
  21. FaffyWaffles

    FaffyWaffles

    Joined:
    Apr 10, 2020
    Posts:
    45
    Error for me as well. No idea why. I'm using Odin Inspector, if that is any help, but it does not seem consistent with that. I only bring it up due to the "UIElements" being flagged.
     
  22. RasmusMolckNilsson

    RasmusMolckNilsson

    Joined:
    May 14, 2021
    Posts:
    6
    Same issue here after updating a project from 2021.1 to 2022.3.5f1
     
  23. RasmusMolckNilsson

    RasmusMolckNilsson

    Joined:
    May 14, 2021
    Posts:
    6
    Just did some more testing in a brand new project using 2022.3.5f1. I get the error if I inspect an instance of this simple scriptable object while entering playmode:
    EDIT: S2 is just another scritable
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3.  
    4. public class S1 : ScriptableObject
    5. {
    6.     public List<S2> list;
    7.  
    8.     public S2 single;
    9. }
    This is basically just scriptable objects not working with the editor anymore. Please fix.
     
  24. CharlieCook

    CharlieCook

    Joined:
    May 10, 2019
    Posts:
    13
    Well I can repeat and remove the problem now.

    It seems during 'PLAY', when I add a public list from script or click on a public list and it elements in the Inspector, it is this action that creates the problem.
    To remove it, STOP running the game, then click on a public list or two... and some of their elements, in the inspector, then press on a Gameobject in hierarchy, and then press PLAY.
     
    Last edited: Aug 1, 2023
    amateurd likes this.
  25. futuristss

    futuristss

    Joined:
    Apr 28, 2023
    Posts:
    1
    I was able to make it go away by closing one of the Inspector tabs. I had two open at the time the issue started to occur.
     
    amateurd likes this.
  26. halagame

    halagame

    Joined:
    Jan 14, 2020
    Posts:
    15
    same here, after upgrade to 2023, this error occurs
     
  27. CubanMathExpert

    CubanMathExpert

    Joined:
    Nov 10, 2020
    Posts:
    1
    Ok here is what I figured out. My character could throw projectiles and I rescaled the projectile in my script. After doing that the error would appear. As soon as I removed the line transform.localScale = Vector3(...) * 0.5f; everything was fixed. Hopefully this is helpful to someone who did that same as me.
     
  28. lilim_mlk

    lilim_mlk

    Joined:
    Apr 12, 2019
    Posts:
    1
    I'm using Unity 2022.3.5.f1 and I solve this when I lock inspector:

    Captura de Tela 2023-08-23 às 10.49.05.png

    I don't know why, but it's work for me.
     
  29. s99113266

    s99113266

    Joined:
    Sep 15, 2019
    Posts:
    1
    Windows 11
    Edi > Project Settings > Editor > Enter Play Mode Settings > Enter Play Mode Options
    Check or uncheck every time an error occurs.

    upload_2023-8-31_17-21-3.png
     
    tkamruzzaman and Tapuck like this.
  30. ShowbagGames

    ShowbagGames

    Joined:
    Sep 24, 2012
    Posts:
    9
    this is the answer
     
  31. Tapuck

    Tapuck

    Joined:
    Sep 5, 2017
    Posts:
    1
    Yup, this fixed it for me. Now I can be clicked on my scriptable object when I go into play mode, all the variables are showing now with no errors. Great find, thank you.