Aimbot-ParallelEnv/Assets/Script/GameScript/SideChannel/AimBotSideChannelController.cs
2023-10-15 02:16:43 +09:00

36 lines
1.1 KiB
C#

using Unity.MLAgents;
using Unity.MLAgents.SideChannels;
using UnityEngine;
public class AimBotSideChannelController : MonoBehaviour
{
public AimbotSideChannel aimbotSideChannel;
public void Awake()
{
// We create the Side Channel
aimbotSideChannel = new AimbotSideChannel();
// When a Debug.Log message is created, we send it to the stringChannel
Application.logMessageReceived += aimbotSideChannel.SendDebugStatementToPython;
// The channel must be registered with the SideChannelManager class
SideChannelManager.RegisterSideChannel(aimbotSideChannel);
}
// Side Channel
public void OnDestroy()
{
// De-register the Debug.Log callback
Application.logMessageReceived -= aimbotSideChannel.SendDebugStatementToPython;
if (Academy.IsInitialized)
{
SideChannelManager.UnregisterSideChannel(aimbotSideChannel);
}
}
public void SendSideChannelMessage(string MessageType, string message)
{
Debug.LogWarning(MessageType + "|" + message);
}
}