Author Topic: InvalidOperationException ... The object <X> was already added to to the context  (Read 22497 times)

I import a sbsar and I try to add an instance of the substance graph, so I press the + icon and then apply. The sbsar in Unity breaks (white icon) and I get this error message:

InvalidOperationException: The object Gas_Storm_normal was already added to the context.
UnityEditor.Experimental.AssetImporters.AssetImportContext.AddObjectToAsset (System.String identifier, UnityEngine.Object obj) (at C:/buildslave/unity/build/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs:37)
Substance.Editor.SubstanceImporter+<>c__DisplayClass49_0.<OnImportAsset>b__0 (UInt32 pOutputHash, Int32 pFormat, Int32 pChannelsOrder, Int32 pWidth, Int32 pHeight, Int32 pMipCount, IntPtr pPixels, Int32 pPixelLength)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Editor/Mono/AssetPipeline/ScriptedImporter.cs:19)
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceBase:DisplayRevertApplyGUI()
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Using Windows 10, Unity 2018.1.0f2 (64bit) (I am making assets for Unity hence not the latest 2018.x build).

I import a sbsar and I try to add an instance of the substance graph, so I press the + icon and then apply. The sbsar in Unity breaks (white icon) and I get this error message:

InvalidOperationException: The object Gas_Storm_normal was already added to the context.
UnityEditor.Experimental.AssetImporters.AssetImportContext.AddObjectToAsset (System.String identifier, UnityEngine.Object obj) (at C:/buildslave/unity/build/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs:37)
Substance.Editor.SubstanceImporter+<>c__DisplayClass49_0.<OnImportAsset>b__0 (UInt32 pOutputHash, Int32 pFormat, Int32 pChannelsOrder, Int32 pWidth, Int32 pHeight, Int32 pMipCount, IntPtr pPixels, Int32 pPixelLength)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Editor/Mono/AssetPipeline/ScriptedImporter.cs:19)
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceBase:DisplayRevertApplyGUI()
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Using Windows 10, Unity 2018.1.0f2 (64bit) (I am making assets for Unity hence not the latest 2018.x build).

Hi,

I'm sorry for this issue. I can't seem to repro this on my system. What do you have set for the scripting runtime version in your project?

Cheers,
Wes
Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja

I upgraded to 2018.3 to test some more and I also updated to your latest plugin as of what is available today.

When I import a .sbsar I get this Warning:
Code: [Select]
Identifier uniqueness violation: 'Gas_Storm - normal'. Scripted Importers do not guarantee that subsequent imports of this asset will properly re-link to these targets.
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The .sbsar then imports, but when I go to press the + icon  to create duplicate instances I get the following errors:

Code: [Select]
InvalidOperationException: The object Gas_Storm - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass61_0.<OnImportAsset>b__0 (UInt32 pOutputHash, Int32 pFormat, Int32 pChannelsOrder, Int32 pWidth, Int32 pHeight, Int32 pMipCount, IntPtr pPixels, Int32 pPixelLength)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

AssetImporter is referencing an asset from the previous import. This should not happen.
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


AssetImporter is referencing an asset from the previous import. This should not happen.
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Asset import failed, "Assets/Procedural Planets/Materials/Gas/Gas.sbsar" > InvalidOperationException: The object Gas_Storm - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass61_0.<OnImportAsset>b__0 (UInt32 pOutputHash, Int32 pFormat, Int32 pChannelsOrder, Int32 pWidth, Int32 pHeight, Int32 pMipCount, IntPtr pPixels, Int32 pPixelLength)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)
UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.AssetImporter:SaveAndReimport()
Substance.Editor.InspectorSubstanceBase:ApplyOrRevertChanges(Boolean)
Substance.Editor.InspectorSubstanceGame:OnInspectorGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Here's the .sbsar I try to import: https://www.dropbox.com/s/25929tpqdarvgye/Gas.sbsar?dl=0 - I have published it with the most recent version of Substance Designer.

After the error message above the substance no longer has a red substance icon or any children, but it's just a generic white icon and not recognized as a substance: https://www.dropbox.com/s/0ab8upaqq6pmlvj/brokensubstance.PNG

Update: I should also mention that that .sbsar has two normal maps that it generates, one with identifier "CapNormal" and the other one with identifier "BodyNormal".
Last Edit: January 18, 2019, 04:21:41 pm

Any news? Got the same Problem using Unity 2018.4.8 and Substance V2.3.4

Following error:


InvalidOperationException: The object August Wood Weave Floor Dirty - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass84_0.<OnImportAsset>b__0 (System.UInt32 pOutputHash, System.Int32 pFormat, System.Int32 pChannelsOrder, System.Int32 pWidth, System.Int32 pHeight, System.Int32 pMipCount, System.IntPtr pPixels, System.Int32 pPixelLength) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)



AssetImporter is referencing an asset from the previous import. This should not happen.


Asset import failed, "Assets/Materials_Textures/Substance/Wood/AugustWoodWeaveFloorDirty.sbsar" > InvalidOperationException: The object August Wood Weave Floor Dirty - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass84_0.<OnImportAsset>b__0 (System.UInt32 pOutputHash, System.Int32 pFormat, System.Int32 pChannelsOrder, System.Int32 pWidth, System.Int32 pHeight, System.Int32 pMipCount, System.IntPtr pPixels, System.Int32 pPixelLength) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)


Any news? Got the same Problem using Unity 2018.4.8 and Substance V2.3.4

Following error:


InvalidOperationException: The object August Wood Weave Floor Dirty - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass84_0.<OnImportAsset>b__0 (System.UInt32 pOutputHash, System.Int32 pFormat, System.Int32 pChannelsOrder, System.Int32 pWidth, System.Int32 pHeight, System.Int32 pMipCount, System.IntPtr pPixels, System.Int32 pPixelLength) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)



AssetImporter is referencing an asset from the previous import. This should not happen.


Asset import failed, "Assets/Materials_Textures/Substance/Wood/AugustWoodWeaveFloorDirty.sbsar" > InvalidOperationException: The object August Wood Weave Floor Dirty - normal was already added to the context.
Substance.Editor.SubstanceImporter+<>c__DisplayClass84_0.<OnImportAsset>b__0 (System.UInt32 pOutputHash, System.Int32 pFormat, System.Int32 pChannelsOrder, System.Int32 pWidth, System.Int32 pHeight, System.Int32 pMipCount, System.IntPtr pPixels, System.Int32 pPixelLength) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <a7d4cb2e5453412da1a2f203556c2c31>:0)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)



Hi,

This error looks to be caused from outputs using the same usage type. We are working on a fix for this issue. Can you send me the sbs file and I can confirm.

Cheers,
wes
Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja

Hi Wes,

here's the file you asked for. Hope this will help. If you need more info, let me know.

Cheers,

Holger