ApexGameTools/Apex-Game-Tools

NullReferenceException

sergeychemodanov opened this issue · 0 comments

Hello, I tried to create a bot trough the code, but I get an exception.

var contextProvider = gameObject.AddComponent<BotContextProvider>();
var utilityAIComponent = gameObject.AddComponent<UtilityAIComponent>();
utility.AddClient(AINameMap.DefaultBot, contextProvider);
NullReferenceException: Object reference not set to an instance of an object
Apex.AI.Components.UtilityAIComponent.AddClient (System.Guid aiId, Apex.AI.Components.IContextProvider contextProvider, System.Single intervalMin, System.Single intervalMax, System.Single startDelayMin, System.Single startDelayMax) (at c:/Development/Apex Applications/ApexGameTools/Source/ApexAI/ApexAI/Components/UtilityAIComponent.cs:159)
Apex.AI.Components.UtilityAIComponent.AddClient (System.Guid aiId, Apex.AI.Components.IContextProvider contextProvider) (at c:/Development/Apex Applications/ApexGameTools/Source/ApexAI/ApexAI/Components/UtilityAIComponent.cs:127)

But if I add the same components in the editor, then everything works.