- Home /
 
 
               Question by 
               Cesar Augusto · Apr 26, 2015 at 08:53 PM · 
                editoriconcallback  
              
 
              Custom icons for files on Project Window
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<MyScript>(), 
     "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...

But when hit enter to confirm the script name, the image is gone

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.
 
                 
                screen-shot-2015-04-25-at-164504.png 
                (7.9 kB) 
               
 
                
                 
                screen-shot-2015-04-25-at-164457.png 
                (13.9 kB) 
               
 
              
               Comment
              
 
               
              Your answer