-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
Release v0.8.2
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#if UNITY_CLOUD_BUILD | ||
|
||
namespace MLAgents | ||
{ | ||
public static class Builder | ||
{ | ||
public static void PreExport() | ||
{ | ||
BuilderUtils.SwitchAllLearningBrainToControlMode(); | ||
} | ||
} | ||
} | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.