【python】UnrealEngine5のPythonでパッケージのパスを特定してみた【UE5】(7)

Unreal Engine 5

はじめに

UnrealEngine5のPythonで自作のパッケージを追加するため,パッケージのパスが通っている場所を特定してみます.

環境

  • Unreal Engine 5.0.3
  • Windows11
  • Editor Utility Widgetsを実行できる環境が必要です(下記の記事の環境からやっていきます)
【python】UnrealEngine5のPythonで自作関数で引数を返り値を設定してみた【UE5】
UnrealEngine5のPythonで自作関数を作成し,引数と返り値の設定して簡易的な計算をやってみます.

パッケージのパスの特定

Pythonスクリプト

下記のスクリプトをExecute Python Scriptに貼り付けます.

import sys

for path in sys.path:
    #############################################
    # print path
    #
    print(path)

    #############################################
    # print local path
    #
    if 'Tanya' in path : 
        print("tanya dir")
        print(path)

file

最終的にはこんな感じになります.

実行結果

実行結果はこちら,UE5Engine内には結構パスが通っています.ここから,ローカルのプロジェクトフォルダ内に通っているフォルダを見つけます.

PIE: サーバーにログインしました
PIE: PIE合計開始時間 0.545 秒。
LogCharacterMovement: Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 0.095024 > MaxSimulationTimeStep (0.050) for 'BP_ThirdPersonCharacter_C_0', movement 'Walking'
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\python39.zip
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\DLLs
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Content\Python\Lib\site-packages
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\Win64\site-packages
LogPython: tanya dir
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\Win64\site-packages
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\site-packages
LogPython: tanya dir
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Bridge\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Bridge\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\JsonBlueprintUtilities\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\JsonBlueprintUtilities\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\2D\Paper2D\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\2D\Paper2D\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Enterprise\DatasmithContent\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Enterprise\DatasmithContent\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Developer\AnimationSharing\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Developer\AnimationSharing\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\FX\Niagara\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\FX\Niagara\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\GeometryMode\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\GeometryMode\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\SpeedTreeImporter\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\SpeedTreeImporter\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\ModelingToolsEditorMode\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Editor\ModelingToolsEditorMode\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\ControlRigSpline\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\ControlRigSpline\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\IKRig\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\IKRig\Content\Python\Lib\site-packages
LogPython: D:/Program Files/Epic Games/UE_5.0/Engine/Plugins/Animation/ControlRig/Content/Python
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\ControlRig\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Animation\ControlRig\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosClothEditor\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosClothEditor\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosSolverPlugin\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosSolverPlugin\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosNiagara\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\ChaosNiagara\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\FullBodyIK\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\FullBodyIK\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Media\MediaCompositing\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Media\MediaCompositing\Content\Python\Lib\site-packages
LogPython: D:/Program Files/Epic Games/UE_5.0/Engine/Plugins/MovieScene/SequencerScripting/Content/Python
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\MovieScene\SequencerScripting\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\MovieScene\SequencerScripting\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\GeometryFlow\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\GeometryFlow\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\GeometryCollectionPlugin\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\GeometryCollectionPlugin\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\MeshModelingToolsetExp\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\MeshModelingToolsetExp\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\MeshLODToolset\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\MeshLODToolset\Content\Python\Lib\site-packages
LogPython: D:/Program Files/Epic Games/UE_5.0/Engine/Plugins/Experimental/PythonScriptPlugin/Content/Python
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\PythonScriptPlugin\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Experimental\PythonScriptPlugin\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\AudioSynesthesia\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\AudioSynesthesia\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\GeometryProcessing\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\GeometryProcessing\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\HairStrands\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\HairStrands\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\MeshModelingToolset\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\MeshModelingToolset\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\ResonanceAudio\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\ResonanceAudio\Content\Python\Lib\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\Synthesis\Content\Python\Lib\Win64\site-packages
LogPython: D:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Runtime\Synthesis\Content\Python\Lib\site-packages

この2つのパスがローカルのプロジェクトフォルダに通っているパスです.

LogPython: tanya dir
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\Win64\site-packages
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\site-packages
LogPython: tanya dir
LogPython: D:\Local_Project\1002_UE5\1002_11_Tanya_of_Air\TanyaOfAir_v3\Content\Python\Lib\site-packages

Python\Lib\Win64\site-packagesPython\Lib\site-packagesにパスが通っているようです.

結論

UnrealEngine5のPythonで自作のパッケージを追加するため,パッケージのパスが通っている場所を特定してみました.その結果,Python\Lib\Win64\site-packagesPython\Lib\site-packagesにパスが通っているようです.次回は,ここに自作のパッケージを追加していきます.

参考文献

【python】UnrealEngine5のEditor Utility Widgetを使ってpythonを使ってみる~Hello world~【UE5】
UnrealEngine5でpythonを使っていきます.PluginはPython Editor Script Pluginを使っていきます(私の場合は最初から入っていました).その結果,無事にHello worldまでいけました.
【python】UnrealEngine5のpythonでpipを使ってみる~Numpyのインストール~【UE5】
概要UnrealEngine5でpythonのpipを使っていきます.その結果無事にpipを使ってnumpyを入れてnumpyの関数を使うことができました.はじめに記事の背景最近,UnrealEngine5でPythonを使っ...
【python】UnrealEngine5のPythonでCSVを出力してみる【UE5】
UnrealEngine5のPythonでCSVを出力してみます.

コメント

タイトルとURLをコピーしました