How can i set a custom icons for non c# scripts to project window? I have a interesting experience writting Python and F# in Unity, and i build some custom editor to add new files.
i have this code.
[MenuItem("Assets/Create/F# Script")]
public static void CreateFile() {
var icon = Resources.LoadAssetAtPath("Assets/Resources/FSharpIcon.png", typeof(Texture2D)) as Texture2D;
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance(),
"NewFSharpFile.fs", icon, "");
//....
//IO stuff to create the file.
ProjectWindowUtil.ShowCreatedAsset(file)
}
Seems to work fine when add the file and while i type on it...
![alt text][1]
But when hit enter to confirm the script name, the image is gone
![alt text][2]
there is a way to persist the icon file on project window?
Also i haven't found a documentation about ProjectWindowUtil from package UnityEditor.ProjectWindowCallback, i have no idea what it actually does.
[1]: /storage/temp/45236-screen-shot-2015-04-25-at-164457.png
[2]: /storage/temp/45237-screen-shot-2015-04-25-at-164504.png
↧