Change an object's import settings in the editor

I got a mesh that I need to change the settings for.
I found
But I can’t figure out how to use it.
What I want is to simply do something like:

Mesh mesh;
mesh.thisorthat = value;

from the editor.
The model importer seems perfect for that, but I can’t figure out how to assign a mesh to it.

It sounds like you might be interested in writing an editor script.

You could write a function that gets invoked by a menu item that could do what you want.

One easy way to do it would be to use the Selection object, which allows you to select an object in the project or hierarchy and perform operations on it.


MenuItem (with some nice example code):

Another way to reference an object from an editor script is to use the AssetDatabase or Resources classes.

AssetDatabase (allows you to load an asset based on its path among other things):

Resources (allows you to load assets from specific directories at runtime):

If you’re talking about changing settings when assets are imported, you might want to look at the AssetPostprocessor class, which lets you specify various functions to get executed whenever various types of assets get imported: