CollectDiscreteActionMasks Problem

In my game, I have implemented CollectDiscreteActionMasks function, but I don’t think it is being called. For testing purposes, I have put Debug.Log() at the beginning of the function but there is no output. How does it work? Does adding the CollectDiscreteActionMasks to an agent’s code make it called automatically?

In general, yes. Can you please post your code? Did you set Academy.Instance.AutomaticSteppingEnabled = false; by chance?

Also, make sure that you Agent’s action space is set to Discrete. Masking has no effect for continuous actions, so CollectDiscreteActionMasks isn’t called then.