I'm Unity tools developper and i want to create an event when the user import a .FBX file
My code :
using System.IO;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
[CustomEditor(typeof(EmptinessImporter))]
[CanEditMultipleObjects]
public class EmptinessImporterEditor : ScriptedImporterEditor
{
//Let the parent class know that the Apply/Revert mechanism is skipped.
protected override bool needsApplyRevert => false;
public override void OnInspectorGUI()
{
// Draw some information
EditorGUILayout.HelpBox("Because this Importer doesn't have any settings, the Apply/Revert buttons are hidden.", MessageType.None);
}
}
[ScriptedImporter(0, ".fbx")]
public class EmptinessImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
Debug.Log(ctx.assetPath);
}
}
Error :
Scripted importers EmptinessImporter and EmptinessImporter are targeting the fbx extension, rejecting both. UnityEditor.Experimental.AssetImporters.ScriptedImporter:RegisterScriptedImporters()
But that doesn't work, I'm working on Unity 2019.4.9f1
CodePudding user response:
Sounds like you have two concurrent implementations with the same name and both targeting fbx
.
However, if you anynway do not really want to specifically handle the import but rather just react with an event once a specific import has happened you might rather want to implement an