Search Issue Tracker

Fixed in 2017.3.0f3

Fixed in 2017.1.X, 2017.2.X

Votes

0

Found in

2017.1.0f3

Issue ID

942563

Regression

No

Crash when certain variables of a new CustomRenderTexture are used in script

Graphics - General

-

Steps to reproduce:
1.Open attached 'CRTexture Crash.zip' Unity project
2.Open scene ’Test’
3.Enter Play mode

Reproduced in: 2017.3.0a4, 2017.2.0b8, 2017.1.0p4, 2017.1.0f3, 2017.1.0a1

Note #1: Could not test earlier versions because CustomRenderTexture class was introduced in 2017.1.
Note #2: Newly constructed CustomRenderTexture appears to be incomplete and missing certain variables in the Inspector window compared to a regular CustomRenderTexture created in the Editor (See CustomRenderTexture.png). Using those missing variables seems to be the cause of the crash.
Note #3: Crash happens in ScriptedCustumRenderTextureTest.cs script on line _tex.material = mat; regardless of the type of the material assigned
Note #4: Crash doesn't always reproduce on the first attempt and if it does not crash, opening the newly created CustomRenderTexture view by clicking on the 'Test' object in the Hierarchy and double-clicking on 'CustomTexture' in the attached script component in the Inspector tab yields multiple NullReferenceException errors:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.CustomRenderTextureEditor.OnEnable () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/CustomRenderTextureEditor.cs:219)

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:198)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7979)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7973)
UnityEditor.CustomRenderTextureEditor.DisplayMaterialGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/CustomRenderTextureEditor.cs:265)
UnityEditor.CustomRenderTextureEditor.DisplayCustomRenderTextureGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/CustomRenderTextureEditor.cs:402)
UnityEditor.CustomRenderTextureEditor.OnInspectorGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/CustomRenderTextureEditor.cs:419)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1243)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

----------------
Fixed in: 2017.3.0b1

Comments (2)

  1. merlet_g

    Jan 10, 2018 11:09

    A new object was responsible of this issue in my scene. Accidentally delete this object in play mode solved this issue for me. I don't know exactly why but this workaround now works everytime i encounter this issue.

  2. Laguna_Seca

    Nov 13, 2017 20:46

    2017.3

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.InspectorWindow.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:147)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    UnityEditor.HostView.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:168)
    UnityEditor.AssetDatabase:Refresh()
    GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:114)
    UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.