/// Monobehavior function that is called when the attached GameObject /// becomes disabled or inactive. void OnDisable() { Academy academy = Object.FindObjectOfType <Academy>() as Academy; if (academy != null) { academy.AgentSetStatus -= SetStatus; academy.AgentResetIfDone -= ResetIfDone; academy.AgentSendState -= SendInfo; academy.AgentAct -= AgentStep; academy.AgentForceReset -= _AgentReset; } }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { var textureCount = agentParameters.agentCameras.Count + agentParameters.agentRenderTextures.Count; textureArray = new Texture2D[textureCount]; for (int i = 0; i < textureCount; i++) { textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false); } id = gameObject.GetInstanceID(); Academy academy = Object.FindObjectOfType <Academy>() as Academy; OnEnableHelper(academy); recorder = GetComponent <DemonstrationRecorder>(); }