Example #1
0
    // Use this for initialization
    public static void Init(/*Object obj, */ SerializedProperty property, Type parentType)
    {
        // Get existing open window or if none, make a new one:
        ComponentSelectWindow window = (ComponentSelectWindow)EditorWindow.GetWindow(typeof(ComponentSelectWindow));

        window.Show();
        if (property == null /* || obj == null*/)
        {
            return;
        }
        window.refObject = property.serializedObject.targetObject;
        string propertyName = property.propertyPath;//KingUtil.GetOnlyName(property.name);

        window.propertyName = propertyName;
        //window.FInfo = t.GetField(propertyName);
        //window.PInfo = t.GetProperty(propertyName);

        if (parentType != null)
        {
            window.parentType = parentType;
        }
        else
        {
            window.parentType = Type.GetType(property.type);
        }
    }
Example #2
0
 /// <summary>
 /// Show menu to choose from. The pop-up menu sets the selected value and the selected property.
 /// </summary>
 /// <param name="property">Serialized property</param>
 virtual public void ShowMenu(SerializedProperty property)
 {
     ComponentSelectWindow.Init(property, ComponentSelectAttribute.className);
 }