Seanba / Tiled2Unity

Export Tiled Map Editor (TMX) files into Unity
Other
495 stars 120 forks source link

"The object you are trying to replace does not exist or is not a Prefab." #182

Closed Avalin closed 5 years ago

Avalin commented 5 years ago

I get this error when I use Tiled2Unity it in Unity version 2018.3.0b1

The object you are trying to replace does not exist or is not a Prefab. UnityEditor.PrefabUtility:ReplacePrefab(GameObject, Object, ReplacePrefabOptions) Tiled2Unity.ImportTiled2Unity:CreatePrefab(XElement, ImportBehaviour) (at Assets/Tiled2Unity/Scripts/Editor/ImportTiled2Unity.Prefab.cs:97) Tiled2Unity.ImportTiled2Unity:ImportAllPrefabs(ImportBehaviour) (at Assets/Tiled2Unity/Scripts/Editor/ImportTiled2Unity.Prefab.cs:47) Tiled2Unity.ImportTiled2Unity:MeshImported(String) (at Assets/Tiled2Unity/Scripts/Editor/ImportTiled2Unity.Mesh.cs:39) Tiled2Unity.TiledAssetPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Tiled2Unity/Scripts/Editor/TiledAssetPostProcessor.cs:98) UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])

Edit: My solution for now has been to downgrade. It works fine as of 2018.2.11f1 :)

Seanba commented 5 years ago

Hi Avalin, I would guess the was an earlier error with importing your map file that is stopping the new prefab from being created. If you send me your project as a Unity Package I can try to debug.

BTW, you may have better luck with SuperTiled2Unity - the new way of getting Tiled assets in Unity. Thanks.

Simnaan commented 5 years ago

I'm getting the same problem on Unity18.3.8f1 and I can't find a solution to this problem please help!!! I've tried using SuperTiled2Unity but I still can't import tiled maps into unity.

seanb-22ct commented 5 years ago

I'm not sure Tiled2Unity will still work with Unity 18.3.8f1. What issues are you having with SuperTiled2Unity?

Simnaan commented 5 years ago

I import all the files for the map and then it just loops back and tells me to add the files I just added in again

seanb-22ct commented 5 years ago

Hi again, @Simnaan. Are the relative paths for your TMX, TSX, and texture files still intact? I would guess the problem is that you copied the files into your Unity project, perhaps into the same folder, and that broke the relative paths?

You can send me your project (sean@seanba.com) and I can check that for you.

seanb-22ct commented 5 years ago

If you check the error that is being reporting it is telling you where it expects the files referenced by your TMX to exist. My bet is that you have them in the wrong location.

Try opening your imported TMX in Tiled. You should be getting similar errors there. Tiled will also give you the chance to "find" the files again (which changes the relative path). This is probably your fatest/best way to fix.