UnityEditor.IconSelector.SetMonoScriptIconChangedCallback C# (CSharp) Method

SetMonoScriptIconChangedCallback() static private method

static private SetMonoScriptIconChangedCallback ( MonoScriptIconChangedCallback callback ) : void
callback MonoScriptIconChangedCallback
return void
        internal static void SetMonoScriptIconChangedCallback(MonoScriptIconChangedCallback callback)
        {
            if (s_IconSelector != null)
            {
                s_IconSelector.m_MonoScriptIconChangedCallback = callback;
            }
            else
            {
                Debug.Log("ERROR: setting callback on hidden IconSelector");
            }
        }

Usage Example

 private void DrawListElement(Rect rect, bool even, AInfo ainfo)
 {
     if (ainfo == null)
     {
         Debug.LogError("DrawListElement: AInfo not valid!");
     }
     else
     {
         float num     = 17f;
         float a       = 0.3f;
         bool  changed = GUI.changed;
         bool  enabled = GUI.enabled;
         Color color   = GUI.color;
         GUI.changed = false;
         GUI.enabled = true;
         GUIStyle style = (!even) ? AnnotationWindow.m_Styles.listOddBg : AnnotationWindow.m_Styles.listEvenBg;
         GUI.Label(rect, GUIContent.Temp(""), style);
         Rect position = rect;
         position.width = rect.width - 64f - 22f;
         GUI.Label(position, ainfo.m_DisplayText, AnnotationWindow.m_Styles.listTextStyle);
         float   num2    = 16f;
         Rect    rect2   = new Rect(rect.width - 64f, rect.y + (rect.height - num2) * 0.5f, num2, num2);
         Texture texture = null;
         if (ainfo.m_ScriptClass != "")
         {
             texture = EditorGUIUtility.GetIconForObject(EditorGUIUtility.GetScript(ainfo.m_ScriptClass));
             Rect position2 = rect2;
             position2.x     += 18f;
             position2.y     += 1f;
             position2.width  = 1f;
             position2.height = 12f;
             if (!EditorGUIUtility.isProSkin)
             {
                 GUI.color = new Color(0f, 0f, 0f, 0.33f);
             }
             else
             {
                 GUI.color = new Color(1f, 1f, 1f, 0.13f);
             }
             GUI.DrawTexture(position2, EditorGUIUtility.whiteTexture, ScaleMode.StretchToFill);
             GUI.color = Color.white;
             Rect rect3 = rect2;
             rect3.x    += 18f;
             rect3.y     = rect3.y;
             rect3.width = 9f;
             if (GUI.Button(rect3, this.iconSelectContent, AnnotationWindow.m_Styles.iconDropDown))
             {
                 UnityEngine.Object script = EditorGUIUtility.GetScript(ainfo.m_ScriptClass);
                 if (script != null)
                 {
                     this.m_LastScriptThatHasShownTheIconSelector = ainfo.m_ScriptClass;
                     if (IconSelector.ShowAtPosition(script, rect3, true))
                     {
                         IconSelector.SetMonoScriptIconChangedCallback(new IconSelector.MonoScriptIconChangedCallback(this.MonoScriptIconChanged));
                         GUIUtility.ExitGUI();
                     }
                 }
             }
         }
         else if (ainfo.HasIcon())
         {
             texture = AssetPreview.GetMiniTypeThumbnailFromClassID(ainfo.m_ClassID);
         }
         if (texture != null)
         {
             if (!ainfo.m_IconEnabled)
             {
                 GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, a);
             }
             this.iconToggleContent.image = texture;
             if (GUI.Button(rect2, this.iconToggleContent, GUIStyle.none))
             {
                 ainfo.m_IconEnabled = !ainfo.m_IconEnabled;
                 this.SetIconState(ainfo);
             }
             GUI.color = color;
         }
         if (GUI.changed)
         {
             this.SetIconState(ainfo);
             GUI.changed = false;
         }
         GUI.enabled = true;
         GUI.color   = color;
         if (ainfo.HasGizmo())
         {
             string tooltip   = "Show/Hide Gizmo";
             Rect   position3 = new Rect(rect.width - 23f, rect.y + (rect.height - num) * 0.5f, num, num);
             ainfo.m_GizmoEnabled = GUI.Toggle(position3, ainfo.m_GizmoEnabled, new GUIContent("", tooltip), AnnotationWindow.m_Styles.toggle);
             if (GUI.changed)
             {
                 this.SetGizmoState(ainfo);
             }
         }
         GUI.enabled = enabled;
         GUI.changed = changed;
         GUI.color   = color;
     }
 }
All Usage Examples Of UnityEditor.IconSelector::SetMonoScriptIconChangedCallback