I'm trying to code a custom importer for the SuperTiled2Unity plugin in Unity. This task is explained in the pugin documentation: here. My problem is that Unity don't seem to be aware that the plugin is installed which is weird because it works perfectly while the plugin import a tiled map. The problem occurs when a call the plugin in a script:
using SuperTiled2Unity;
using SuperTiled2Unity.Editor;
using UnityEngine;
/*
* Tells SuperTiled2Unity to used this importer by default
* */
[AutoCustomTmxImporter()]
public class MapImporter : CustomTmxImporter
{
public override void TmxAssetImported(TmxAssetImportedArgs args)
{
// Note: args.ImportedSuperMap is the root of the imported prefab
// You can modify the gameobjects and components any way you wish here
// Howerver, the results must be deterministic (i.e. the same prefab is created each time)
SuperMap map = args.ImportedSuperMap;
//Debug.LogFormat("Map '{0}' has been imported.", map.name);
// Find all tracks in our maps. These are edge colliders under the "Track" layer
EdgeCollider2D[] edgeCollider2Ds = map.GetComponentsInChildren<EdgeCollider2D>();
foreach (EdgeCollider2D collider in edgeCollider2Ds)
{
if (collider.gameObject.layer == LayerMask.NameToLayer("Block_Bullet"))
{
Rigidbody2D rb = collider.gameObject.AddComponent<Rigidbody2D>();
rb.isKinematic = true;
}
}
}
}
Then Unity gives me these compilation errors:
What is strange is that VisualStudio seems to know that SuperTiled2Unity exists and thus, doesn't throw any compilation error.
At this time, I already tried to:
- Re-import the SuperTiled2Unity plugin
- Put my class in a namespace
I am aware that this issue seems like this one but I don't know how to use this solution. If this is relevant, please explain me how to apply it.
I use the 1.9.3 version of SuperTiled2Unity whit Unity 2020.1.3f1.
EDIT:
I run the examples provided with the SuperTiled2Unity plugin on Github and the only difference I'm spotting is the assembly informations:
Could it be the cause of my problem ? If so, how to solve it ?