This occurred under Unity 2018.2.14 using Plugin 2.1.
The attached crash report shows it occurring at:
Substance.Engine.dll caused an Access Violation (0xc0000005)
in module Substance.Engine.dll at 0033:558d24e8.
The line of code in my project it's apparently complaining about is:
DecalGraph.SetInputString("Text", Text);
This is being called in OnValidate in the Editor. However, the same crash occurs if I call this via a simple Inspector button after having previously just modified and Apply'd the SBSAR.
It doesn't seem to matter what input I set. This is the stack trace when I try to set a Float instead:
C++ Error in InsertNumericValuesIntoArray(), invalid Substance input identifier: 'Font_Size'!
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Substance.Game.NativeCallbacks:csharpLogCallback(Int32, String)
System.Object:wrapper_native_00007FF8558D4F10(IntPtr, String, Single[], UInt32)
System.Reflection.MonoMethod:InternalInvoke(MonoMethod, Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
System.Delegate:DynamicInvokeImpl(Object[])
System.MulticastDelegate:DynamicInvokeImpl(Object[])
System.Delegate:DynamicInvoke(Object[])
Substance.Game.NativeFunctionsShared:cppSetInput_Float(IntPtr, String, Single[], UInt32)
Substance.Game.NativeFunctions:cppSetInput_Float(IntPtr, String, Single[], UInt32)
Substance.Game.SubstanceGraph:SetInputFloat(String, Single)
GraviaSoftware.Gravia.Code.Controllers.Decals.StaticDecalTextController:RefreshTextures() (at Assets\Code\Controllers\Decals\StaticDecalTextController.cs:64)
GraviaSoftware.Gravia.Code.Editor.StaticDecalTextControllerEditor:OnInspectorGUI() (at Assets\Code\Editor\StaticDecalTextControllerEditor.cs:16)
Even though it claims it is complaining about a property "Font_Size", that property definitely exists in my Graph, and this method work properly as long as I haven't just Apply'd the graph in the inspector.
More on this. Here's some code I'm calling in a script to display the properties of the graph:
var sb = new StringBuilder();
foreach (var prop in myGraph.GetInputProperties())
{
sb.AppendLine($"Prop: {prop.name} - {prop.type}");
}
Debug.Log($"Properties: {sb.ToString()}");
If I open Unity fresh, and call this method via a button in the Inpsector, I get the full list of all properties of the graph. If I then edit the graph and press Apply, then call this again, I get an empty list.
So what's going on when pressing Apply that causes so many values to be missing? The only way I can "Fix" the graph is to enter Play mode and then exit. Then I can iterate over the list of graph properties again. Even then, some of the time, when doing that, I get this error in my console:
OutOfMemoryException: Out of memory
at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_array_new_specific(intptr,int)
at Substance.Game.NativeTypes.GetNativeInputs (Substance.Game.SubstanceGraph graph, System.Int32 pNumInputs) [0x00000] in <a7f324179b874bf6be743a4296b96d4e>:0
at Substance.Game.SubstanceGraph.GetInputProperties () [0x0000c] in <a7f324179b874bf6be743a4296b96d4e>:0
at GraviaSoftware.Gravia.Code.Controllers.Decals.StaticDecalTextController.RefreshTextures () [0x0000e] in C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Decals\StaticDecalTextController.cs:61
at GraviaSoftware.Gravia.Code.Editor.StaticDecalTextControllerEditor.OnInspectorGUI () [0x0002d] in C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Editor\StaticDecalTextControllerEditor.cs:16