So I trained the AI with accordingly to the “Making a New Learning Environment” guide and now when I created a new prefab with the same parameters like training model and Instantiate it on the new scene using the classical unity way. My Unity freezes for 1-2 s, cannot find the reason becasue the profiler only notices 215 ms freeze not the longer one.
In attachment I give you the sample code where the freeze appear and the prefab what is instantiating. In my
NetworkRollerAgent script I only taking the rigidbody components and the overriden methods like are CollectObservations, OnActionReceived and OnEpisodeBegin are not taking any action when the target (player is null) so it should be sth intrinsic of BehaviourParameters in ml-agents. Im using the Unity 2023.1.2f1 and ML Agents 2.0.1
EDIT!: I noticed that the problem is in a OnEnabled method of Agent.cs class but dont have an access to modify or debug it.
Im alos upload this behaviour on youtube so check out:
.