/// <summary> /// Called when we have an entity to inspect. /// </summary> private void DrawInspector(IQueryableEntity entity, GameObject context) { _inspectorScroll = EditorGUILayout.BeginScrollView(_inspectorScroll); EditorGUILayout.LabelField("Metadata", ForgeEditorUtils.HeaderStyle); entity.PrettyName = EditorGUILayout.TextField("Pretty Name", entity.PrettyName); if (GUI.changed) { BaseContainer container = context.GetComponent<BaseContainer>(); container.UpdateName(); } ForgeEditorUtils.DrawSeperator(); foreach (DataAccessor accessor in entity.SelectData(/*includeRemoved:*/ true)) { Type dataType = entity.Current(accessor).GetType(); _dataInspectorView.DrawDataInspector(entity, dataType, context); ForgeEditorUtils.DrawSeperator(); } DrawAddData(entity); EditorGUILayout.EndScrollView(); }
/// <summary> /// Initializes renderers for any data that is currently contained within the given entity. /// </summary> /// <param name="containingObject">The GameObject that contains the BaseContainer for the /// entity.</param> /// <param name="entity">The entity to select data from.</param> protected static void InitializeRenderers(GameObject containingObject, IQueryableEntity entity) { ICollection<DataAccessor> entityData = entity.SelectData(); foreach (DataAccessor accessor in entityData) { DataRegistry.TryAddRenderer(accessor, containingObject, entity); } }