<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko"><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://unity3dstudy.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://unity3dstudy.com/" rel="alternate" type="text/html" hreflang="ko" /><updated>2023-05-18T11:28:43+00:00</updated><id>https://unity3dstudy.com/feed.xml</id><title type="html">IndieGameMaker</title><subtitle>유니티 게임 개발 블로그이며 게임 개발 관련한 다양한 분야의 기술을 정리하기 위한 개인 블로그 입니다..
</subtitle><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><entry><title type="html">절대강좌! 유니티 2021 출간</title><link href="https://unity3dstudy.com/books/2021-06-09-UnityBook-2021-Published/" rel="alternate" type="text/html" title="절대강좌! 유니티 2021 출간" /><published>2021-06-09T13:33:06+00:00</published><updated>2021-06-09T13:33:06+00:00</updated><id>https://unity3dstudy.com/books/UnityBook-2021-Published</id><content type="html" xml:base="https://unity3dstudy.com/books/2021-06-09-UnityBook-2021-Published/">&lt;p&gt;&lt;img src=&quot;/assets/img/books/unity2021_3D_800600.png&quot; alt=&quot;절대강좌 유니티&quot; width=&quot;650&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;절대강좌-유니티-2021-버전&quot;&gt;절대강좌! 유니티 (2021 버전)&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;절대강좌! 유니티&lt;/strong&gt; 절판된지 무려 2년만에 개정판을 새롭게 출간했습니다. 2020 버전으로 집필을 시작해 최종 2021 버전으로 출간하게 됐습니다. 6년전 초판본에 수록되었던 포톤 네트워크와 유니버셜 랜더 파이프라인(URP), New Input System 내용도 새롭게 수록했습니다. 유니티를 시작하시는 분들께 적극 추천합니다.&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h4 id=&quot;3인칭-슈팅-게임-제작&quot;&gt;3인칭 슈팅 게임 제작&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/img/books/Unity2021_01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;새로운-input-system&quot;&gt;새로운 Input System&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;/assets/img/books/Unity2021_02.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;포톤-클라우드를-활용한-네트워크-게임---로비-제작&quot;&gt;포톤 클라우드를 활용한 네트워크 게임 - 로비 제작&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;/assets/img/books/Unity2021_03.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;포톤-클라우드를-활용한-네트워크-게임---네트워크-동기화-및-룸-정보&quot;&gt;포톤 클라우드를 활용한 네트워크 게임 - 네트워크 동기화 및 룸 정보&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;/assets/img/books/Unity2021_04.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;절대강좌-유니티-2021---리소스-다운로드&quot;&gt;절대강좌! 유니티 2021 - 리소스 다운로드&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/IndieGameMaker/UnityBook&quot;&gt;책에서 사용하는 리소스&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/IndieGameMaker/SpaceShooter2021&quot;&gt;프로젝트 소스코드&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;온라인-서점&quot;&gt;온라인 서점&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.yes24.com/Product/Goods/101976203?OzSrank=8&quot;&gt;예스24&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://book.interpark.com/product/BookDisplay.do?_method=detail&amp;amp;sc.shopNo=0000400000&amp;amp;sc.prdNo=350692930&amp;amp;sc.saNo=003002001&amp;amp;bid1=search&amp;amp;bid2=product&amp;amp;bid3=title&amp;amp;bid4=001&quot;&gt;인터파크&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.kyobobook.co.kr/product/detailViewKor.laf?ejkGb=KOR&amp;amp;mallGb=KOR&amp;amp;barcode=9791158392611&amp;amp;orderClick=LAG&amp;amp;Kc=&quot;&gt;교보문고&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.aladin.co.kr/shop/wproduct.aspx?ItemId=272637400&quot;&gt;알라딘&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="books" /><summary type="html"></summary></entry><entry><title type="html">ML-Agents를 활용한 실전 예제 (3/3)</title><link href="https://unity3dstudy.com/unity/2020-08-26-MummyBasic-for-ML-Agents-03/" rel="alternate" type="text/html" title="ML-Agents를 활용한 실전 예제 (3/3)" /><published>2020-08-26T10:48:31+00:00</published><updated>2020-08-26T10:48:31+00:00</updated><id>https://unity3dstudy.com/unity/MummyBasic-for-ML-Agents-03</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-08-26-MummyBasic-for-ML-Agents-03/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_basic_title.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;maxstep-설정&quot;&gt;MaxStep 설정&lt;/h4&gt;

&lt;p&gt;Agent에 추가한 MummyAgent의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MaxStep&lt;/code&gt; 속성은 에이전트가 한 에피소드(학습단위)내에서 무작위로 액션(이동)을 시도해보는 최대 횟수를 의미한다. 이 횟수동안 액션을 취했지만 아무런 보상이 없다면 더이상 학습의 의미가 없기에 에피소드를 종료하고 다시 시작한다. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MaxStep&lt;/code&gt;의 수치는 환경의 복잡도에 따라서 가장 적절한 값을 찾아야 한다. 
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;이 프로젝트는 비교적 간단한 환경이기에 1000으로 설정한다. 만약 학습시도 횟수가 충분하지 않다고 생각된다면 더 늘려야 한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Max Step : 1000&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_12.png&quot; alt=&quot;&quot; width=&quot;650&quot; /&gt;&lt;/p&gt;

&lt;p&gt;또는, 이 값은 유니티 에디터에서 직접 입력해도 되지만 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Initialize()&lt;/code&gt; 함수에 다음과 같이 작성해도 된다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//MLAgents 초기화 작업 - Awake/Start&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Rigidbody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;originMt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;material&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;
        
        &lt;span class=&quot;c1&quot;&gt;//에피소드 별 최대 시도횟수 설정&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MaxStep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;behaviour-name-설정&quot;&gt;Behaviour Name 설정&lt;/h4&gt;

&lt;p&gt;Behaviour Parameters 컴포넌트의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Behaviour Name&lt;/code&gt; 속성은 환경설정 파일에서 자신의 학습환경 값을 찾기위한 속성이고 훈련이 끝난 후 해당 이름으로 모델 파일이 생성된다. &lt;strong&gt;Mummy&lt;/strong&gt; 로 설정한 후 하이러키 뷰에 복제한 프리팹 클론에도 적용하기 위해 Agent를 선택한 후 Overrides를 클릭해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Apply&lt;/code&gt;를 클릭한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Behaviour Name : Mummy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_13.png&quot; alt=&quot;&quot; width=&quot;650&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;configuration-yaml-파일-생성&quot;&gt;Configuration YAML 파일 생성&lt;/h3&gt;

&lt;p&gt;학습을 위해서 먼저 YAML 설정 파일을 생성한다. 파일명은 mummy.yaml로 생성하고 ml-agents/config/ppo/ 폴더에 저장한다. 또는 해당 폴더에 있는 다른 *.yaml 파일 하나를 복사한 후 다음과 같이 설정값들을 변경해도 된다.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;behaviors&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Mummy&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;trainer_type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ppo&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;hyperparameters&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;batch_size&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;64&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;buffer_size&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2048&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;learning_rate&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.0003&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;beta&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.001&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;epsilon&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.2&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;lambd&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.99&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;num_epoch&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;learning_rate_schedule&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;linear&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;network_settings&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;normalize&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;hidden_units&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;128&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;num_layers&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;vis_encode_type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;simple&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;reward_signals&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;extrinsic&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;gamma&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.99&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;strength&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.0&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;keep_checkpoints&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;max_steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;200000&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;time_horizon&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;summary_freq&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10000&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;threaded&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;학습training&quot;&gt;학습(Training)&lt;/h3&gt;

&lt;p&gt;윈도우 사용자는 명령 프롬프트(또는 GitBash, PowerShell)를 , 맥 사용자는 터미널을 오픈한 후 ml-agents 폴더로 이동한 후 다음 명령을 입력한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;mlagents-learn {학습환경설정파일.yaml} --run-id={Behaviour 명}&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;ml-agents
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mlagents-learn config/ppo/mummy.yaml &lt;span class=&quot;nt&quot;&gt;--run-id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Mummy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_train_01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;위와 같은 화면이 뜨면 유니티로 돌아가 실행시키면 강화학습을 시작한다. mummy.yaml의 max_steps를 200000으로 설정했기에 총 훈련의 횟수는 20만번 진행한다. 또한, summary_freq는 학습 진행중 학습 통계를 출력하는 간격으로 10000으로 설정했기에 만번 단위로 터미널에 출력한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_train_02.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;학습 시작 초기의 훈련 모습 - 빨간색으로 표시되는 것이 학습 실패를 의미한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_before_train.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;10만번 정도 진행했을 때의 훈련 모습 - 노란색이 많은것으로 보아 학습 성공률이 높다는 것을 알수 있다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_after_200k.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;생성된-모델의-적용&quot;&gt;생성된 모델의 적용&lt;/h3&gt;

&lt;p&gt;20만번의 훈련이 끝나면 유니티는 자동으로 종료되며 자동으로 생성된 result 폴더 하위에 있는 Mummy.nn 파일을 유니티 프로젝트 뷰의 04.TF Models 폴더로 드래그해 임포트한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_model.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;훈련한 학습 모델을 적용해보자. Stage -&amp;gt; Agent를 선택하고 임포트한 Mummy.nn 파일을 Behaviour Parameters -&amp;gt; Model 속성에 연결한 후 유니티를 실행하면 앞서 훈련했던 데로 Target 큐브를 향해 이동하는 에이전트 캐릭터를 확인 할 수 있을 것이다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_model_setting.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;맺음말&quot;&gt;맺음말&lt;/h3&gt;

&lt;p&gt;이 포스팅에서는 아주 단순한 환경과 로직으로 학습을 진행했지만 환경을 직접 만들면서 유니티 ML-Agents의 기본적인 기능을 소개했다. 다음 포스팅에서는 레이 캐스팅과 카메라 센서, 모방학습를 이용해 관측하는 방식으로 좀 더 복잡한 환경에서의 학습을 구현해 볼 예정이다.&lt;/p&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">ML-Agents를 활용한 실전 예제 (2/3)</title><link href="https://unity3dstudy.com/unity/2020-08-22-MummyBasic-for-ML-Agents-02/" rel="alternate" type="text/html" title="ML-Agents를 활용한 실전 예제 (2/3)" /><published>2020-08-22T15:45:28+00:00</published><updated>2020-08-22T15:45:28+00:00</updated><id>https://unity3dstudy.com/unity/MummyBasic-for-ML-Agents-02</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-08-22-MummyBasic-for-ML-Agents-02/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_basic_title.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;에에전트-구성&quot;&gt;에에전트 구성&lt;/h2&gt;

&lt;p&gt;Agent에 추가할 스크립트를 작성해보자. 프로젝트 뷰의 02.Scripts 폴더에 C# 스크립트를 생성하고 &lt;strong&gt;MummyAgent&lt;/strong&gt;로 스크립트 이름을 지정한다. 강화학습에 있어서 에이전트의 역할은 크게 다음과 같이 정의할 수 있다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;주변 환경을 관측(Observations)&lt;/li&gt;
  &lt;li&gt;정책에 의한 행동(Actions)&lt;/li&gt;
  &lt;li&gt;보상(Reward)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;네임스페이스와-베이스-클래스&quot;&gt;네임스페이스와 베이스 클래스&lt;/h3&gt;

&lt;p&gt;에이전트 스크립트는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Unity.MLAgents&lt;/code&gt; 네임스페이스를 지정해야하며 상속 받을 베이스 클래스를 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Agent&lt;/code&gt;로 지정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;using Unity.MLAgents&lt;/li&gt;
  &lt;li&gt;Agent Class 상속&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;UnityEngine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Unity.MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MummyAgent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Agent&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;agent-클래스의-핵심-메소드&quot;&gt;Agent 클래스의 핵심 메소드&lt;/h3&gt;

&lt;p&gt;Agent 클래스에는 에이전트를 위한 다양한 메소드와 속성을 제공하고 있으며 Override해 사용할 수 있다. 다음 코드는 반드시 알아야 하는 기본적인 메소드를 나열한 것으로 하나씩 의미를 소개한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;UnityEngine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Unity.MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MummyAgent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Agent&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//초기화 작업을 위해 한번 호출되는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//에피소드(학습단위)가 시작할때마다 호출&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnEpisodeBegin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//환경 정보를 관측 및 수집해 정책 결정을 위해 브레인에 전달하는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CollectObservations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Unity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sensors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;VectorSensor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//브레인(정책)으로 부터 전달 받은 행동을 실행하는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnActionReceived&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vectorAction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//개발자(사용자)가 직접 명령을 내릴때 호출하는 메소드(주로 테스트용도 또는 모방학습에 사용)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Heuristic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;관측-정보를-위한-변수-초기화&quot;&gt;관측 정보를 위한 변수 초기화&lt;/h3&gt;

&lt;p&gt;관측정보는 좀더 유의미한 정보를 제공해야 하기에 훈련중 모니터링을 통해 수정하는 과정을 반복해야 한다. 따라서, 개발자는 어떠한 정보를 관측해야 더 효율적인가를 고민해야 한다. Mummy 에이전트는 다음 세가지 정보를 관측하기로 하고 이에 필요한 컴포넌트를 Initialize 메소드에서 할당한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Rigidbody 컴포넌트의 속도(Velocity)&lt;/li&gt;
  &lt;li&gt;타겟의 위치&lt;/li&gt;
  &lt;li&gt;자신의 위치&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;UnityEngine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Unity.MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MummyAgent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Agent&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Rigidbody&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;targetTr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//초기화 작업을 위해 한번 호출되는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Rigidbody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;중략&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;...]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;학습-시작시-초기화---onepisodebegin&quot;&gt;학습 시작시 초기화 - OnEpisodeBegin&lt;/h3&gt;

&lt;p&gt;일반적으로 올바른 결과에 도달하던지 또는 잘못된 결과에 도달하게 되면 학습을 종료하고 새로운 학습(에피소드)를 시작한다. OnEpisodeBegin 메소드는 학습이 시작할 때 마다 한번씩 호출되는 메소드로 에이전트의 초기화 및 환경을 재설정한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//에피소드(학습단위)가 시작할때마다 호출&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnEpisodeBegin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//물리력을 초기화&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;velocity&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;angularVelocity&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;//에이젼트의 위치를 불규칙하게 변경&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                     &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.05f&lt;/span&gt;
                                     &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;targetTr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                            &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0.55f&lt;/span&gt;
                                            &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;에이전트-초기화-확인&quot;&gt;에이전트 초기화 확인&lt;/h3&gt;

&lt;p&gt;여기까지 작성된 스크립트를 저장하고 하이러키 뷰의 Agent에 MummyAgent 스크립트를 추가한다. 스크립트를 추가하면 MummyAgent와 의존성이 있는 Behaviour Parameters 스크립트가 자동으로 추가된다. 물론 Behaviour Parameters를 직접 추가해도 된다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_01.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;하이러키 뷰의 Stage –&amp;gt; Target을 MummyAgent의 targetTr 속성으로 드래그 앤드 드롭해 연결한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_02.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;이제 유니티를 플래이 할 때 마다 Agent와 Target의 위치가 불규칙하게 위치가 변경된다면 OnEpisodeBegin 메소드가 정상적으로 실행된 것이다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;관측정보---collectobservations&quot;&gt;관측정보 - CollectObservations&lt;/h3&gt;

&lt;p&gt;관측정보의 수집 및 전달은 CollectObservations 메소드에서 VectorSensor.AddObservation 메소드를 사용한다. AddObservation 메소드에서 넘겨주는 파라미터의 타입은 Vector 타입으로 유니티의 Vector와는 다른 개념으로 다양한 유형의 데이터를 전달할 수 있다. 여기서 중요한 것은 넘겨주는 데이터의 Size로 아래 코드에서는 AddObservation 메소드를 4번 호출했지만 각각 데이터의 Size는 3, 3, 1, 1로 총 8개의 데이터를 관측정보로 전달하는 것을 의미한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//환경 정보를 관측 및 수집해 정책 결정을 위해 브레인에 전달하는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CollectObservations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Unity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sensors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;VectorSensor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddObservation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;targetTr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//3 (x,y,z)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddObservation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;//3 (x,y,z)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddObservation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;velocity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;//1 (x)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddObservation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;velocity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;//1 (z)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;관측 데이터의 size(갯수)인 8을 Behaviour Parameters 컴포넌트의 &lt;strong&gt;Vector Observation / Space Size&lt;/strong&gt; 속성으로 설정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Vector Observation / Space Size 속성 : 8&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_04.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;이동처리-로직---onactionreceived&quot;&gt;이동처리 로직 - OnActionReceived&lt;/h3&gt;

&lt;p&gt;정책(Polocy)로 부터 결정된 행동에 대해 에이전트가 수행할 동작은 OnActionReceived 메소드에서 처리한다. 정책으로 부터 전달되는 값은 &lt;strong&gt;연속적인 값(Continues)&lt;/strong&gt;와 &lt;strong&gt;이산 값(불연속적인 값: Discrete)&lt;/strong&gt;로 구분한다. Mummy 에이전트는 상,하,좌,우 화살표 키입력값으로 전진,후진,좌,우로 이동 처리한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//브레인으로 부터 전달받은 액션(행위)를 실행하는 메소드&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnActionReceived&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vectorAction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//데이터를 정규화&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mathf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Clamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vectorAction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mathf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Clamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vectorAction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;forward&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;right&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddForce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;normalized&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;50.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;//지속적으로 이동을 이끌어내기 위한 마이너스 보상&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;SetReward&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0.001f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;본 프로젝트에서는 정책으로 부터 결정된 VectorAction 값이 연속적인 값이기 때문에 Behaviour Parameters 의 Vector Action / Space Type 속성을 &lt;strong&gt;Continue&lt;/strong&gt;로 지정한다. 반대로 이산 값을 사용한다면 &lt;strong&gt;Discrete&lt;/strong&gt;로 지정해야 한다. 또한, VectorAction의 종류는 상,하 값과 좌, 우 값 2 세트이기에 &lt;strong&gt;Vector Action / Space Size&lt;/strong&gt; 속성을 2로 설정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Vector Action / Space Type : &lt;strong&gt;Continue&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Vector Action / Space Size : &lt;strong&gt;2&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_05.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;테스트를-위한-키-입력-로직---heuristic&quot;&gt;테스트를 위한 키 입력 로직 - Heuristic&lt;/h3&gt;

&lt;p&gt;학습을 훈련시키기 이전에 미리 테스트를 해보기 위해 사용자로 부터 키보드 입력값을 받는 부분이 필요하다. 이 로직은 Heuristic 메소드에서 처리한다. 입력값의 종류는 2가지로 정의하며 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input.GetAxis&lt;/code&gt; 메소드를 사용하기에 넘어오는 값의 범위는 -1.0f ~ 0.0f ~ 1.0f 이다. 즉, 연속적인 값을 넘겨준다. 만약 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input.GetAxisRaw&lt;/code&gt; 메소드 또는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input.GetKeyDown&lt;/code&gt;과 같은 메소드를 사용한다면 이산 값을 의미한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;actionsOut[0] : 왼쪽, 오른쪽 이동&lt;/li&gt;
  &lt;li&gt;actionsOut[1] : 앞, 뒤 이동&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;여기서 actionsOut[0]으로 입력받은 값은 OnActionReceived 메소드의 vectorAction[0] 파라미터로 전달되며 actionsOut[1]은 vectorAction[1]로 전달되는 구조다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;actionsOut[0] –&amp;gt; vectorAction[0]&lt;/li&gt;
  &lt;li&gt;actionsOut[1] –&amp;gt; vectorAction[1]&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//개발자(사용자)가 직접 명령을 내릴때 호출하는 메소드(주로 테스트용도 또는 모방학습에 사용)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Heuristic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetAxis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Horizontal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//좌,우 화살표 키 //-1.0 ~ 0.0 ~ 1.0&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetAxis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Vertical&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//상,하 화살표 키 //연속적인 값&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Debug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$&quot;[0]=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; [1]=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;actionsOut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;decision-requester-컴포넌트&quot;&gt;Decision Requester 컴포넌트&lt;/h3&gt;

&lt;p&gt;Decision Requester는 에이전트가 어떻게 행동해야 할지 정책에 결정을 요청하는 컴포넌트다. 정책은 에이전트가 주변 환경정보를 수집하고 관찰한 정보를 토대로 학습된것을 의미한다. 이 컴포넌트는 지속적으로 결정을 내려받아 행동해야 하는 학습 패턴의 경우 사용된다. 단, 턴제 게임과 같이 지속적인 결정이 필요없고 필요한 시점에 코드에서 직접 요청할 경우에는 추가하지 않는다.&lt;/p&gt;

&lt;p&gt;하이러키 뷰의 Stage -&amp;gt; Agent를 선택하고 메뉴 &lt;strong&gt;Components -&amp;gt; ML Agents -&amp;gt; Decision Requester&lt;/strong&gt;를 선택해 컴포넌트를 추가한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_06.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;이제 유니티를 실행한 후 화살표 키를 입력하면 주인공 캐릭터가 상하좌우로 이동하는 것을 확인할 수 있다.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;충돌-및-보상-처리&quot;&gt;충돌 및 보상 처리&lt;/h3&gt;

&lt;p&gt;에이전트가 타겟에 도달했을 때 + 보상을 주고 Dead Zone 영역에 충돌하면 - 보상을 준다. 충돌 여부는 유니티의 충돌 콜백함수 (OnCollisionEnter)에서 처리한다. 다음 함수를 MummyAgent.cs 스크립트에 추가한다.&lt;/p&gt;

&lt;p&gt;보상을 주는 메소드는 SetReward, AddReward로 두 매소드의 차이는 다음과 같다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;SetReward() : 이전 보상값을 지우고 현재의 보상값으로 대치한다. 이는 누적된 보상값이 필요없을 경우에 사용한다.&lt;/li&gt;
  &lt;li&gt;AddReward() : 보상을 받고 바로 에피소드가 종료시키지 않고 계속해서 학습해야 하는 환경에서 사용한다.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnCollisionEnter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Collision&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CompareTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;DEAD_ZONE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//잘못된 행동일 때 마이너스 보상을 준다.&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;SetReward&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//학습을 종료시키는 메소드&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;EndEpisode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;       
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CompareTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;TARGET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//올바른 행동일 때 플러스 보상을 준다.&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;SetReward&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(+&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//학습을 종료시키는 메소드&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;EndEpisode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;충돌 처리시 시각적으로 성공과 실패를 알기 쉽도록하기 위해 바닥의 색상을 변경시켜보자. 다음과 같은 이름의 머티리얼을 2개 생성해 각각 다른 색상으로 지정한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;GoodMt : 노란색&lt;/li&gt;
  &lt;li&gt;BadMt  : 빨간색&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_07.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;MummyAgent.cs 스크립트를 다음과 같이 수정한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;UnityEngine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Unity.MLAgents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MummyAgent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Agent&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Rigidbody&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;targetTr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Renderer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//바닥의 색생을 변경하기 위한 머티리얼&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Material&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Material&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;badMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Material&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//MLAgents 초기화 작업 - Awake/Start&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Rigidbody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;originMt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;material&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;중략&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;하이러키 뷰의 Agent를 선택한 후 다음과 같이 3개의 속성을 연결한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Floor Rd : 하이러키 뷰의 Floor&lt;/li&gt;
  &lt;li&gt;Bad Mt : 프로젝트 뷰의 BadMt&lt;/li&gt;
  &lt;li&gt;Good Mt : 프로젝트 뷰의 GoodMt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_08.png&quot; alt=&quot;&quot; width=&quot;550&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Target과 Dead Zone에 충돌했을 때 각각 다른 색으로 표시하기 위해 OnCollisionEnter 콜백함수를 다음과 같이 수정한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnCollisionEnter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Collision&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CompareTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;DEAD_ZONE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;material&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;badMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;

            &lt;span class=&quot;c1&quot;&gt;//잘못된 행동일 때 마이너스 보상을 준다.&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;SetReward&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//학습을 종료시키는 메소드&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;EndEpisode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;       
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CompareTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;TARGET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;material&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가&lt;/span&gt;

            &lt;span class=&quot;c1&quot;&gt;//올바른 행동일 때 플러스 보상을 준다.&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;SetReward&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(+&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//학습을 종료시키는 메소드&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;EndEpisode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;바닥의 색상을 변경하고 잠시후 원래의 색상(originMt)으로 변경하기 위해 코루틴을 사용한다. 다음과 같이 RevertMaterial 코루틴 함수를 작성하고 OnEpisodeBegin에서 호출한다.&lt;/p&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;c1&quot;&gt;//에피소드(학습단위)가 시작할때마다 호출&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnEpisodeBegin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//물리력을 초기화&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;velocity&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;angularVelocity&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;//에이젼트의 위치를 불규칙하게 변경&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                     &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.05f&lt;/span&gt;
                                     &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;targetTr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localPosition&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                            &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0.55f&lt;/span&gt;
                                            &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4.0f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

        &lt;span class=&quot;nf&quot;&gt;StartCoroutine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;RevertMaterial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//&amp;lt;== 추가                                      &lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;IEnumerator&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;RevertMaterial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;WaitForSeconds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0.2f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;floorRd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;material&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originMt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;학습을-위한-환경-복제&quot;&gt;학습을 위한 환경 복제&lt;/h3&gt;

&lt;p&gt;학습 효율을 높이기 위해 학습환경을 프리팹으로 전환시킨 후 씬에 여러개 복사한다. 다음 순서로 진행한다.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;하이러키 뷰의 Stage를 프로젝트 뷰 03.Prefabs로 드래그해 프리팹으로 전환&lt;/li&gt;
  &lt;li&gt;하이러키 뷰의 Stage를 선택한 후 복제(Ctrl+D, Cmd+D)한 후 위치 이동&lt;/li&gt;
  &lt;li&gt;위 2를 반복해 여러개를 배치&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_09.png&quot; alt=&quot;&quot; width=&quot;450&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_script_10.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;유니티를 실행한 후 화살표키를 이용해 에이젼트를 무작위로 이동시켜보고 Target에 충돌했을 때와 Dead Zone에 충돌했을 때의 다음 그림과 같이 바닥색상이 변경되고 환원되는지를 확인해보자.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_heristic.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;강화학습을 위한 학습 환경구축은 모두 완성됐다. 다음 포스팅에서 학습을 시켜 결과를 확인해보자.&lt;/p&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">ML-Agents를 활용한 실전 예제 (1/3)</title><link href="https://unity3dstudy.com/unity/2020-08-21-MummyBasic-for-ML-Agents-01/" rel="alternate" type="text/html" title="ML-Agents를 활용한 실전 예제 (1/3)" /><published>2020-08-21T15:35:58+00:00</published><updated>2020-08-21T15:35:58+00:00</updated><id>https://unity3dstudy.com/unity/MummyBasic-for-ML-Agents-01</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-08-21-MummyBasic-for-ML-Agents-01/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_basic_title.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;프로젝트-개요&quot;&gt;프로젝트 개요&lt;/h2&gt;

&lt;p&gt;머신러닝(강화학습)이 처음이거나 막 공부를 시작한 유니티 개발자의 경우 유니티 ML-Agents 패키지를 설치하고나서 샘플 프로젝트를 바로 분석하기란 상당히 어렵다. 따라서, 본 포스팅에서 소개하는 프로젝트는 필자가 진행하는 오프라인 강의 내용으로서 ML-Agents의 기본적인 컴포넌트의 사용법과 훈련방법을 익힐 수 있도록 빈 프로젝트 부터 차근차근 진행하고자 한다.&lt;/p&gt;

&lt;p&gt;제작할 프로젝트는 에이전트가 특정 타겟까지 이동해 취득하는 것을 간단한 학습하는 예제이다.&lt;/p&gt;

&lt;h2 id=&quot;개발-환경설정&quot;&gt;개발 환경설정&lt;/h2&gt;

&lt;p&gt;프로젝트를 진행하기 이전에 먼저 파이썬과 텐서플로 및 추가적인 파이썬 패키지가 설치되어야 한다. 아직 개발환경이 설정이 되지 않았다면 다음 문서를 참조해 자신에 맞는 개발 환경을 설정하고 진행한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://unity3dstudy.com/2020/08/20/MLAgents-Installation-for-WinOS/&quot;&gt;ML-Agents 윈도우 OS 개발환경 구축&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://unity3dstudy.com/2020/05/13/MLAgents-Installation-for-macOS/&quot;&gt;ML-Agents 맥 OS 개발환경 구축&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;유니티-프로젝트-생성-및-초기-설정&quot;&gt;유니티 프로젝트 생성 및 초기 설정&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;유니티를 오픈하고 새로운 프로젝트를 생성한다. 프로젝트 명은 &lt;strong&gt;MummyBasic&lt;/strong&gt;으로 한다.(또는, 적절히 지정한다.)&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;메뉴 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Window -&amp;gt; Package Manager&lt;/code&gt;를 선택해 &lt;strong&gt;패키지매니저&lt;/strong&gt;를 오픈한다. 패키지매니저의 기본 조회 옵션은 현재 프로젝트에 설치된 패키지만 표시하도록 되어 있다면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Packages:In Project&lt;/code&gt;를 클릭해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Unity Registry&lt;/code&gt;로 변경하면 유니티에 등록된 다양한 패키지가 목록에 표시된다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;../../assets/img/unity/package_manager.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;검색 입력항목에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ML Agents&lt;/code&gt;로 검색하면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ML Agents&lt;/code&gt;가 표시된다. 아래쪽의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Install&lt;/code&gt; 버튼을 클릭해 해당 패키지를 설치한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagent_package_install.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ML Agents&lt;/code&gt; 패키지가 설치됐으면 프로젝트 뷰의 Packages에 다음과 같이 확인할 수 있다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_01.png&quot; alt=&quot;&quot; width=&quot;250&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;리소스-다운로드&quot;&gt;리소스 다운로드&lt;/h2&gt;

&lt;p&gt;에이전트에 사용할 캐릭터를 에셋스토어에서 다운로드 받는다. 유니티 2020.1.x 부터는 웹브라우저에서 &lt;a href=&quot;https://assetstore.unity.com&quot;&gt;유니티 에셋스토어&lt;/a&gt;에 접속한 후 검색 및 구매하도록 변경됐다. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mummy&lt;/code&gt;로 검색해 다음 캐릭터를 구매(무료)한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_assetstore.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;구매한 에셋은 유니티 패키지 매니저에서 다운로드 및 설치할 수 있다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_packagemgr.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;설치가 완료된 후 프로젝트 뷰에 생성된 amusedART 폴더를 05.Models로 폴더의 이름을 변경한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_model_install.png&quot; alt=&quot;&quot; width=&quot;250&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;학습-환경trainning-environment-구축&quot;&gt;학습 환경(Trainning Environment) 구축&lt;/h2&gt;

&lt;h3 id=&quot;바닥-생성&quot;&gt;바닥 생성&lt;/h3&gt;

&lt;p&gt;에이젼트가 타겟을 향해 이동하는 바닥을 생성한다. 바닥은 큐브의 스케일을 변경해 만드며 적절한 색상을 지정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;빈 게임오브젝트를 생성한 후 이름을 &lt;strong&gt;Stage&lt;/strong&gt;로 변경한다. Stage 게임오브젝트 하위에 큐브를 추가하고 이름을 &lt;strong&gt;Floor&lt;/strong&gt;로 지정한다.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Floor의 Transform의 Scale 속성을 (10, 0.1, 10)으로 설정한다.
&lt;img src=&quot;/assets/img/unity/mummy_stage_floor.png&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;프로젝트 뷰의 05.Models 폴더 하위에 Materials 폴더를 생성해 바닥에 적용할 머티리얼을 생성하고 Floor 게임오브젝트에 머티리얼을 연결한다.
&lt;img src=&quot;/assets/img/unity/mummy_stage_material.png&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;외곽-영역-생성&quot;&gt;외곽 영역 생성&lt;/h3&gt;

&lt;p&gt;에이전트가 바닥의 외곽으로 같을 때 충돌을 감지하기 위한 콜라이더를 생성한다. 물론 바닥을 지나쳐 밑으로 떨어지는 것을 감지해도 좋지만 여기서는 외곽 부분에 충돌하는 것으로 설정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Stage 하위에 빈 게임오브젝트를 생성하고 이름을 &lt;strong&gt;Dead_Zone&lt;/strong&gt;으로 지정한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_00.png&quot; alt=&quot;&quot; width=&quot;250&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Dead_Zone 하위에 Cube를 생성하고 Transform Scale 속성을 (10, 1, 1)로 설정한다. 생성한 Cube의 위치는 Floor 외곽선 부분으로 이동한다. 이때 Vertex Snapping(단축키 V) 기능을 활용하면 편리하게 스내핑시킬 수 있다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Cube를 복제(Ctrl+d, Cmd+d)해 Floor의 나머지 3군데에도 다음 그림과 같이 배치한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_02.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;복제한 Cube의 MeshRenderer 컴포넌트를 비활성화시켜 시각적으로 표시되지 않도록 변경한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;새로운 태그 &lt;strong&gt;DEAD_ZONE&lt;/strong&gt;을 생성하고 4개의 Cube에 지정한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_04.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;목표물-생성&quot;&gt;목표물 생성&lt;/h3&gt;

&lt;p&gt;Cube를 생성해 에이젼트가 가야할 목표물로 사용한다. 역시 Stage 하위에 Cube를 만들고 이름을 Target으로 지정한다. 또한, 새로운 머티리얼을 생성해 적절한 색상으로 지정한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;생성한 Target의 Transform Position은 (0, 0.55, 0)으로 지정해 바닥에 정확히 닿도록 설정한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_05.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;새로운 태그 &lt;strong&gt;TARGET&lt;/strong&gt;를 생성해 Target 게임오브젝트의 Tag로 지정한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_cube_06.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;에이젼트-캐릭터-생성&quot;&gt;에이젼트 캐릭터 생성&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;프로젝트 뷰의 05.Models/Mummy_Mon 폴더에 있는 Mummy_Mon 모델을 Stage 하위로 드래그 앤드 드롭해 추가한다. 만약 Material이 끊어진 경우에는 05.Models/Mummy_Mon/Materials 폴더에 있는 머티리얼을 연결한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_agent_01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Stage 하위에 추가한 Mummy_Mon의 이름을 Agent로 변경하고 진행한다. Agent의 초기 위치는 Floor에 정확히 닿도록 다음과 같이 설정한다.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Transform Position : (0, 0.05, -2)&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_agent_02.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Agent가 다른 객체(Dead Zone, Target)에 충돌하기 위해 Capsule Collider와 Rigidbody 컴포넌트를 추가한다. Capsule Collider 속성은 다음과 같이 설정해 Agent 크기에 맞춘다.
    &lt;ul&gt;
      &lt;li&gt;Capsule Collider&lt;/li&gt;
      &lt;li&gt;Center : (0, 0.5, 0)&lt;/li&gt;
      &lt;li&gt;Radius : 0.3&lt;/li&gt;
      &lt;li&gt;Rigidbody : Constraints / Freeze Rotation X, Y, Z 모드 체크&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_agent_03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;추가적으로(중요하진 않지만) Agent가 이동할 때 Walk 동작을 하기 위해 Animator 컴포넌트의 Controller 속성에 &lt;strong&gt;Mummy_Anim&lt;/strong&gt; 컨트롤러를 연결한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mummy_agent_03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">ML-Agent 개발환경 설정 for Window OS</title><link href="https://unity3dstudy.com/unity/2020-08-20-MLAgents-Installation-for-WinOS/" rel="alternate" type="text/html" title="ML-Agent 개발환경 설정 for Window OS" /><published>2020-08-20T13:13:45+00:00</published><updated>2020-08-20T13:13:45+00:00</updated><id>https://unity3dstudy.com/unity/MLAgents-Installation-for-WinOS</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-08-20-MLAgents-Installation-for-WinOS/">&lt;p&gt;윈도우 OS에서 ML-Agents 개발환경 설정은 다음과 같이 순서로 구축한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.git-scm.com&quot;&gt;Git 설치&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://desktop.github.com&quot;&gt;Github Desktop 설치(옵션)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.python.org&quot;&gt;Python 설치(3.7.x 버전, 64bit)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/ml-agents&quot;&gt;ML-Agents 리포지토리 클론&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;ml-agents 파이썬 패키지 설치&lt;/li&gt;
  &lt;li&gt;유니티 프로젝트 생성 및 ML-Agents 패키지 설치&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;git-설치&quot;&gt;Git 설치&lt;/h3&gt;
&lt;p&gt;Git은 반드시 설치해야 하는 것은 아니지만 유니티는 ML-Agents 관련 샘플 프로젝트와 파이썬 패키지를 깃허브 리포지토리에서 관리하고 있기 때문에 Git을 설치하는 것이 개발시 편리하다. 윈도우 OS 사용자는 Git을 직접 설치해야 한다. 다음 주소에서 Git 설치 파일을 다운로드 후 설치한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.git-scm.com&quot;&gt;https://www.git-scm.com&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/git_install.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;!-- &lt;p align=&quot;left&quot;&gt;
  &lt;img src=&quot;https://unity3dstudy.com../../assets/img/unity/git_install.png&quot;
      width=&quot;800&quot; border=&quot;0&quot; /&gt;
  &lt;/p&gt; --&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;github-desktop-설치-옵션&quot;&gt;Github Desktop 설치 (옵션)&lt;/h3&gt;
&lt;p&gt;Git 사용법이 익숙하지 않은 개발자라면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Github Desktop&lt;/code&gt;과 같은 툴을 설치하면 편리하게 사용할 수 있다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://desktop.github.com&quot;&gt;https://desktop.github.com&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/github_desktop.png&quot; alt=&quot;&quot; /&gt;
  &lt;!-- &lt;p align=&quot;left&quot;&gt;
  &lt;img src=&quot;https://unity3dstudy.com../../assets/img/unity/github_desktop.png&quot;
      width=&quot;800&quot; border=&quot;0&quot; /&gt;
  &lt;/p&gt; --&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;python-설치&quot;&gt;Python 설치&lt;/h3&gt;
&lt;p&gt;ML-Agents 1.0.3 버전에서 사용하는 파이썬은 3.7.x , 64bit 버전을 사용한다. 다음 주소에 접속해 해당 버전의 파이썬을 설치한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.python.org&quot;&gt;파이썬 공식 사이트(https://www.python.org)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.python.org/downloads/release/python-379/&quot;&gt;3.7.x 버전 다운로드(https://www.python.org/downloads/release/python-379/)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;설치 파일을 실행했을 때 첫 화면에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add Python 3.7 to Path&lt;/code&gt; 체크 박스를 반드시 선택해야 한다. 만약 체크하지 않고 설치를 진행했다면 수동으로 윈도우 환경설정을 해야 하기 때문에 삭제 후 재설치하는 것이 편리하다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/python_install_01.png&quot; alt=&quot;&quot; /&gt;
  &lt;!-- &lt;p align=&quot;left&quot;&gt;
  &lt;img src=&quot;https://unity3dstudy.com../../assets/img/unity/python_install.png&quot;
      width=&quot;600&quot; border=&quot;0&quot; /&gt;
  &lt;/p&gt; --&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;설치 완료된 후 명령 프롬프트 또는 GitBash와 같은 CLI 환경에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python --version&lt;/code&gt; 명령어를 입력했을 때 설치 버전이 뜬다면 정상 설치된 것이다.
    &lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;version&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3.7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;9&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;ml-agents-리포지토리-클론&quot;&gt;ML-Agents 리포지토리 클론&lt;/h3&gt;
&lt;p&gt;유니티 ML-Agents 리포지토리를 로컬 PC로 클론하기 위해 다음 주소로 접속한다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/ml-agents&quot;&gt;https://github.com/Unity-Technologies/ml-agents&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagent_git_01.png&quot; alt=&quot;&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;여기서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Code&lt;/code&gt; 버튼을 클릭하면 마스터 브렌치를 다운로드하기 때문에 최신 릴리스 버전을 받기 위해 아래쪽에 있는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release &amp;amp; Documantaion&lt;/code&gt;에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release 6&lt;/code&gt;의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Source&lt;/code&gt;를 선택한다. (2020-08-30 시점)&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagent_git_02.png&quot; alt=&quot;&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release 6&lt;/code&gt; 리포지토리를 선택한 후 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Code&lt;/code&gt; 버튼을 클릭해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Open with Github Desktop&lt;/code&gt;을 선택하면 GitHub Desktop이 열린다. 해당 리포지토리를 저장할 Local Path를 지정하고 클론한다.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagent_git_03.png&quot; alt=&quot;&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;GitBash 또는 명령 프롬프트에서 클론하기 위해서는 클론할 폴더까지 이동한 후 다음과 같은 명령어로 클론한다.&lt;/p&gt;

    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone &lt;span class=&quot;nt&quot;&gt;--branch&lt;/span&gt; release_6 https://github.com/Unity-Technologies/ml-agents.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;ml-agents-ml-agents-envs-패키지-설치&quot;&gt;ml-agents, ml-agents-envs 패키지 설치&lt;/h3&gt;

&lt;p&gt;ML-Agents 최신 릴리스 버전의 리포지토리의 클론이 완료된 후 터미널에서 ml-agents 폴더 안으로 이동해 다음과 같이 ML-Agents 관련한 파이썬 패키지를 설치한다.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;ml-agents
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; ml-agents-envs
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; ml-agents
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ml-agents-파이썬-패키지-설치확인&quot;&gt;ML-Agents 파이썬 패키지 설치확인&lt;/h3&gt;

&lt;p&gt;명령 프롬프트에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mlagents-learn -h&lt;/code&gt; 명령어를 입력했을 때 다음과 같이 파라메터 사용법이 표시된다면 정상적으로 설치된것을 의미한다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mlagents-learn &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagents_finished_install.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
    *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
    *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables    */
    /*
    var disqus_config = function () {
    this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
    this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() { // DON'T EDIT BELOW THIS LINE
    var d = document, s = d.createElement('script');
    s.src = 'https://unity3dstudy-hexo.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html">윈도우 OS에서 ML-Agents 개발환경 설정은 다음과 같이 순서로 구축한다.</summary></entry><entry><title type="html">패키지 매니저의 변경사항 in Unity 2020.1</title><link href="https://unity3dstudy.com/unity/2020-08-13-Unity-Tip-PackageManager/" rel="alternate" type="text/html" title="패키지 매니저의 변경사항 in Unity 2020.1" /><published>2020-08-13T11:11:36+00:00</published><updated>2020-08-13T11:11:36+00:00</updated><id>https://unity3dstudy.com/unity/Unity-Tip-PackageManager</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-08-13-Unity-Tip-PackageManager/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/unitytip_packagemgr01.png&quot; alt=&quot;&quot; width=&quot;800&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;에셋스토어-뷰의-통합&quot;&gt;에셋스토어 뷰의 통합&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;유니티 2020 버전부터는 에셋스토어에서 구매한 에셋들을 Package Manager에서 직접 다운로드 및 임포트할 수 있다.&lt;/li&gt;
  &lt;li&gt;기존 에셋스토어 뷰(Ctrl+9, Cmd+9)에서는 더 이상 검색 및 다운로드할 수 없으며, 웹 브라우저로 연결되는 버튼을 표시한다. 이는 임베디드 브라우저의 퍼포먼스를 이유로 변경되었다고 한다. 따라서 유니티 2020 버전부터는 일반 웹 브라우저를 통해 에셋을 검색하고 구매해야한다. 구매한 에셋은 유니티 Package Manager의 Packages: 옵션을 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;My Assets&lt;/code&gt;으로 변경해 해당 에셋을 다운로드 할 수 있다.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/unitytip_packagemgr01.png&quot; alt=&quot;&quot; width=&quot;800&quot; /&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;h3 id=&quot;preview-package-표시-및-in-development-package-목록제외&quot;&gt;Preview Package 표시 및 In Development Package 목록제외&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;프리뷰 패키지의 표시는 메뉴 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project Settings...&lt;/code&gt;에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Package Manager&lt;/code&gt; 섹션에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enable Preview Packages&lt;/code&gt; 옵션을 체크해야 볼 수 있다. 물론 Package Manager의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;톱니바퀴&lt;/code&gt; 아이콘을 클릭하면 바로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project Settings...&lt;/code&gt; 뷰가 오픈된다.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/unitytip_packagemgr02.png&quot; alt=&quot;&quot; width=&quot;600&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;아직 공개하기 이른 Preview 패키지의 경우 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enable Preview Packages&lt;/code&gt; 옵션을 활성화 해도 Package Manager의 목록에서 보이지 않는다. 예를 들어 유니티 DOTS 기능을 사용하기 위한 Entity 패키지가 목록에 표시되지 않아 직접 추가해야한다.(유니티 2020.1.0 기준)&lt;/li&gt;
  &lt;li&gt;Package Manager 뷰의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;+&lt;/code&gt; 아이콘을 클릭한 후 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add package from git URL&lt;/code&gt;을 클릭해서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com.unity.entities&lt;/code&gt;를 입력하면 해당 패키지가 설치된다.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/unitytip_packagemgr03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/unitytip_packagemgr04.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;in-development-package-목록&quot;&gt;In Development Package 목록&lt;/h3&gt;

&lt;p&gt;다음은 Package Manager에서 표시되지 않는 Preview Package(In Development Package) 목록으로 필요한 패키지는 직접 수동으로 설치할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;com.ptc.vuforia.engine
com.unity.2d.entities
com.unity.ai.planner
com.unity.aovrecorder
com.unity.assetbundlebrowser
com.unity.assetgraph
com.unity.barracuda
com.unity.barracuda.burst
com.unity.build-report-inspector
com.unity.cloud.userreporting
com.unity.collections
com.unity.connect.share
com.unity.dots.editor
com.unity.entities
com.unity.film-tv.toolbox
com.unity.google.resonance.audio
com.unity.immediate-window
com.unity.mathematics
com.unity.meshsync
com.unity.multiplayer-hlapi
com.unity.package-manager-doctools
com.unity.package-manager-ui
com.unity.package-validation-suite
com.unity.physics
com.unity.platforms
com.unity.platforms.android
com.unity.platforms.linux
com.unity.platforms.macos
com.unity.platforms.web
com.unity.platforms.windows
com.unity.playablegraph-visualizer
com.unity.render-pipelines.lightweight
com.unity.rendering.hybrid
com.unity.renderstreaming
com.unity.scene-template
com.unity.simulation.client
com.unity.simulation.core
com.unity.simulation.capture
com.unity.simulation.games
com.unity.standardevents
com.unity.streaming-image-sequence
com.unity.test-framework.performance
com.unity.tiny.all
com.unity.transport
com.unity.upm.develop
com.unity.vectorgraphics
com.unity.webrtc
com.unity.xr.googlevr.android
com.unity.xr.googlevr.ios
com.unity.xr.legacyinputhelpers
com.unity.xr.oculus.android
com.unity.xr.oculus.standalone
com.unity.xr.openvr.standalone
com.unity.xr.arsubsystems
com.unity.xr.interactionsubsystems
com.unity.xr.windowsmr.metro
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;참고&quot;&gt;참고&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://forum.unity.com/threads/visibility-changes-for-preview-packages-in-2020-1.910880/&quot;&gt;유니티 포럼&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.unity3d.com/2020/06/24/package-manager-updates-in-unity-2020-1/?_ga=2.39137891.1712226532.1597047198-798482210.1595986036&quot;&gt;유니티 블로그&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">Introducing Hydejack 9</title><link href="https://unity3dstudy.com/example/2020-07-03-introducing-hydejack-9/" rel="alternate" type="text/html" title="Introducing Hydejack 9" /><published>2020-07-03T00:00:00+00:00</published><updated>2020-07-03T00:00:00+00:00</updated><id>https://unity3dstudy.com/example/introducing-hydejack-9</id><content type="html" xml:base="https://unity3dstudy.com/example/2020-07-03-introducing-hydejack-9/">&lt;p class=&quot;lead&quot;&gt;Version 9 is the most complete version of Hydejack yet.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;#linking-in-style&quot;&gt;Modernized&lt;/a&gt; &lt;a href=&quot;#whats-in-the-cards&quot;&gt;design&lt;/a&gt;, &lt;a href=&quot;#ready-for-the-big-screen&quot;&gt;big headlines&lt;/a&gt;, big new features: &lt;a href=&quot;#built-in-search&quot;&gt;Built-In Search&lt;/a&gt;, &lt;a href=&quot;#sticky-table-of-contents&quot;&gt;Sticky Table of Contents&lt;/a&gt;, and &lt;a href=&quot;#auto-hiding-navbar&quot;&gt;Auto-Hiding Navbar&lt;/a&gt;. That &lt;a href=&quot;#and-much-more&quot;&gt;and more&lt;/a&gt; is Hydejack 9.&lt;/p&gt;

&lt;ul class=&quot;large-only&quot; id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#linking-in-style&quot; id=&quot;markdown-toc-linking-in-style&quot;&gt;Linking in Style&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ready-for-the-big-screen&quot; id=&quot;markdown-toc-ready-for-the-big-screen&quot;&gt;Ready for the Big Screen&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#whats-in-the-cards&quot; id=&quot;markdown-toc-whats-in-the-cards&quot;&gt;What’s in the Cards?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#built-in-search&quot; id=&quot;markdown-toc-built-in-search&quot;&gt;Built-In Search&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#auto-hiding-navbar&quot; id=&quot;markdown-toc-auto-hiding-navbar&quot;&gt;Auto-Hiding Navbar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sticky-table-of-contents&quot; id=&quot;markdown-toc-sticky-table-of-contents&quot;&gt;Sticky Table of Contents&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#and-much-more&quot; id=&quot;markdown-toc-and-much-more&quot;&gt;…and much more&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#even-more-to-come&quot; id=&quot;markdown-toc-even-more-to-come&quot;&gt;Even More to Come&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#get-it-now&quot; id=&quot;markdown-toc-get-it-now&quot;&gt;Get It Now&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;linking-in-style&quot;&gt;Linking in Style&lt;/h2&gt;

&lt;p&gt;Ever since the introduction of Dark Mode, link styles have been a bit of an issue. Specifically, finding an accent color that worked on both light and dark backgrounds was the problem. With Hydejack 9, the &lt;a href=&quot;#linking-in-style&quot;&gt;link style&lt;/a&gt; has been revamped so that legibility is no longer tied to the choice of accent_color, giving you much more freedom in creating a unique design flavor for your site.&lt;/p&gt;

&lt;h2 id=&quot;ready-for-the-big-screen&quot;&gt;Ready for the Big Screen&lt;/h2&gt;

&lt;p&gt;The theme on which Hydejack is based was designed for a different era of the web. Hydejack has inherited many of its limitations, but over time I’ve made adjustments, such as centering the content column for better reading ergonomics.&lt;/p&gt;

&lt;p&gt;With version 9, Hydejack takes full advantage of large displays. Whether it’s design indulgences such as oversized headlines, or quality of life improvements such as a floating table of contents, Hydejack now finds use for all that extra screen real estate&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;h2 id=&quot;whats-in-the-cards&quot;&gt;What’s in the Cards?&lt;/h2&gt;

&lt;p&gt;Hydejack 9 now lets you use content cards for both projects and posts. 
The cards have been redesigned with a new hover style and drop shadows and they retain their unique transition-to-next-page animations, which now also work on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;blog&lt;/code&gt; layout. The new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grid&lt;/code&gt; layout lets you do that.&lt;/p&gt;

&lt;p&gt;Good images are key to making the most out of content cards. For that reason, a &lt;a href=&quot;/docs/basics/#adding-images&quot;&gt;chapter on images&lt;/a&gt; has been added to the documentation.&lt;/p&gt;

&lt;h2 id=&quot;built-in-search&quot;&gt;Built-In Search&lt;/h2&gt;

&lt;p&gt;Hydejack now has Built-In Search. It even works offline. I’ve been prototyping many approaches and eventually settled on a fully client-side, off-the-main thread solution that perfectly fits the use case of personal sites and shows surprisingly good results&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;The new search UI is custom made for Hydejack and shows beautiful previews of your posts and pages, right on top of your regular content.&lt;/p&gt;

&lt;p&gt;Together with the Auto-Hiding Navbar, your entire content library is now only a couple of keystrokes away.&lt;/p&gt;

&lt;h2 id=&quot;auto-hiding-navbar&quot;&gt;Auto-Hiding Navbar&lt;/h2&gt;

&lt;p&gt;A navbar that’s there when you need it, and disappears when you don’t. Simple as that.&lt;/p&gt;

&lt;h2 id=&quot;sticky-table-of-contents&quot;&gt;Sticky Table of Contents&lt;/h2&gt;

&lt;p&gt;Already a staple on so many sites on the web, this pattern is now also available in Hydejack. 
What’s unique about it is that it simply picks up the table of contents already created by kramdown’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{:toc}&lt;/code&gt; tag and transparently upgrades it to a fully dynamic version.&lt;/p&gt;

&lt;h2 id=&quot;and-much-more&quot;&gt;…and much more&lt;/h2&gt;

&lt;p&gt;Other noteworthy changes include:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Support for Jekyll 4&lt;/li&gt;
  &lt;li&gt;Choice between MathJax and KaTeX for math rendering&lt;/li&gt;
  &lt;li&gt;Use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll-include-cache&lt;/code&gt; for drastically improved page building speeds&lt;/li&gt;
  &lt;li&gt;New variables configuration file — adjust content width, sidebar width, font size, etc…&lt;/li&gt;
  &lt;li&gt;…and the option to disable grouping projects by year.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the the &lt;a href=&quot;/CHANGELOG/&quot; class=&quot;heading flip-title&quot;&gt;CHANGELOG&lt;/a&gt; for the full scope of features and improvements made in Hydejack 9.
Maybe just glance at it to confirm that it is indeed a pretty long list.&lt;/p&gt;

&lt;h2 id=&quot;even-more-to-come&quot;&gt;Even More to Come&lt;/h2&gt;

&lt;p&gt;New features for 9.1 are already lined up. Code block headers and code line highlights for even better technical blogging, as well as download buttons on the resume page for PDF, vCard, and Resume JSON are just around the corner.&lt;/p&gt;

&lt;h2 id=&quot;get-it-now&quot;&gt;Get It Now&lt;/h2&gt;
&lt;p&gt;The Free Version of Hydejack is now availabe on &lt;a href=&quot;https://rubygems.org/gems/jekyll-theme-hydejack&quot;&gt;RubyGems&lt;/a&gt;
and for the first time also on &lt;a href=&quot;https://github.com/hydecorp/hydejack/packages&quot;&gt;GitHub Packages&lt;/a&gt;. 
The source code is available on &lt;a href=&quot;https://github.com/hydecorp/hydejack&quot;&gt;GitHub&lt;/a&gt; as always.&lt;/p&gt;

&lt;p&gt;The PRO Version is scheduled to release on July 7th on Gumroad. Pre-Orders are open now:&lt;/p&gt;

&lt;div class=&quot;gumroad-product-embed&quot; data-gumroad-product-id=&quot;nuOluY&quot;&gt;&lt;a href=&quot;https://gumroad.com/l/nuOluY&quot;&gt;Loading…&lt;/a&gt;&lt;/div&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;If you are a fan of the old two-column layout, or don’t like modern design tropes such as mega headlines, Hydejack lets you revert these changes on a case-by-case basis via configuration options. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;

      &lt;p&gt;Search was mainly tested for English and German. Please let me know about issues in other languages. 
  While I’ve tried to find a multi-language solution, most showed drastically worse  results for the English base case.
  If you’re technically inclined, you can adopt the code located in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_includes/js/search-worker.js&lt;/code&gt; to your needs. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="example" /><summary type="html">Version 9 is the most complete version of Hydejack yet.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://unity3dstudy.com/assets/img/blog/jeremy-bishop@0,5x.jpg" /><media:content medium="image" url="https://unity3dstudy.com/assets/img/blog/jeremy-bishop@0,5x.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Post-Processing 소개</title><link href="https://unity3dstudy.com/unity/2020-05-28-PostProcessing/" rel="alternate" type="text/html" title="Post-Processing 소개" /><published>2020-05-28T01:53:11+00:00</published><updated>2020-05-28T01:53:11+00:00</updated><id>https://unity3dstudy.com/unity/PostProcessing</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-05-28-PostProcessing/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/postprocessing-title.png&quot; alt=&quot;&quot; width=&quot;800&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;포스트-프로세싱post-processing-이란&quot;&gt;포스트 프로세싱(Post-processing) 이란?&lt;/h3&gt;

&lt;p&gt;직역한다면 &lt;strong&gt;후처리 작업&lt;/strong&gt;이라고 말할 수 있다. 카메라가 촬영한 영상(이미지)을 스크린에 송출(출력)하기 전에 다양한 &lt;strong&gt;필터&lt;/strong&gt;와 &lt;strong&gt;효과&lt;/strong&gt;를 적용하는 기술을 말한다. 즉, 카메라로 촬영한 후에 처리한다는 의미에서 붙여진 용어라 볼 수 있으며 다음과 같은 장점과 단점을 갖는다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;비주얼 퀄리티을 획기적으로 증가 시킬 수 있다.&lt;/li&gt;
  &lt;li&gt;현실 세계의 카메라와 필름의 효과를 표현할 수 있다.&lt;/li&gt;
  &lt;li&gt;랜더링 퍼포먼스를 고려해 적절히 적용해야 한다.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;포스트-프로세싱-효과&quot;&gt;포스트 프로세싱 효과&lt;/h3&gt;

&lt;p&gt;다음은 포스트 프로세싱의 적용 전후 이미지다.&lt;/p&gt;

&lt;p class=&quot;figure&quot;&gt;&lt;img src=&quot;/assets/img/unity/postprocessing-before.jpg&quot; alt=&quot;포스트 프로세싱 적용 전&quot; class=&quot;lead&quot; /&gt;
포스트 프로세싱 적용 전 (&lt;strong&gt;before&lt;/strong&gt;)&lt;/p&gt;

&lt;p class=&quot;figure&quot;&gt;&lt;img src=&quot;/assets/img/unity/postprocessing-after.jpg&quot; alt=&quot;포스트 프로세싱 적용 후&quot; class=&quot;lead&quot; /&gt;
포스트 프로세싱 적용 후 (&lt;strong&gt;after&lt;/strong&gt;)&lt;/p&gt;

&lt;h3 id=&quot;포스트-프로세싱-패키지-설치---install&quot;&gt;포스트 프로세싱 패키지 설치 - Install&lt;/h3&gt;

&lt;p&gt;Window &amp;gt; Package Manager 메뉴를 선택하면 다음과 같이 패키지 매니저가 오픈된다. 왼쪽 상단의 선택 메뉴에서 “All”로 변경하면 목록에서 “Post Processing”을 찾을 수 있으며 “Install” 버튼을 클릭해 설치한다. 단, HRDP 또는 URP를 설치했다면 Post Processing 패키지는 같이 설치되었을 것이다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/postprocessing_install.png&quot; alt=&quot;패키지 매니저에서 Post Processing을 설치&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Post Processing의 개발 중인 기능은 다음 깃허브 주소에서 확인할 수 있다. &lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing&quot;&gt;GitHub 리포지토리&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;포스트-프로세싱-적용---quick-start&quot;&gt;포스트 프로세싱 적용 - Quick Start&lt;/h3&gt;

&lt;p&gt;포스트 프로세싱은 다음 세가지 중요한 컴포넌트로 구성된다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Post Process Layer&lt;/li&gt;
  &lt;li&gt;Post Process Volumes&lt;/li&gt;
  &lt;li&gt;Post Process Debug
&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;post-process-layer-컴포넌트&quot;&gt;Post-process Layer 컴포넌트&lt;/h3&gt;

&lt;p&gt;이 컴포넌트의 역할은 볼륨 블렌딩(Volume Blending) 기능과 포스트 프로세싱이 적용되는 레이어를 지정한다. 또한, 안티 알리아싱(Anti Aliasing) 기능도 설정할 수 있다.&lt;/p&gt;

&lt;p&gt;씬 뷰의 Main Camera를 선택한 후 Component &amp;gt; Rendering &amp;gt; Post-process Layer 컴포넌트를 추가한다.
&lt;img src=&quot;/assets/img/unity/postprocess_layer.png&quot; alt=&quot;&quot; width=&quot;500&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;volume-blending-속성&quot;&gt;Volume Blending 속성&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Trigger&lt;/strong&gt; : 이 속성은 씬 뷰의 특정 위치에 있는 Post-process Volume 컴포넌트의 영역으로 진입(근처에 도착)했을 때 그 Post-process Volume에 지정된 효과와 현재 전역적으로 영향을 미치는 효과를 서로 블렌딩(겹치는)하기 위한 게임오브젝트의 Transform 컴포넌트를 연결한다. 일반적으로는 Main Camera를 연결한다. 다만, 1인칭 시점과 같은 FPS 게임의 경우에는 Main Camera를 지정해도 무난하지만 TPS 게임의 경우 카메라는 공중에 있기 때문에 Main Camera 보다는 주인공 캐릭터의 Transform을 연결해야 한다. 
&lt;img src=&quot;/assets/img/unity/postprocessing-trigger.gif&quot; alt=&quot;Trigger 속성에 Player의 Transform을 연결&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Layer&lt;/strong&gt; : 볼륨 블렌딩을 위한 대상을 필터링하기 위한 레이어를 지정하는 것으로 최적화를 위해 반드시 별도의 User Layer를 지정해야 한다.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;anti-aliasing-속성&quot;&gt;Anti Aliasing 속성&lt;/h3&gt;

&lt;p&gt;외곽선을 부드럽게 처리하는 효과로 다음 세가지 모드를 제공한다. 각 모드에 자세한 내용은 다음 문서에서 확인할 수 있다. &lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Anti-aliasing&quot;&gt;Anti aliasing 효과&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Mode&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;특성&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Fast Approximate Anti-aliasing (FXAA)&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;속도 빠름, 낮은 퀄리티&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Subpixel Morphological Anti-aliasing (SMAA)&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;속도 느림, 높은 퀄리티&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Temporal Anti-aliasing (TAA)&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SMAA와 비슷한 속도, 더 높은 퀄리티. 일시적인 특성으로 인해 고대비 영역(High Contrast)에서 빠르게 움직이는 물체에 고스트(ghost) 현상이 발생할 수 있다.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;stop-nan-propagation-속성&quot;&gt;Stop NaN Propagation 속성&lt;/h3&gt;

&lt;p&gt;포스트 프로세싱이 적용되기 이전에 유효하지 않거나 NaN(Not a Number:숫자가 아닌 값)인 픽셀을 검정색으로 강제로 변경하는 속성이다. 따라서, 유효하지 않은 데이터로 인해 잘못된 후처리 효과 결과를 보정하는 역할을 하는 것으로 체크하는 것을 권장한다.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;post-process-volume-컴포넌트&quot;&gt;Post-process Volume 컴포넌트&lt;/h2&gt;

&lt;p&gt;로컬 또는 전역으로 적용될 다양한 후 처리 작업을 하는 컴포넌트로 별도의 게임오브젝트에 추가하는 것이 바람직하다. Post-process Volume 컴포넌트를 추가하는 방식은 다음과 같다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;빈 게임오브젝트를 생성한 후 메뉴 Component &amp;gt; Rendering &amp;gt; Post-process Volume을 선택&lt;/li&gt;
  &lt;li&gt;메뉴 GameObject &amp;gt; 3D Object &amp;gt; Post-process Volume을 선택&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;두 번째로 방식으로 생성한 Post-process Volume에는 Box Collider가 포함돼있다. 이것은 Volume Blending의 Trigger와 충돌을 판단하는데 사용된다. 또한, 포스트 프로세싱에 사용할 Layer도 Main Camera에 지정했던것과 동일하게 지정해야 한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/postprocessing-volume.png&quot; alt=&quot;&quot; width=&quot;500&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;is-global-속성&quot;&gt;Is Global 속성&lt;/h3&gt;

&lt;p&gt;이 속성을 체크하면 글로벌, 언체크하면 로컬 모드로 토글된다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;글로벌 : 전역적으로 효과가 반영&lt;/li&gt;
  &lt;li&gt;로컬 : Blend Distance 범위에 Trigger에 정의된 객체가 충돌했을 때 효과가 블렌딩 된다. 이때 Weight 속성에 따라 블렌딩되는 정도를 설정할 수 있으며, Priority 속성으로 Post-process Volume간의 우선 순위를 설정한다.(숫자가 높을 수록 우선 순위가 높다.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;효과를 추가하기 위해서는 Post-process Profile 에셋을 생성해야 한다. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;New&lt;/code&gt; 버튼을 클릭해 새로 생성하거나 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Clone&lt;/code&gt; 버튼으로 기존 프로파일을 복사할 수 있다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/postprocessing-volume-local.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;지원하는-효과&quot;&gt;지원하는 효과&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add Effect...&lt;/code&gt; 버튼을 클릭해 원하는 효과를 추가할 수 있다. 현재 지원하는 효과는 다음과 같다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Ambient-Occlusion&quot;&gt;Ambient Occlusion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Anti-aliasing&quot;&gt;Anti-aliasing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Auto-Exposure&quot;&gt;Auto Exposure&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Bloom&quot;&gt;Bloom&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Chromatic-Aberration&quot;&gt;Chromatic Aberration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Color-Grading&quot;&gt;Color Grading&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;del&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Deferred-Fog&quot;&gt;Deferred Fog&lt;/a&gt;&lt;/del&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Depth-of-Field&quot;&gt;Depth of Field&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Grain&quot;&gt;Grain&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Lens-Distortion&quot;&gt;Lens Distortion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Motion-Blur&quot;&gt;Motion Blur&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/-Screen-space-Reflections&quot;&gt;Screen-space Reflections&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/PostProcessing/wiki/Vignette&quot;&gt;Vignette&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;참고&quot;&gt;참고&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://unity3d.com/kr/how-to/set-up-post-processing-stack#para3&quot;&gt;유니티 공식 블로그&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">ML-Agent 설치 for macOS</title><link href="https://unity3dstudy.com/unity/2020-05-13-MLAgents-Installation-for-macOS/" rel="alternate" type="text/html" title="ML-Agent 설치 for macOS" /><published>2020-05-13T00:12:44+00:00</published><updated>2020-05-13T00:12:44+00:00</updated><id>https://unity3dstudy.com/unity/MLAgents-Installation-for-macOS</id><content type="html" xml:base="https://unity3dstudy.com/unity/2020-05-13-MLAgents-Installation-for-macOS/">&lt;p&gt;&lt;img src=&quot;/assets/img/unity/mlagents-title-small.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;유니티 머신러닝 에이전트(줄여서 ML-Agents)는 머신러닝, 특히 강화학습을 위한 툴킷으로 2017년에 처음 소개됐으며 정식 버전(Release 1)은 2020-04-30에 출시됐다.(2020-05-12 정식발표) 여러 베타 버전을 거치면서 사용법이 초기 버전과는 많이 변경되어 ML-Agents를 공부하는 입장에서는 상당히 곤욕스러웠다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.unity3d.com/2020/05/12/announcing-ml-agents-unity-package-v1-0/&quot;&gt;릴리즈 1의 자세한 발표내용&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!--more--&gt;
&lt;p&gt;0.10 이전과 이후 버전은 사용법이 많이 변경됐지만 좀 더 사용하기 편리하도록 개선되었다.&lt;/p&gt;

&lt;h3 id=&quot;개선사항&quot;&gt;개선사항&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;깃허브 프로젝트를 통하지 않고 패키지 매니저를 통해 설치하도록 변경됨.&lt;/li&gt;
  &lt;li&gt;브레인(Brain) 에셋을 생성하지 않는다. Learning Brain, Player Brain, Heuristic Brain을 인스펙터 뷰와 코드에서 처리하도록 변경됨.&lt;/li&gt;
  &lt;li&gt;반복적인 입력을 요구하는 인터페이스의 개선됨, 특히 Vector Action/Space Type 설정 부분에서 일일이 Input Manager와 싱크를 맞추는 작업이 없어짐.&lt;/li&gt;
  &lt;li&gt;핵심 클래스를 가상화시켜 실제 구현시 주요 메소드를 상속(override)받아 편리하게 사용할 수 있도록 개선됨.(Code Intelisense 가능)&lt;/li&gt;
  &lt;li&gt;Ray Perception Sensor 2D/3D의 방식이 스크립트 컴포넌트로 구현되어 레이(Ray)의 갯수와 방향, 오프셋(Offset)값, 컬링 마스크(Culling Mask)등을 쉽게 설정할 수 있음.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;변경사항&quot;&gt;변경사항&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;네임스페이스가 MLAgents 에서 &lt;strong&gt;Unity.MLAgents&lt;/strong&gt;로 변경됨.&lt;/li&gt;
  &lt;li&gt;Agent.Heuristic() 메소드의 파라메터가 변경됨. 결괏값을 Array로 리턴하지 않는다.&lt;/li&gt;
  &lt;li&gt;Agent 클래스의 주요 메소드인 GiveMode, Done, InitializeAgent, AgentAction, AgentReset은 삭제(Deprecated)됨&lt;/li&gt;
  &lt;li&gt;Agent.maxStep 속성명이 Agent.MaxStep으로 변경됨.&lt;/li&gt;
  &lt;li&gt;CLI에서의 --train 플래그는 삭제됨. 즉, 지정하지 않아도 기본값이 훈련(Train)이다.&lt;/li&gt;
  &lt;li&gt;기존 훈련(학습)을 연이어 훈련할 때 사용했던 --load 플래그가 --resume으로 변경됨.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/ml-agents/releases/tag/release_1&quot;&gt;자세한 릴리즈 노트&lt;/a&gt;&lt;/p&gt;

&lt;!-- ## ML-Agents 란?

ML-Agents는 강화학습에 필수적인 요소인 환경(Environment)을 유니티로 구현하고(3D 환경), 그 환경속에서 학습하는 에이전트(Agent:학습자)의 행동(Action)과 보상(Reward)를 줄 수 있도록 구현할 수 있다. 또한, 텐서플로를 사용해 학습시키기 위해 python과의 통신을 담당한다.

![](https://blogs.unity3d.com/wp-content/uploads/2017/09/image4.png) 
--&gt;

&lt;h2 id=&quot;ml-agents-환경-및-설치-과정&quot;&gt;ML-Agents 환경 및 설치 과정&lt;/h2&gt;

&lt;p&gt;맥OS에서의 설치 과정과 필수 환경은 다음과 같다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;유니티 (2018.4 or later)&lt;/li&gt;
  &lt;li&gt;파이썬 (3.6 or 3.7)&lt;/li&gt;
  &lt;li&gt;mlagents Python 패키지 설치&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Unity-Technologies/ml-agents.git&quot;&gt;ml-agents 리포지토리&lt;/a&gt; 클론&lt;/li&gt;
  &lt;li&gt;유니티 프로젝트에 &lt;del&gt;com.unity.ml-agents 패키지 설치&lt;/del&gt; 패키지 매니저에서 ML-Agent를 설치&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;초기에는 &lt;a href=&quot;https://www.anaconda.com&quot;&gt;아나콘다(Anaconda)&lt;/a&gt;를 활용해 개발환경을 설정하는 예제나 자료가 많았지만 필자는 권장하지 않는다. 정식 배포판부터 아나콘다의 공식 지원이 중단됐다(deprecated).&lt;/p&gt;

&lt;h2 id=&quot;mlagents-파이썬-패키지-설치&quot;&gt;mlagents 파이썬 패키지 설치&lt;/h2&gt;

&lt;p&gt;ML-Agents 파이썬 패키지 설치는 파이썬이 설치되지 않았다면 다음 6개 단계를 거친다. (&lt;a href=&quot;https://unity3dstudy.com/2020/08/20/MLAgents-Installation-for-WinOS/&quot;&gt;윈도우OS 설치과정&lt;/a&gt;) 이 과정에서 의존성이 있는 다양한 소프트웨어들이 설치되며, 텐서플로도 같이 설치된다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python@3.8
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;nt&quot;&gt;--branch&lt;/span&gt; release_1 https://github.com/Unity-Technologies/ml-agents.git
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;ml-agents

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;setuptools &lt;span class=&quot;nt&quot;&gt;--upgrade&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; ./ml-agents-envs
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; ./ml-agnets
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;유니티-mlagents-패키지-설치mlagents-016-버전-이하&quot;&gt;유니티 mlagents 패키지 설치(MLAgents 0.16 버전 이하)&lt;/h2&gt;

&lt;p&gt;유니티 프로젝트를 생성한 후 패키지 매니저를 오픈한다. 왼쪽 상단의 [+] 버튼을 선택한 후 ‘Add package from disk…‘를 클릭한다. 팝업된 다이얼로그 창에서 ml-agents/com.unity.ml-agents 폴더안에 있는 package.json 파일을 선택하면 ml-agents 패키지가 설치된다. &lt;del&gt;추후 패키지 매니저에 정식으로 등록될 것으로 예상된다.&lt;/del&gt; 패키지 매니저에 ML-Agents 패키지가 추가됐다.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt; &lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;img src=&quot;https://github.com/Unity-Technologies/ml-agents/raw/master/docs/images/unity_package_manager_window.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td&gt;&lt;img src=&quot;https://github.com/Unity-Technologies/ml-agents/raw/master/docs/images/unity_package_json.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;유니티-mlagents-패키지-설치mlagents-10-버전-이상&quot;&gt;유니티 mlagents 패키지 설치(MLAgents 1.0 버전 이상)&lt;/h2&gt;

&lt;p&gt;1.0 버전부터는 유니티 패키지 매니저에서 직접 설치할 수 있다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/unity/img_mlagents.png&quot; alt=&quot;&quot; width=&quot;600&quot; /&gt;&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
    *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
    *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables    */
    /*
    var disqus_config = function () {
    this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
    this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() { // DON'T EDIT BELOW THIS LINE
    var d = document, s = d.createElement('script');
    s.src = 'https://unity3dstudy-hexo.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="unity" /><summary type="html"></summary></entry><entry><title type="html">도커(Docket) 설치 및 MSSQL 설정</title><link href="https://unity3dstudy.com/blog/docker/2020-05-10-Docker/" rel="alternate" type="text/html" title="도커(Docket) 설치 및 MSSQL 설정" /><published>2020-05-10T19:31:01+00:00</published><updated>2020-05-10T19:31:01+00:00</updated><id>https://unity3dstudy.com/blog/docker/Docker</id><content type="html" xml:base="https://unity3dstudy.com/blog/docker/2020-05-10-Docker/">&lt;p&gt;&lt;img src=&quot;/assets/img/blogs/docker_logo.png&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;도커docker-란&quot;&gt;도커(Docker) 란?&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;도커(Docker)는 리눅스의 응용 프로그램들을 소프트웨어 컨테이너 안에 배치시키는 일을 자동화하는 오픈 소스 프로젝트이다. &lt;a href=&quot;https://ko.wikipedia.org/wiki/도커_(소프트웨어)&quot;&gt;위키백과&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;도커 컨테이너는 일종의 소프트웨어를 소프트웨어의 실행에 필요한 모든 것을 포함하는 완전한 파일 시스템 안에 감싼다. 여기에는 코드, 런타임, 시스템 도구, 시스템 라이브러리 등 서버에 설치되는 무엇이든 아우른다. 이는 실행 중인 환경에 관계 없이 언제나 동일하게 실행될 것을 보증한다. &lt;a href=&quot;https://www.docker.com/resources/what-container&quot;&gt;도커 홈페이지&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;도커의-구조&quot;&gt;도커의 구조&lt;/h3&gt;

&lt;p&gt;도커(Docker)는 VirtualBox 또는 VMWare와 같은 일종의 가상머신(VMs)의 개념과 비슷하다. 하지만 기존의 가상머신은 게스트OS를 설치한 후 사용하는 방식이라 설치 시간도 많이 소모되며 별도의 운영체제를 구동하기 때문에 쾌적한 성능을 기대하기 어렵다. 반대로 도커는 게스트OS를 설치하지 않고 호스트OS의 자원을 적절히 공유해 사용하기 때문에 쾌적한 성능을 보인다.&lt;/p&gt;

&lt;p class=&quot;figure&quot;&gt;&lt;img src=&quot;/assets/img/blogs/docker_concept.png&quot; alt=&quot;도커 개념도&quot; /&gt;
출처: &lt;a href=&quot;https://www.docker.com/resources/what-container/&quot;&gt;https://www.docker.com/resources/what-container/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;도커-설치&quot;&gt;도커 설치&lt;/h3&gt;

&lt;p&gt;homebrew를 사용해 설치하면 Docker와 &lt;a href=&quot;https://www.docker.com/products/docker-desktop&quot;&gt;Docker Desktop on Mac&lt;/a&gt;(docker-compose, docker-machine)이 같이 설치되기 때문에 편리하다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cask&lt;/span&gt; docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;설치 후 Application 폴더에 Docker 아이콘이 생성되며 터미널에서 다음과 같이 버전을 확인할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:21:11 2020
 OS/Arch:           darwin/amd64
 Experimental:      &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;도커의-주요-명령어&quot;&gt;도커의 주요 명령어&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;기능&lt;/th&gt;
      &lt;th&gt;명령어&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;버전 확인&lt;/td&gt;
      &lt;td&gt;$ docker -v&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;이미지 다운로드&lt;/td&gt;
      &lt;td&gt;$ docker pull [이미지 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;다운로드된 이미지 목록&lt;/td&gt;
      &lt;td&gt;$ docker images&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;이미지 삭제&lt;/td&gt;
      &lt;td&gt;$ docker rmi [이미지 id]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 생성&lt;/td&gt;
      &lt;td&gt;$ docker create [옵션] [이미지 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 생성 및 실행&lt;/td&gt;
      &lt;td&gt;$ docker run [옵션] [이미지 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 실행&lt;/td&gt;
      &lt;td&gt;$ docker start [컨테이너 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 재실행&lt;/td&gt;
      &lt;td&gt;$ docker restart [컨테이너 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 접속&lt;/td&gt;
      &lt;td&gt;$ docker attach [컨테이너 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 정지&lt;/td&gt;
      &lt;td&gt;$ docker stop [컨테이너 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;실행중인 컨테이너 목록&lt;/td&gt;
      &lt;td&gt;$ docker ps&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;정지된 컨테이너 목록&lt;/td&gt;
      &lt;td&gt;$ docker ps -a&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 명 변경&lt;/td&gt;
      &lt;td&gt;$ docker rename [기존 컨테이너 명] [새로운 컨테이너 명]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;컨테이너 삭제&lt;/td&gt;
      &lt;td&gt;$ docker rm [컨테이너 명 or 컨테이너 id]&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;도커를-활용한-mssql-설치-for-macos&quot;&gt;도커를 활용한 MSSQL 설치 for MacOS&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;마이크로소프트 MSSQL 설치 가이드&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/ko-kr/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&amp;amp;pivots=cs1-bash&quot;&gt;https://docs.microsoft.com/ko-kr/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&amp;amp;pivots=cs1-bash&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Docker 이미지 설치 및 설정
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker search mssql
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker pull microsoft/mssql-server-linux
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;MSSQL용 컨테이너를 생성하고 실행한다.
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ACCEPT_EULA=Y'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'SA_PASSWORD=sa123456!'&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1433:1433 &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; mssql_server &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; microsoft/mssql-server-linux
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;azure-data-studio-설치&quot;&gt;Azure Data Studio 설치&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/blogs/logo_azure_data_studio.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/ko-kr/sql/azure-data-studio/what-is?view=sql-server-ver15&quot;&gt;Azure Data Studio 소개 문서&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Azure Data Studio는 DB Client로 Windows, Mac, Linux에서 무료로 사용할 수 있다. Homebrew를 이용해 다음과 같이 설치한다.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew search azuredatastudio
&lt;span class=&quot;o&quot;&gt;==&amp;gt;&lt;/span&gt; Casks
azure-data-studio

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cask&lt;/span&gt; azure-data-studio
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;vscode에서-확장팩을-사용해-mssql에-접속하기&quot;&gt;VSCode에서 확장팩을 사용해 MSSQL에 접속하기&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;VSCode의 Extentions에서 MSSQL로 검색한 후 “SQL Server(mssql)”을 설치한다.
&lt;img src=&quot;/assets/img/blogs/docker_sql_server_extension.png&quot; alt=&quot;VSCode용 확장팩&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/ko-kr/sql/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver15&quot;&gt;Microsoft 관련자료&lt;/a&gt;
&lt;img src=&quot;https://github.com/Microsoft/vscode-mssql/raw/master/images/mssql-demo.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;DB 접속후 테이블을 검색한 예시화면
&lt;img src=&quot;/assets/img/blogs/img_vscode_mssql.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;참고-블로그&quot;&gt;참고 블로그&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/ko-kr/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&amp;amp;pivots=cs1-bash&quot;&gt;MSDN&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://hyesunzzang.tistory.com/91&quot;&gt;devssun님 블로그(https://hyesunzzang.tistory.com/91)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://dc7303.github.io/docker/2019/11/24/dockerInstallForMac/&quot;&gt;Mark님 블로그(https://dc7303.github.io/docker/2019/11/24/dockerInstallForMac/)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.44bits.io/ko/post/easy-deploy-with-docker&quot;&gt;44BITS(https://www.44bits.io/ko/post/easy-deploy-with-docker)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://medium.com/@reverentgeek/sql-server-running-on-a-mac-3efafda48861&quot;&gt;https://medium.com/@reverentgeek/sql-server-running-on-a-mac-3efafda48861&lt;/a&gt;&lt;/p&gt;</content><author><name>JeaHyun Lee</name><email>myleje@gmail.com</email></author><category term="blog" /><category term="Docker" /><summary type="html"></summary></entry></feed>