Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question ArgumentNullException: Value cannot be null. Parameter name: _unity_self

Discussion in 'Editor & General Support' started by leegod, May 2, 2023.

  1. Farsam

    Farsam

    Joined:
    Jul 24, 2023
    Posts:
    6
    Thanks that solved my problem!
     
  2. Mil8n_Games

    Mil8n_Games

    Joined:
    Oct 27, 2022
    Posts:
    1
    Just restart the thing
     
  3. brianduper

    brianduper

    Joined:
    Nov 12, 2020
    Posts:
    4
    i have this with unity version 2022.3.7f1 ... selecting a gameobject without a script before hitting play seems to be the workaround.
     
  4. JonathanCel

    JonathanCel

    Joined:
    Feb 17, 2021
    Posts:
    22
    In my case I was trying to Debug.Log( unityWebRequest.url ); after disposing the unityWebRequest.
    Guess it's related to a mismatch between the unity and native side of things?
     
    bleater likes this.
  5. marcosatienzagd

    marcosatienzagd

    Joined:
    Sep 11, 2023
    Posts:
    4
    I'm having this same error on 2022.3.0. Should I try upgrading the Unity version, or the chances of getting more errors like this one are higher?
     
  6. ZombiePossum

    ZombiePossum

    Joined:
    Dec 10, 2013
    Posts:
    2
    I'm sure no one wants to hear this but I had this and simply restarting Unity and Visual Studio fixed it.
     
    bobbaluba likes this.
  7. Aekila

    Aekila

    Joined:
    Sep 27, 2023
    Posts:
    2
    Hi, I'm experiencing this issue on Unity 2022.3.10f1.

    Thank you for your comment, I'm now using the "click on nowhere" (at least not clicking on a gameobject with serializedRefs on a script) turnaround...

    I tried many times to upvote, but it seems that the issuetracker has also a really weird issue on this particular issue report... When I log in and try to go to this issue report, I get automatically an ending session and redirection to default issuetracker page... Anyway, simple turnaround seems to work fine for now.
     
    antsy1992 likes this.
  8. antsy1992

    antsy1992

    Joined:
    Jan 8, 2021
    Posts:
    8
    Lol I confirm this. I have the same behaviour on 2022.3.10f1.
     
    studiowebux likes this.
  9. SKGowrob

    SKGowrob

    Joined:
    Sep 12, 2021
    Posts:
    11
    I also confirm same issue on 2022.3.10f1 LTS
    "Seems to happen when a GameObject with a script is selected" is true.
     
  10. Papouth

    Papouth

    Joined:
    Mar 28, 2020
    Posts:
    8

    Yeah, experiencing the same issue on 2022.3.5f1

    It happen only when I press play with the GameObject with the script on it
     
  11. Rilantes

    Rilantes

    Joined:
    Jul 15, 2018
    Posts:
    1
    Seeing the same thing on 2022.3.11f1
     
  12. gnovos

    gnovos

    Joined:
    Apr 29, 2020
    Posts:
    26
    Same for latest 2022.3.11f1 an dhas been happening for quite a few versions. It seems to happen when looking at specific prefabs and objects in the inspector, particularly ones I've added or removed public/serialized fields from recently, and it usually won't display all the fields for the object until I click away and click back. It doesn't seem to affect the actual game when playing, but eventually the editor will crash.
     
  13. Raphael-Guitar-X

    Raphael-Guitar-X

    Joined:
    Sep 19, 2015
    Posts:
    1
    had this issue, solved by editng my player's code which had like a double check if grounded
     
  14. yangchang_n

    yangchang_n

    Joined:
    Jul 31, 2023
    Posts:
    1
    Same on 2022.3.10f1
    I wanted to observe how the value of that object changes during play, but that error message made me very uncomfortable. And after reading the comments, it looks like this problem will continue in version 2022.3.100000f1 as well :rolleyes:
     
  15. Julber

    Julber

    Joined:
    Nov 15, 2016
    Posts:
    1
    Nice. Reimporting all on 2022.3.2f1 fixed this for me indeed (Assets -> Reimport All). I have a script with two private arrays with [SerializeField] and exiting play mode while a GO with the script was selected used to give the error
     
  16. Geouug

    Geouug

    Joined:
    Feb 13, 2018
    Posts:
    3
    Just wanted to check to say that I had this exact issue, and for me it was absolutely due to having a scriptableObject selected in the editor. I got 32 errors, and there are 32 serializefields on my scriptableobject.

    De-selected the object, pressed play, and no errors!
     
  17. Ponzel

    Ponzel

    Joined:
    Jun 17, 2017
    Posts:
    39
    Also happening for us on 2022.3.10f1 LTS
     
  18. khangames916

    khangames916

    Joined:
    Jun 28, 2023
    Posts:
    1
    ( for me this problem occurred when I replaced a prefab asset in a scriptable object and I referenced this scriptable object although the reference was there but still unity was still unable to update it that's why it was causing something like null because the old prefab was replaced and the new was not recognized by unity my English is not good but hope it solves someone problem instead of doing the long way i am also using unity 2022 )
     
  19. TheBossaaaa

    TheBossaaaa

    Joined:
    Nov 19, 2022
    Posts:
    7
    Hi there!

    Unity 2022.3.9f1

    I have discovered this error for the first time today. For me, it is because of a [SerializeField] in a Prefab.
    I was able to solve the issue but couldn't able to replicate it.
    Here is a screenshot:
    upload_2023-12-5_14-15-14.png

    As you can see, the Path has no elements in the Prefab because the script has been tasked to get the component. In my case, this is what triggered the error. I pressed the plus to add an element which triggered another error:

    upload_2023-12-5_14-19-9.png

    upload_2023-12-5_14-18-30.png

    However, no matter if you keep the "None" element or not both errors won't appear again. Removing the element and adding it again will only trigger the "Property has been disposed of" message. Either way, it did not affect the prototyping process and the scripts are working as expected.
     

    Attached Files:

  20. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,219
    Have seen the same issue, this is for Unity to solve on their side, so make sure to report a bug, the more reports the more the chances to see the faulty Unity version fixed.
     
  21. gosuarez

    gosuarez

    Joined:
    Nov 16, 2019
    Posts:
    5
    Using Unity 2022.3. Not selecting any object from Hierarchy after pressing play worked for me. I tried reimporting the project, but the error persists when selecting an object in the hierarchy before pressing play.
     
    boolean01 likes this.
  22. zygmumac

    zygmumac

    Joined:
    Jun 15, 2020
    Posts:
    1
    Had this problem in Unity 2022.3.15f1.

    In our case the default Unity 2022 editor had issues when displaying lists / arrays on a particular script (as in a Unity bug). This behaviour wasn't very... deterministic when it came to which fields were causing the problem, but we did manage to find a workaround.

    What helped us was writing an editor script for the MonoBehaviour located on the GameObject that caused the problem. The editor script simply draws the default inspector, bypassing whatever additional stuff Unity is doing when creating their inspector in 2022 (this includes the scrollable arrays if they get too long).

    Code (CSharp):
    1. using UnityEditor;
    2.  
    3. [CustomEditor(typeof(SampleMonoBehaviour)), CanEditMultipleObjects]
    4. public class SampleMonoBehaviourEditor : Editor
    5. {
    6.     public override void OnInspectorGUI()
    7.     {
    8.         // update the serialized object
    9.         serializedObject.Update();
    10.  
    11.         // show the default inspector, bypassing unity's "new and shiny" editor shenanigans
    12.         DrawDefaultInspector();
    13.  
    14.         // if anything changed inside the serialized object, apply the changes
    15.         serializedObject.ApplyModifiedProperties();
    16.     }
    17. }
    Substitute "SampleMonoBehaviour" with the name of your MonoBehaviour.

    This caused the editor to look like the one in 2021 (no scrollable long arrays and such), but the problems went away.

    Hope this helps.
     
  23. soggyinkgames

    soggyinkgames

    Joined:
    Oct 4, 2021
    Posts:
    4
    i washaving same issue but then noticed i was signed out, signed back in and that removed the problem
     
  24. DaveBrown1971

    DaveBrown1971

    Joined:
    Aug 12, 2023
    Posts:
    1
    If you have anything hidden in the inspection window when your game starts it will throw the error.
    If you want to hide a GameObject do object.SetActive(false) in the void Start of your script.
    You wont get the error anymore.
     
  25. IcyDark

    IcyDark

    Joined:
    Jun 27, 2019
    Posts:
    1
    This is unity's potato code, just creating a random object like canvas and the having it selected in hierarchy while clicking the play button will cause this error. 2022.3.2f1 LTS.

    Hopefully 2023 LTS won't have these, having red letters in the console is an instant PTSD.