Unity 机器学习代理工具包 (ML-Agents) 是一个开源项目,它使游戏和模拟能够作为训练智能代理的环境。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

44 行
1.5 KiB

#if UNITY_CLOUD_BUILD
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using System.IO;
namespace MLAgents
{
public static class BuilderUtils
{
public static void SwitchAllLearningBrainToControlMode()
{
Debug.Log("The Switching to control mode function is triggered");
string[] scenePaths = Directory.GetFiles("Assets/ML-Agents/Examples/", "*.unity", SearchOption.AllDirectories);
foreach (string scenePath in scenePaths)
{
var curScene = EditorSceneManager.OpenScene(scenePath);
var aca = SceneAsset.FindObjectOfType<Academy>();
if (aca != null)
{
var learningBrains = aca.broadcastHub.broadcastingBrains.Where(
x => x != null && x is LearningBrain);
foreach (Brain brain in learningBrains)
{
if (!aca.broadcastHub.IsControlled(brain))
{
Debug.Log("Switched brain in scene " + scenePath);
aca.broadcastHub.SetControlled(brain, true);
}
}
EditorSceneManager.SaveScene(curScene);
}
else
{
Debug.Log("scene " + scenePath + " doesn't have a Academy in it");
}
}
}
}
}
#endif