SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

CustomProperties creating duplicate objects and not applying properties

Open MichaelvanDiest opened this issue 1 year ago • 6 comments

Hello, I'm currently attempting to use the Custom Properties feature of SuperTiled2Unity and running into the following error: Identifier uniqueness violation: 'Name:_MapPrfab/Headquarters/Grid/Objects/Object_7 (TRS), Type:GameObject'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

This error only appears when I place an object in my Tiled map with a custom property. I've followed the steps on the "Custom Properties Support" doc page.

When I open the level prefab in Unity, I can see that the importer has duplicated the objects, one is a Super Object with the Super Custom Properties component. And the other being the prefab replacement. However the custom property is not set on the prefab replacement. Here is a screenshot of it: image

I do have the Object Types Xml set in the SuperTiled2Unity settings with the custom properties and everything seems to appear exactly as the "Custom Properties Support" documentation page. Here is a screenshot of my objecttypesxml with the custom properties shown: image

Below is the full error:

Stack Trace:
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <dc753a1061284f8e971ee88ee4826eee>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <dc753a1061284f8e971ee88ee4826eee>:0 
  at SuperTiled2Unity.Editor.GameObjectExtensions.BroadcastProperty (UnityEngine.GameObject go, SuperTiled2Unity.CustomProperty property, System.Collections.Generic.Dictionary`2[TKey,TValue] objectsById) [0x00141] in .\Packages\super-tiled2unity.v2.1.1\Editor\Extensions\GameObjectExtensions.cs:179 
  at SuperTiled2Unity.Editor.TmxAssetImporter.DoPrefabReplacements () [0x00186] in .\Packages\super-tiled2unity.v2.1.1\Editor\Importers\TmxAssetImporter.cs:438 
  at SuperTiled2Unity.Editor.TmxAssetImporter.InternalOnImportAsset () [0x000af] in .\Packages\super-tiled2unity.v2.1.1\Editor\Importers\TmxAssetImporter.cs:76 
  at SuperTiled2Unity.Editor.SuperImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x00065] in .\Packages\super-tiled2unity.v2.1.1\Editor\Importers\SuperImporter.cs:71 
0x00007ff633d95cfd (Unity) StackWalker::GetCurrentCallstack
0x00007ff633d9adc9 (Unity) StackWalker::ShowCallstack
0x00007ff634d73ad1 (Unity) GetStacktrace
0x00007ff63542bc4e (Unity) DebugStringToFile
0x00007ff632d24e98 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000001b775acf93a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000001b775adfe6b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000001b775adf6ac (Mono JIT Code) UnityEngine.Logger:LogFormat (UnityEngine.LogType,string,object[])
0x000001b775adf3fb (Mono JIT Code) UnityEngine.Debug:LogErrorFormat (string,object[])
0x000001b7759d924b (Mono JIT Code) SuperTiled2Unity.Editor.SuperImporter:OnImportAsset (UnityEditor.AssetImporters.AssetImportContext) (at ./Packages/super-tiled2unity.v2.1.1/Editor/Importers/SuperImporter.cs:92)
0x000001b7759d88e5 (Mono JIT Code) UnityEditor.AssetImporters.ScriptedImporter:GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext)
0x000001b6951d551e (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___object (object,intptr,intptr,intptr)
0x00007ff908a44bfe (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff90897d254 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068)
0x00007ff90897d3cc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115)
0x00007ff633caf514 (Unity) scripting_method_invoke
0x00007ff633c8d274 (Unity) ScriptingInvocation::Invoke
0x00007ff63519d514 (Unity) ScriptedImporter::GenerateAssetData
0x00007ff63508c86b (Unity) ImportToObjects
0x00007ff63508b91c (Unity) ImportAsset
0x00007ff6350b07d8 (Unity) AssetImportWorker::Import
0x00007ff6350e18eb (Unity) AssetImportManager::ImportInProcess
0x00007ff6350decfa (Unity) AssetImportManager::Import
0x00007ff6350e21e1 (Unity) ImportOutOfDateAssets
0x00007ff6350ec48c (Unity) RefreshInternalV2
0x00007ff6350f3dcc (Unity) StopAssetImportingV2Internal
0x00007ff6350ed7cc (Unity) RefreshV2
0x00007ff635063140 (Unity) AssetDatabase::Refresh
0x00007ff6348e8c6b (Unity) Application::AutoRefresh
0x00007ff634d9c0f3 (Unity) ContainerWindow::ContainerWndProc
0x00007ff97dc1ef5c (USER32) CallWindowProcW
0x00007ff97dc1e8cc (USER32) DispatchMessageW
0x00007ff97dc31633 (USER32) SendMessageTimeoutW
0x00007ff97e8313e4 (ntdll) KiUserCallbackDispatcher
0x00007ff97c461064 (win32u) NtUserPeekMessage
0x00007ff97dc1a333 (USER32) PeekMessageW
0x00007ff97dc1a293 (USER32) PeekMessageW
0x00007ff634d7931d (Unity) MainMessageLoop
0x00007ff634d7e650 (Unity) WinMain
0x00007ff63615e0ae (Unity) __scrt_common_main_seh
0x00007ff97d917344 (KERNEL32) BaseThreadInitThunk
0x00007ff97e7dcc91 (ntdll) RtlUserThreadStart

MichaelvanDiest avatar Jul 08 '24 03:07 MichaelvanDiest