Author Topic: After Unity crash substance breaks and is unusable until interaction.  (Read 7492 times)

Hey Peeps.

Im experiencing the most annoying  "Bug" ever. When unity crashes, this normally occurs when I'm switching between unity and another program, mainly safari because I'm constantly having to copy and paste my Facebook access token or when I'm writing code in mono. Then when i open Unity again and hit play or work on some code and then hit play. The procedural graph is stuck on generating and does not build. (IMAGE 1) What should happen is this a soft blur on the image (IMAGE 2)

Then when i hit stop and click on the graph this is the result (IMAGE 3). As you can see in the first image no errors show up but as soon as i hit stop and then click on the graph to see what is happening. the errors start running endlessly even though Unity is not in play mode. And the only way to fix it is to uncheck "Generate Mip Maps" or "Generate all outputs" in the "Inspector". (IMAGE 4)

here is the error stack trace:
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ProceduralMaterialInspector.GetInfoString () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/ProceduralMaterialInspector.cs:403)
UnityEditor.SubstanceImporterInspector.GetInfoString () (at /Users/builduser/buildslave/unity/build/Editor/Mono/ImportSettings/SubstanceImporterInspector.cs:307)
UnityEditor.ObjectPreview.DrawPreview (IPreviewable defaultPreview, Rect previewArea, UnityEngine.Object[] targets) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:230)
UnityEditor.Editor.DrawPreview (Rect previewArea) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:530)
UnityEditor.InspectorWindow.DrawPreviewAndLabels () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:761)
UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:388)
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)

So i though i would be cleaver and uncheck "OutPut Size" in the "Substance archive publish options" when i publish the graph and the result is worst. The graph also doesnt build and unchecking "Generate Mip Maps" or "Generate all outputs" in the "Inspector" does not fix it and THE GRAPH IS PERMANENTLY BROKEN

I am running OSX 10.11.6 (15G31) and Unity 5.3.5f1 and Substance Designer 5.4

So the number one thing about this is that it is just so freaking annoying. Any assistance would be appreciated.
Last Edit: July 30, 2016, 12:40:54 am

Hi Luke,

Thanks for the report. Could you please provide the used .sbsar (and if possible .sbs) file? I will try to reproduce this issue.

In the meantime, one thing that could help is, in play mode or build, to clone the ProceduralMaterial before doing anything (input changes, rebuild textures). You can do this by accessing a renderer's material property:

Code: [Select]
ProceduralMaterial materialInstance = GetComponent<Renderer>().material as ProceduralMaterial;
This should avoid extra work when leaving play mode (original ProceduralMaterial was not touched, so the changes don't have to be reverted).

Best,
Camille

Hi Luke,

Thanks for the report. Could you please provide the used .sbsar (and if possible .sbs) file? I will try to reproduce this issue.

In the meantime, one thing that could help is, in play mode or build, to clone the ProceduralMaterial before doing anything (input changes, rebuild textures). You can do this by accessing a renderer's material property:

Code: [Select]
ProceduralMaterial materialInstance = GetComponent<Renderer>().material as ProceduralMaterial;


This should avoid extra work when leaving play mode (original ProceduralMaterial was not touched, so the changes don't have to be reverted).

Best,
Camille

Hey thanks Camille.
I will definitely play around with your solution.
and i have attached the .sbsar for you.

Thanks for looking into this.

Couldnt find the original, have so many test files. so i quickly made it exactly like i am using it in unity. here is the .sbs

Thanks for the .sbs file. I fiddled with it while trying to make unity crash, but I could not enter the state you described.

I need more information on what could make Unity enter this state, and ideally a repro project.

Also, have you had a chance to try the workaround?

Best,
Camille

Yes i tried the work around but unfortunately it didn't fix the problem. i will try break it and send replicated "broken" file. I'm just currently busy rendering something that is going to take a couple of hours. i just thought i would get back to you in the mean time.

Hey there check what i found http://forum.unity3d.com/threads/substance-crashes-unity.376082/ they discuss the exact same bug but i cant comment on the page.

the problem has now gotten worse though, in unity 5.4.0f3 the iOS build is now effected and i get a missing reference exception. i literally wana pull my hair out at this point because i was about to upload my project to the app store :(

So now after i build for iOS the script reference break somehow, this can be seen in image1. Then when i click on the graph it is not appearing in the inspector, this can be seen in image2.

Do you have any idea how we can resolve this issue?

P.S. when my project broke, i deleted everything in it so that i can just give you a copy of the broken elements, but after deleting everything and just leaving the broken ones. then closing unity and then opening it again. and now the problem is gone. Man i don't know what to do.
Last Edit: September 13, 2016, 10:48:44 pm

Just a update: today i will be Troubleshooting this problem specifically. I will try to get as much information as possible. will update this thread as i make any progress.

Thanks for the .sbs file. I fiddled with it while trying to make unity crash, but I could not enter the state you described.

I need more information on what could make Unity enter this state, and ideally a repro project.

Also, have you had a chance to try the workaround?

Best,
Camille

Hey Camille

here is a unlisted video that you can see what my current problem is and how it is behaving.
https://youtu.be/UmsSEdsTCRc

Please let me know how we can move forward. Its not like i can downgrade because some fixes were required to move forward with 5.4

thank you for your time

P.S. I upgraded to unity 5.4 so do you think that maybe it has to do with the upgrade transfer. because it seems the error doesn't happen in a new project. if this is the case, i won't be able to rebuild it in a new project, thats just insane. or is this part of the job description?
Last Edit: September 14, 2016, 05:26:44 pm

Hey Luke,

I think I have successfully reproduced your issue on my side (Unity 5.4.1f1). If I am right this should happen every time you switch platform (including when building to iOS, which does this internally).

Try to reproduce your issue with the minimal repro project attached, and please report back to me if it is (or not) the issue you are experiencing.

Best,
Camille

Hey Camille

I've been trying to crash your project, but with no luck at all. If you are getting the endless "generating"  error on the shader, then yes you have achieved it. so weird that i can't reproduce it on my side.

Do you have any idea what is causing the generating error?

Hey Luke,

I have fixed the issue I encountered in this repro project; the fix is in flight and should land in 5.5 beta soon and 5.4 later.

However, if you cannot reproduce it on your side, then what I discovered may not be the exact same issue; I'll let you know when the fixes go public so you can test for yourself.

Best,
Camille

Hey Luke,

I have fixed the issue I encountered in this repro project; the fix is in flight and should land in 5.5 beta soon and 5.4 later.

However, if you cannot reproduce it on your side, then what I discovered may not be the exact same issue; I'll let you know when the fixes go public so you can test for yourself.

Best,
Camille

Thank you so much, i really hope it is the same thing.
Could please just clarify where the fix is going to take place? unity or substance designer?

thank you for your time

The fix is for Unity!

Best,
Camille

Will you post here when the fix is published? Just ran into this issue today and it caught me off guard. Glad I found this post to describe the situation.