4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Unity 2020.3.20f1 で Python for Unity をインストールする方法

Posted at

はじめに

この記事では、Unity 2020.3.20f1 に Python for Unity をインストールする方法を紹介します。

インストール環境

  • Unity(Unity Hubを使用。Unity本体のバージョンは2020.3.20f1)
  • macbook pro

手順

Python for Unity のインストール

まず、新規にUnity Projectを作成します(説明は省略)

次に、作成したUnity Projectの中で、Edit > Project Settings > Package Manager > Advanced Settings から "Enable Preview packages" にチェックを入れます。(下画面赤枠参照)
Fig1.png

manifest.json の編集

次に、Unity Project のディレクトリ > Packages > manifest.json を開き、以下の行を追記して保存します。開く際のエディタは、今回はVSCodeを使用しました。

"com.unity.scripting.python": "4.0.0-pre-1"

注)追記する際には、前の行の後に","をつけることを忘れない
Fig2.png

Package Manager でパッケージをインストール:

  1. Window > Package manager を開き、プルダウンから "Packages: Unity Registry" を選択します。
  2. Package Manager ウィンドウの下部にある更新マーク横のプルダウンを開き、 "Reflesh list" ボタンをクリックします。
  3. インストール可能なパッケージ一覧が表示されるので、"Scripting Python" を探します。バージョンを選択してインストールします
    1. 今回は 7.0.0 を選択
    2. Unity のバージョンに応じて対応可能なバージョンが異なることに注意してください。
  4. Update to 7.0.0を押す

Fig3.png

以上で終了です。うまくいった場合、Unityのコンソールログに「Python installed successfully」と表示されるかと思います。

おわりに

これで、Unity 2020.3.20f1 に Python for Unity がインストールされました。今後は実際にPython を使い、Unity プロジェクトを開発していきたいと思います。

参考リンク

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?