官术网_书友最值得收藏!

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:

  1. Open the Scripts folder.
  2. 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
  1. 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 {
  1. 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.
  2. Select and rename the Ball3DAcademy to just Academy in the Hierarchy window.
  3. 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.
  1. 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
  1. Click on the Simple Academy item, as shown in the preceding excerpt, to add the component to the Academy object.
  2. Repeat the process for the Agent object and remove the TemplateAgent script and add the SimpleAgent script.
  3. 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.

主站蜘蛛池模板: 昌邑市| 海原县| 保定市| 交口县| 赣榆县| 彩票| 临城县| 台北市| 丰宁| 清远市| 浦江县| 高尔夫| 蕲春县| 彩票| 龙口市| 文化| 鲁山县| 涞源县| 郴州市| 遂川县| 璧山县| 靖宇县| 高陵县| 铜山县| 南阳市| 桐梓县| 科技| 竹山县| 布拖县| 伊宁市| 普宁市| 平塘县| 宾川县| 大洼县| 松江区| 白银市| 平山县| 河北省| 阜新市| 灯塔市| 城步|