Beispiel #1
0
 public void TearDown()
 {
     if (storedConfigObject != null)
     {
         EditorBuildSettings.AddConfigObject(EditorBuildSettingsConfigKey, storedConfigObject, true);
         storedConfigObject = null;
     }
     MLAgentsSettingsManager.Destroy();
     ClearSettingsAssets();
 }
Beispiel #2
0
 public void SetUp()
 {
     if (EditorBuildSettings.TryGetConfigObject(EditorBuildSettingsConfigKey,
                                                out MLAgentsSettings settingsAsset))
     {
         if (settingsAsset != null)
         {
             storedConfigObject = settingsAsset;
             EditorBuildSettings.RemoveConfigObject(EditorBuildSettingsConfigKey);
         }
     }
     MLAgentsSettingsManager.Destroy();
     ClearSettingsAssets();
 }
Beispiel #3
0
        public void TestMLAgentsSettingsProviderLoadAsset()
        {
            var mockProvider           = new MockSettingsProvider();
            var tempSettingsAssetPath1 = tempSettingsRootPath + "/test.mlagents.settings.asset";

            mockProvider.CreateNewSettingsAsset(tempSettingsAssetPath1);
            MLAgentsSettingsManager.Settings.EditorPort = 8000; // change to something not default

            mockProvider.Instance?.Dispose();
            MLAgentsSettingsManager.Destroy();

            mockProvider.CreateMLAgentsSettingsProvider();
            Assert.AreEqual(8000, MLAgentsSettingsManager.Settings.EditorPort);
        }
Beispiel #4
0
        public void TestMLAgentsSettingsManager()
        {
            Assert.AreNotEqual(null, MLAgentsSettingsManager.Settings);
            Assert.AreEqual(5004, MLAgentsSettingsManager.Settings.EditorPort); // default port
            MLAgentsSettingsManager.Settings.EditorPort = 6000;
            Assert.AreEqual(6000, MLAgentsSettingsManager.Settings.EditorPort);

            var settingsObject = ScriptableObject.CreateInstance <MLAgentsSettings>();

            settingsObject.EditorPort = 7000;
            var tempSettingsAssetPath = tempSettingsRootPath + "/test.mlagents.settings.asset";

            AssetDatabase.CreateAsset(settingsObject, tempSettingsAssetPath);
            EditorBuildSettings.AddConfigObject(EditorBuildSettingsConfigKey, settingsObject, true);
            // destroy manager instantiated as a side effect by accessing MLAgentsSettings directly without manager
            MLAgentsSettingsManager.Destroy();
            Assert.AreEqual(7000, MLAgentsSettingsManager.Settings.EditorPort);
        }