@@ -8,6 +8,10 @@ namespace EasyCS
88{
99 [ DisallowMultipleComponent ]
1010 [ SelectionBase ]
11+ [ IconClass ( ConstantsIcons . IconActor ) ]
12+ #if ODIN_INSPECTOR
13+ [ HideMonoScript ]
14+ #endif
1115 public class Actor : EasyCSBehavior , IHasEntity
1216 {
1317 public enum EntityComponentSetupPolicy
@@ -17,7 +21,6 @@ public enum EntityComponentSetupPolicy
1721 OverrideFromActor ,
1822 SetAsInActor
1923 }
20-
2124 [ SerializeField , ReadOnly ]
2225 private EntityProvider _entityProvider ;
2326
@@ -83,9 +86,6 @@ public Actor Root
8386 private Dictionary < Type , ActorComponent > _actorComponents = new Dictionary < Type , ActorComponent > ( ) ;
8487 private readonly Dictionary < Type , object > _actorComponentsAndData = new ( ) ;
8588
86- [ field: SerializeField ]
87- public EntityTemplateAsset EntityTemplate { get ; private set ; }
88-
8989 [ SerializeField , ReadOnly ]
9090 private List < ActorComponent > _allComponents = new List < ActorComponent > ( ) ;
9191
@@ -569,7 +569,6 @@ int GetPriority(Component c)
569569 foreach ( var component in _allComponents )
570570 component . SetActor ( this ) ;
571571
572- EditorApplyEntityTemplate ( ) ;
573572 EditorValidateAllComponentDependencies ( ) ;
574573 ValidateSetup ( ) ;
575574 EditorUpdateUnusedDependencies ( ) ;
@@ -689,44 +688,7 @@ private void EditorValidateActorComponentsDependencies()
689688 EditorUpdateMissingActorDependenciesList ( ) ;
690689 }
691690
692- private void EditorApplyEntityTemplate ( )
693- {
694- if ( EntityTemplate == null )
695- return ;
696-
697- var componentTypes = EntityTemplate . GetComponentTypes ( ) ;
698-
699- List < Type > providersToAdd = new List < Type > ( ) ;
700-
701- foreach ( var type in componentTypes )
702- {
703- Type providerType = EntityComponentProviderFinder . FindEntityComponentProviderMatching ( type ) ;
704-
705- if ( providerType != null )
706- {
707- if ( _allComponents . Exists ( c => c . GetType ( ) == providerType ) )
708- continue ;
709- if ( _entityComponentsMissing . Exists ( c => c . GetType ( ) == type ) )
710- continue ;
711-
712- providersToAdd . Add ( providerType ) ;
713- }
714- }
715-
716- if ( providersToAdd . Count > 0 )
717- {
718- UnityEditor . EditorApplication . delayCall += ( ) =>
719- {
720- if ( this == null ) return ;
721-
722- foreach ( var provider in providersToAdd )
723- if ( gameObject . GetComponent ( provider ) == null )
724- UnityEditor . Undo . AddComponent ( gameObject , provider ) ;
725-
726- UnityEditor . EditorUtility . SetDirty ( gameObject ) ;
727- } ;
728- }
729- }
691+
730692
731693 public List < string > EditorGetMissingDependenciesNamesForAllComponents ( EditorDependenciesType dependenciesType )
732694 {
@@ -877,11 +839,8 @@ public List<ActorComponent> EditorGetUnusedActorComponentsForComponent(ActorComp
877839
878840 public bool EditorHasUnusedDependencies ( ) => _editorUnusedDependencies . Count > 0 ;
879841
880- public void EditorSetEntityTemplate ( EntityTemplateAsset entityTemplateAsset )
881- {
882- EntityTemplate = entityTemplateAsset ;
883- EditorApplyEntityTemplate ( ) ;
884- }
842+ public List < ActorComponent > EditorGetAllComponentsSerialized ( ) => _allComponents ;
843+ public List < IEntityComponent > EditorGetEntityComponentsMissingSerialized ( ) => _entityComponentsMissing ;
885844#endif
886845 }
887846}
0 commit comments