浏览代码

Removing virus (#2680)

/develop-gpu-test
GitHub 5 年前
当前提交
860880d6
共有 4 个文件被更改,包括 0 次插入64 次删除
  1. 14
      UnitySDK/Assets/ML-Agents/Editor/Builder.cs
  2. 3
      UnitySDK/Assets/ML-Agents/Editor/Builder.cs.meta
  3. 44
      UnitySDK/Assets/ML-Agents/Editor/BuilderUtils.cs
  4. 3
      UnitySDK/Assets/ML-Agents/Editor/BuilderUtils.cs.meta

14
UnitySDK/Assets/ML-Agents/Editor/Builder.cs


#if UNITY_CLOUD_BUILD
namespace MLAgents
{
public static class Builder
{
public static void PreExport()
{
BuilderUtils.SwitchAllLearningBrainToControlMode();
}
}
}
#endif

3
UnitySDK/Assets/ML-Agents/Editor/Builder.cs.meta


fileFormatVersion: 2
guid: 41ad366a346f4fbdaeb7dc8fff9a5025
timeCreated: 1555622970

44
UnitySDK/Assets/ML-Agents/Editor/BuilderUtils.cs


#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

3
UnitySDK/Assets/ML-Agents/Editor/BuilderUtils.cs.meta


fileFormatVersion: 2
guid: 08deb8536161410982b88716adb02f69
timeCreated: 1555623012
正在加载...
取消
保存