Changing VectorAction SpaceSize on BehaviorParameters component seems to have no effect.

I tried modifying it but no matter what the value in the inspector is, the array passed to the OnActionReceived method on the Agent is always 2. I’m not sure if it’s a bug or me misunderstanding something. It’s the only Agent in the scene.

So, after some debugging here is what the issue was and how to reproduce it.

Consider an Agent with BehaviorType set to Default or Heuristic Only on its BehaviorParameters. Let’s say it’s space size is 3. If your heuristic doesn’t set all three values of the array and instead, say, 2 first elements, the array will be resized under the hood somewhere on the way between Heuristic and OnActionReceived.

A heuristic like this:

    public override float[] Heuristic()
    {
        var action = new float[3];
        action[0] = Input.GetAxis("Horizontal");
        action[1] = Input.GetAxis("Vertical");
        return action;
    }

will produce crashes even tho it’s size of the array is clearly correct. It gets resized to an array with Length 2. To prevent these errors one needs to actually set all elements, like so:

    public override float[] Heuristic()
    {
        var action = new float[3];
        action[0] = Input.GetAxis("Horizontal");
        action[1] = Input.GetAxis("Vertical");
        action[2] = 0.0f;
        return action;
    }

I think it’s very counterintuitive. I wasn’t able to find what exactly in the library resized it but I think it counts as a bug. Or is it the intended behavior? If it is, I really think it should be documented clearly.

Because it’s causing the editor to crash, can you file a bug report so we can look into this further?

What is the crash message?