Author Topic: Exceptions during Unity Build  (Read 535 times)

Hello!

We are upgrading to Unity 2018.3.4f1, having problems with our builds, and it appears to be related to Substance's RenderStaticPreview() implementation. At first, it looks like there isn't a graceful fallback on unsupported texture formats, and an unchecked variable causing a subsequent NullReferenceException.
(Substance plugin version info: 2.2.1 (beta), Importer version 17, Build 65542.6.2.0 723471331, Build number 118, Plugin Commit 4232 build 905.)

This code is called as a side effect of loading prefabs from the AssetDatabase, which we do in our validation tests.

The somewhat cryptic exceptions lead to us removing the -nographics from our Unity command line, which made the problem go away (and makes sense why it couldn't create a texture). I don't think we need help fixing this further, but I'm including this here for possible error-handling UX improvement by Allegorithmic, and in case anyone also experiences this behavior and searches for what may be causing it.

Code: [Select]
[09:10:25][Step 2/3] RenderTexture creation failed. 'ARGBHalf' is not supported on this platform. Use 'SystemInfo.SupportsRenderTextureFormat' C# API to check format support.
[09:10:25][Step 2/3] UnityEngine.DebugLogHandler:Internal_Log()
[09:10:25][Step 2/3] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
[09:10:25][Step 2/3] UnityEngine.Logger:Log(LogType, Object, Object)
[09:10:25][Step 2/3] UnityEngine.Debug:LogError(Object, Object)
[09:10:25][Step 2/3] UnityEngine.Texture:ValidateFormat(RenderTextureFormat) (at C:\buildslave\unity\build\Runtime\Export\Texture.cs:347)
[09:10:25][Step 2/3] UnityEngine.RenderTexture:.ctor(Int32, Int32, Int32, RenderTextureFormat, RenderTextureReadWrite) (at C:\buildslave\unity\build\Runtime\Export\Texture.cs:152)
[09:10:25][Step 2/3] UnityEditor.PreviewRenderUtility:InitPreview(Rect) (at C:\buildslave\unity\build\Editor\Mono\Inspector\PreviewRenderUtility.cs:274)
[09:10:25][Step 2/3] UnityEditor.PreviewRenderUtility:BeginStaticPreview(Rect) (at C:\buildslave\unity\build\Editor\Mono\Inspector\PreviewRenderUtility.cs:242)
[09:10:25][Step 2/3] Substance.Editor.InspectorSubstanceGame:RenderStaticPreview(String, Object[], Int32, Int32)
[09:10:25][Step 2/3] UnityEditor.AssetPreviewUpdater:CreatePreviewForAsset(Object, Object[], String) (at C:\buildslave\unity\build\Editor\Mono\AssetPreviewUpdater.cs:33)
[09:10:25][Step 2/3] 
[09:10:25][Step 2/3] (Filename: C:/buildslave/unity/build/Runtime/Export/Texture.cs Line: 347)
[09:10:25][Step 2/3]
[09:10:25][Step 2/3] NullReferenceException
[09:10:25][Step 2/3]   at (wrapper managed-to-native) UnityEngine.Object.set_hideFlags(UnityEngine.Object,UnityEngine.HideFlags)
[09:10:25][Step 2/3]   at UnityEditor.PreviewRenderUtility.InitPreview (UnityEngine.Rect r) [0x0010a] in C:\buildslave\unity\build\Editor\Mono\Inspector\PreviewRenderUtility.cs:275
[09:10:25][Step 2/3]   at UnityEditor.PreviewRenderUtility.BeginStaticPreview (UnityEngine.Rect r) [0x00003] in C:\buildslave\unity\build\Editor\Mono\Inspector\PreviewRenderUtility.cs:242
[09:10:25][Step 2/3]   at Substance.Editor.InspectorSubstanceGame.RenderStaticPreview (System.String pAssetPath, UnityEngine.Object[] pSubAssets, System.Int32 pWidth, System.Int32 pHeight) [0x001e2] in <280dfb6e8e624332b6c5cd376e7bc4da>:0
[09:10:25][Step 2/3]   at UnityEditor.AssetPreviewUpdater.CreatePreviewForAsset (UnityEngine.Object obj, UnityEngine.Object[] subAssets, System.String assetPath) [0x00090] in C:\buildslave\unity\build\Editor\Mono\AssetPreviewUpdater.cs:33
[09:10:25][Step 2/3]