- Learn Unity ML-Agents:Fundamentals of Unity Machine Learning
- Micheal Lanham
- 398字
- 2021-08-13 15:58:24
Renaming the scripts
That sets up the simple scene, but you may have noticed that there are still a few duplicated naming errors. We will need to rename the Template scripts in the Simple/Scripts folder. Follow this next exercise to rename each of the scripts:
- Open the Scripts folder.
- Rename each of the files from Template to Simple, as shown in the following excerpt of the Project window:

Renaming the Template scripts to Simple
- Double-click on of the SimpleAcademy script file to open it in your code editor. Rename the class from TemplateAcademy to SimpleAcademy so that it matches the file name, as shown in the following code:
public class SimpleAcademy : Academy {
- Repeat this process for the Agent and Decision scripts. The objects in the scene are still pointing to the template scripts, so we will update that next. Make sure to save all the scripts with your changes before returning to the editor. If all the files are renamed correctly, the naming errors will go away.
- Select and rename the Ball3DAcademy to just Academy in the Hierarchy window.
- Select the Academy object in the Hierarchy window. Click the Gear icon beside the TemplateAcademy component in the Inspector window and select Remove Component to remove the script.
- Click the Add Component button and type Simple in the component search bar, as shown in the following screenshot:

Adding the SimpleAcademy object to the Academy object
- Click on the Simple Academy item, as shown in the preceding excerpt, to add the component to the Academy object.
- Repeat the process for the Agent object and remove the TemplateAgent script and add the SimpleAgent script.
- After you are done, be sure to save the scene and the project.
It is surprising that Unity didn't provide a better set of editor tools to build a new ML Agent environment, at least not at the time of writing this book. In the source code download for this book ( Chapter_1/Editor_Tools ), an asset package has been provided that can automate this setup for you. We may decide to put this package and some others from this book on the asset store.
That sets up a new ML environment for us to start implementing our own Academy, Agent, and Decision (Brain) scripts. We will get into the details of these scripts in the next section when we set up our first learning problem.
推薦閱讀
- MySQL數據庫進階實戰
- 我們都是數據控:用大數據改變商業、生活和思維方式
- 在你身邊為你設計Ⅲ:騰訊服務設計思維與實戰
- 軟件成本度量國家標準實施指南:理論、方法與實踐
- 達夢數據庫性能優化
- Oracle 12c云數據庫備份與恢復技術
- LabVIEW 完全自學手冊
- INSTANT Apple iBooks How-to
- 大數據與機器學習:實踐方法與行業案例
- Spring Boot 2.0 Cookbook(Second Edition)
- 從Lucene到Elasticsearch:全文檢索實戰
- 數據中臺實戰:手把手教你搭建數據中臺
- 數據挖掘算法實踐與案例詳解
- 數據挖掘與數據化運營實戰:思路、方法、技巧與應用
- Trino權威指南(原書第2版)