ScriptedImporter status

Unfortunately, Unity restricts possible file extensions for text assets. It doesn’t support custom file extensions (for example: .lua, .nut, .yacc, any user defined file format for any possible needs). Using extension .txt for everything is inconvenient (it’s a mess; also correct extension is required for code highlighting in most IDEs).

Fortunately, Unity provides elegant solution: ScriptedImporter.
So I use ScriptedImporter to import custom text files as ScriptableObjects.

The problem is: in Unity 2019.2, ScriptedImporter is defined in the namespace UnityEditor.Experimental.AssetImporters.
It compiles fine in the Editor environment, but, of course, throws error, when building a project:

error CS0234: The type or namespace name ‘AssetImporters’ does not exist in the namespace ‘UnityEditor.Experimental’ (are you missing an assembly reference?)

Question is: what is the status of ScriptedImporter? When it will be available for building in real projects? Or Unity will add support for custom file extensions as text assets?
It’s such a basic feature.

Thanks in advance!

I think your issue is: using Editor script inside non editor one

If it is then just move your custom importer to editor script

1 Like

Yes, #if UNITY_EDITOR solved it. Thanks.