예제 #1
0
        private void HandleOnItemSelected(int index, SerializedProperty list)
        {
            if (isSelectable)
            {
                inlineClassRenderer = null;

                SerializedProperty propertyToRender = list.GetArrayElementAtIndex(index);
                if (propertyToRender.propertyType == SerializedPropertyType.ObjectReference || propertyToRender.propertyType == SerializedPropertyType.Generic)
                {
                    object listElement = FieldInfoHelper.GetObjectFromPath(propertyToRender.propertyPath, serializedObject.targetObject);

                    if (listElement != null)
                    {
                        EntityInfo info = new EntityInfo(listElement.GetType(),
                                                         serializedObject, propertyToRender.propertyPath);
                        inlineClassRenderer = InspectorItemRenderer.CreateRenderer <InlineClassRenderer>();
                        inlineClassRenderer.InitializeFromEntityInfo(info);

                        if (propertyToRender.propertyType == SerializedPropertyType.Generic)
                        {
                            inlineClassRenderer.FoldoutTitle = propertyToRender.displayName;
                        }
                    }
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Called when the editor script is enable, usually when it is going to be displayed in the inspector.
 /// </summary>
 public void OnEnable()
 {
     scriptObjectRenderer = (ScriptObjectRenderer)InspectorItemRenderer.CreateRenderer(typeof(ScriptObjectRenderer));
     scriptObjectRenderer.Initialize(this.serializedObject, this);
 }