Unity3D icon indicating copy to clipboard operation
Unity3D copied to clipboard

NullReferenceException when the player window is resized

Open MatteoFantasy opened this issue 9 years ago • 3 comments

Hello ! I'm trying to have a Syphon and a window resize (by script or by hand) working together in (Unity 5.3 with openGL 2 and Syphon a17) and it crashes when launching a build of the program. When building in development mode and looking in the logs I get the following error :

Releasing render texture that is set as Camera.targetTexture! (Filename: /Users/builduser/buildslave/unity/build/Runtime/Camera/Camera.cpp Line: 2942)

and then multiple instances of this one :

NullReferenceException: Object reference not set to an instance of an object (Filename: /Users/anakin/code/AugmentaUnity/Assets/Plugins/Syphon/SyphonTexture-AdvancedUsers/SyphonServerTextureCustomResolution.cs Line: 134)

I managed to remove the second error by adding the following snippet in the Update method of my script, but that would be great if the Syphon plugin could handle it itself :

if(gameObject.GetComponent<Camera>().targetTexture == null){
    ResizeSyphonRenderTexture ();
}

Now my additional problem is that the player still crashes in the normal build mode, even without resizing the window, but it seems to be related to OpenGL2 (which I have to use or it doesn't work either, but the issue has been opened already).

Any thoughts ? Is it Syphon related or should I do something myself ? Thanks !

MatteoFantasy avatar Feb 03 '16 09:02 MatteoFantasy

Same here using Unity 5 and same config, any idea ?

Lyptik avatar Feb 05 '16 16:02 Lyptik

Do you have a crash log?

brianchasalow avatar Feb 05 '16 19:02 brianchasalow

Hi, I managed to narrow down the problem :

  • In "OpenGL Core" rendering mode, the Syphon output contains only random graphic card data. The output size is correct but the content is apparently never allocated/set. (issue #17)
  • In "OpenGL 2 (legacy)" rendering mode, starting the program with multiple displays plugged in provokes a crash. (issues n°742203 and n°742205 on the Unity3D issue tracker)

The only thing that's purely related to the window size change is the error I mentionned earlier :

NullReferenceException: Object reference not set to an instance of an object (Filename: /Users/anakin/code/AugmentaUnity/Assets/Plugins/Syphon/SyphonTexture-AdvancedUsers/SyphonServerTextureCustomResolution.cs Line: 134)

You'll find attached a log of the error (happens on both OpenGL versions). Syphon.log.zip Note that I managed to hotfix it with the forementioned piece of code.

MatteoFantasy avatar Feb 10 '16 15:02 MatteoFantasy