public void SaveEntity(Entity entity) { var entityData = entity.GetEntityData(); EditorOption option = Instantiate(_entityOptionPrefab, _entitiesScrollView.content); var metadata = option.gameObject.AddComponent <PrefabMetaData>(); metadata.entityData = entityData; option.Setup(entityData.entityType, _prefabPanelType); option.panelType = _prefabPanelType; _editorOptions.Add(option); }
void Start() { foreach (var panelType in _editorPanelTypes) { foreach (var option in panelType._entityOptionTypes) { EditorOption e = Instantiate(_entityOptionPrefab, _entitiesScrollView.content); e.Setup(option, panelType); _editorOptions.Add(e); } EditorPanelButton button = Instantiate(_editorPanelButton, _buttonRoot); button.Setup(panelType._panelName); button.Bind(new UnityEngine.Events.UnityAction(() => SwitchPanelToType(panelType))); } SwitchPanelToType(_editorPanelTypes[0]); }