現在UnityのML-Agentsで機械学習の勉強をしております。
もともと入っていたサンプル(3DBall)などは正常に動き、学習させることができたので、下記のサイトを参考に、自分で作成したゲームに対して学習させようとしました。
オブジェクトを作成するところまではできたのですが、空のオブジェクトに対してML-Agents>ScriptsのBrainを取り付けようとしたら以下のようなエラーが出ました。
Can't add script behaviour AssemblyInfo. The script needs to derive from MonoBehaviour!
このエラーで検索をかけたら、どうもファイル名とクラス名が違う場合に出るらしいのですが、確認したところ間違っておりません。
勉強し始めたばかりで、C#もよくわかってないため、どこに問題があるのか見当がつきません。
このようなエラーが出る場合は、どのようなことが考えられるでしょうか?
具体的な質問になっておらず、申し訳ありませんが、ご回答お願い致します。
Unityのバージョン:Unity 2018.3.5f1Personal
Python :3.6.8
参考ページ :https://qiita.com/God_KonaBanana/items/7aebdb411c99b059cc6f
ファイル名:Brain.cs
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5namespace MLAgents 6{ 7/// <summary> 8/// Brain receive data from Agents through calls to SendState. The brain then updates the 9/// actions of the agents at each FixedUpdate. 10/// The Brain encapsulates the decision making process. Every Agent must be assigned a Brain, 11/// but you can use the same Brain with more than one Agent. You can also create several 12/// Brains, attach each of the Brain to one or more than one Agent. 13/// Brain assets has several important properties that you can set using the Inspector window. 14/// These properties must be appropriate for the Agents using the Brain. For example, the 15/// Vector Observation Space Size property must match the length of the feature 16/// vector created by an Agent exactly. 17/// </summary> 18public abstract class Brain : ScriptableObject 19{ 20[SerializeField] public BrainParameters brainParameters; 21 22protected Dictionary<Agent, AgentInfo> agentInfos = 23new Dictionary<Agent, AgentInfo>(1024); 24 25protected Batcher brainBatcher; 26 27[System.NonSerialized] 28private bool _isInitialized; 29 30/// <summary> 31/// Sets the Batcher of the Brain. The brain will call the batcher at every step and give 32/// it the agent's data using SendBrainInfo at each DecideAction call. 33/// </summary> 34/// <param name="batcher"> The Batcher the brain will use for the current session</param> 35public void SetBatcher(Batcher batcher) 36{ 37if (batcher == null) 38{ 39brainBatcher = null; 40} 41else 42{ 43brainBatcher = batcher; 44brainBatcher.SubscribeBrain(name); 45} 46LazyInitialize(); 47} 48 49/// <summary> 50/// Adds the data of an agent to the current batch so it will be processed in DecideAction. 51/// </summary> 52/// <param name="agent"></param> 53/// <param name="info"></param> 54public void SendState(Agent agent, AgentInfo info) 55{ 56LazyInitialize(); 57agentInfos.Add(agent, info); 58 59} 60 61/// <summary> 62/// If the Brain is not initialized, it subscribes to the Academy's DecideAction Event and 63/// calls the Initialize method to be implemented by child classes. 64/// </summary> 65private void LazyInitialize() 66{ 67if (!_isInitialized) 68{ 69FindObjectOfType<Academy>().BrainDecideAction += BrainDecideAction; 70Initialize(); 71_isInitialized = true; 72} 73} 74 75/// <summary> 76/// Calls the DecideAction method that the concrete brain implements. 77/// </summary> 78private void BrainDecideAction() 79{ 80brainBatcher?.SendBrainInfo(name, agentInfos); 81DecideAction(); 82} 83 84/// <summary> 85/// Is called only once at the begening of the training or inference
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。