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

Null exception in _unity_self

Discussion in '2019.3 Beta' started by Dreamback, Jan 14, 2020.

  1. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    I'm getting this strange null exception, not really sure if it's a 2019.3 issue, a Linux issue, or an HDRP issue.

    This is caused by the code:
    Code (CSharp):
    1.         if (myCamera != null)
    2.         {
    3.             myCamera.RemoveAllCommandBuffers();
    4.         }
    5.  
    Edit:
    Seems to have been fixed by also checking if myCamera.commandBufferCount > 0 before removing command buffers
     
    Last edited: Jan 14, 2020
  2. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    I was wrong, that didn't fix it. I'm still getting that null exception in _unity_self whenever I remove command buffers
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,106
    Could you please submit a bug report with a minimal reproduction project?
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,239
    Looking at the stacktrace, it seems like you actually have a null CommandBuffer attached to the camera - the null isn't referring to the camera variable.

    Sorry the error message isn't very helpful - a bug report would still be useful to help us improve this. Not sure how/why a null CommandBuffer would be attached to the camera, or even if that's something Unity should let you do.
     
  5. howler123

    howler123

    Joined:
    May 7, 2017
    Posts:
    17
    It is only happening when a Scriptable Object(SO) is visible in the Inspector. If I do not have a SO visible in Inspector, I do not have that issue.
     
    squigglebucket and LordVise like this.
  6. LordVise

    LordVise

    Joined:
    Aug 1, 2020
    Posts:
    7
    Yes, I get the same error when a gameobject's script containing an array of SO's is displayed in the inspector. I changed it to a List instead of an array and that seems to have solved the problem.