Class AIArchetypeTemplate
A complete, reusable AI brain in one asset: which states an NPC uses, how it picks abilities, and how it behaves in combat.
[CreateAssetMenu(fileName = "New AI Archetype", menuName = "FishMMO/Character/NPC/AI/Archetype", order = -10)]
public class AIArchetypeTemplate : ScriptableObject
- Inheritance
-
ObjectScriptableObjectAIArchetypeTemplate
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Assign one of these to Archetype and every other slot on the controller fills itself in at spawn. Wiring an NPC previously meant dragging eight state assets plus a personality, a rotation and a LOD asset onto every prefab by hand, and getting one of them wrong — a null attacking state, a retreat state on an archetype that never retreats — produced an NPC that silently did nothing.
Anything left null on the archetype leaves whatever the prefab already had, so a prefab can still override a single state without abandoning the archetype. Validate(List<string>) reports combinations that cannot work.
Fields
AbilityRotation
[Tooltip("Optional condition-driven ability rotation.")]
public AIAbilityRotation AbilityRotation
Field Value
AggressionDamageWeight
[Tooltip("Threat per 1 point of damage taken.")]
public float AggressionDamageWeight
Field Value
AggressionDecayRate
[Tooltip("Threat lost per second while no new events arrive.")]
public float AggressionDecayRate
Field Value
AggressionHealingWeight
[Tooltip("Threat per 1 point of healing witnessed on a combat participant.")]
public float AggressionHealingWeight
Field Value
AggressionHitBonus
[Tooltip("Flat threat added per hit, regardless of damage.")]
public float AggressionHitBonus
Field Value
AggressionStaleTimeout
[Tooltip("Seconds before a drained threat entry is forgotten.")]
public float AggressionStaleTimeout
Field Value
AggressionVarietyChance
[Range(0, 1)]
[Tooltip("Chance target selection picks the second-highest threat instead of the highest.")]
public float AggressionVarietyChance
Field Value
AttackingState
[Tooltip("Combat state. Required for the NPC to be able to fight at all.")]
public BaseAIState AttackingState
Field Value
AvoidancePriority
[Tooltip("NavMeshAgent avoidance priority.")]
public AgentAvoidancePriority AvoidancePriority
Field Value
BehaviorTree
[Tooltip("Optional high-level behavior tree evaluated above the state machine.")]
public AIBehaviorTree BehaviorTree
Field Value
DeadState
[Tooltip("Optional state entered on death.")]
public BaseAIState DeadState
Field Value
Description
[Header("Identity")]
[Tooltip("Human-readable description of this archetype. Editor only.")]
[TextArea(2, 5)]
public string Description
Field Value
EnemySweepRate
[Tooltip("How often (seconds) the NPC sweeps for nearby enemies while out of combat.")]
public float EnemySweepRate
Field Value
IdleState
[Tooltip("Passive standing-around state.")]
public BaseAIState IdleState
Field Value
InitialState
[Header("Core States")]
[Tooltip("State the NPC starts in when it spawns.")]
public BaseAIState InitialState
Field Value
LodSettings
[Header("Performance")]
[Tooltip("Optional distance-based update throttling.")]
public AILodSettings LodSettings
Field Value
OverrideThreatTuning
[Header("Threat")]
[Tooltip("Apply the threat tuning below. Off = keep the prefab's values.")]
public bool OverrideThreatTuning
Field Value
PatrolState
[Tooltip("Waypoint movement. Requires waypoints on the spawner.")]
public BaseAIState PatrolState
Field Value
Personality
[Header("Combat Tuning")]
[Tooltip("Combat personality: ability preferences, flee threshold, targeting mode.")]
public AICombatPersonality Personality
Field Value
RetreatState
[Tooltip("Flee state. Required for a personality with a retreat threshold to actually flee.")]
public BaseAIState RetreatState
Field Value
ReturnHomeState
[Tooltip("Leash return. Required for leashing to work.")]
public BaseAIState ReturnHomeState
Field Value
WanderState
[Header("Movement States")]
[Tooltip("Random movement around the home position.")]
public BaseAIState WanderState
Field Value
Methods
ApplyTo(AIController)
Copies every non-null field of this archetype onto a controller.
public void ApplyTo(AIController controller)
Parameters
controllerAIControllerThe controller to configure.
Remarks
Null fields are skipped rather than cleared so a prefab can override one slot while still using the archetype for the rest.
Validate(List<string>)
Checks this archetype for combinations that cannot behave as configured.
public bool Validate(List<string> problems)
Parameters
Returns
- bool
True when the archetype is internally consistent.
Remarks
Exists so the shipped archetype assets can be asserted in an EditMode test rather than discovered to be broken in play. Every problem returned is one that produces an NPC which compiles, spawns, and then quietly misbehaves.