Skip to content

AI Component

Dizy edited this page Apr 16, 2020 · 20 revisions

The AI Component allow you to transfer contextual information to your Data and Action nodes. Moreover it allow you to parameter your AI using the inspector.

To create your own AIComponent you have to inherit from AbstractAIComponent

    public class CubeAIComponent : AbstractAIComponent {
        
        // External References
        public CubeEntity CubeEntity;

        private void Awake() {
            CubeEntity = GetComponent<CubeEntity>();
        }
        
    }

Add the component to any GameObject (prefab or in scene) associated to this AI (an enemy for exemple).

You can customize the time in second between refresh of the AI brain, the shorter is the most resource intensive.

Using the toggle "Always pick the best choice" remove the randomness of the option and can lead to a more predictive AI but easier to design.

Finally, add your AI Brain to the Utility Ai Brain of your Ai Component.

As you can see, the graph reference is contained in a List of AIBrain, allowing you to use parallel brains for parallel tasks (like using the turret of a tank and driving the same tank in 2 separate brain)

Clone this wiki locally