UE4 Python呼叫c 指令碼函式

2021-09-14 05:04:28 字數 782 閱讀 7975

1 新建乙個c++工程,建立乙個testpy指令碼,父類見下圖

.**件

#pragma once

#include "coreminimal.h"

#include "kismet/blueprintfunctionlibrary.h"

#include "testpy.generated.h"

/** *

*/uclass()

class callcfrompy_api utestpy : public ublueprintfunctionlibrary;

.cpp檔案

#include "testpy.h"

void utestpy::calledfrompython(fstring inputstring)

3 依次執行以下命令

for x in sorted(dir(unreal)):

print x

能夠檢視所有的unreal的模組函式

檢視testpy的所有指出的函式:

4 執行得到想要的結果

使用VS Code編寫UE4 Python指令碼

1 啟用python editor script plugin 2 進入專案設定 外掛程式 python,開啟開發者模式 此時會在 專案目錄 intermediate pythonstub 下生成unreal.py檔案 3 為vs code安裝python外掛程式 步驟略 後,開啟settings....

UE4 Python指令碼 自動檢索資源的引用和依賴

ue官方 python api 官方文件 輸出資源引用到的資源或者依賴的資源 註冊乙個asset print asset reg.get referencers game unreal.assetregistrydependencyoptions true true 輸出引用者 print asse...

講述C 中呼叫Python指令碼

c 中呼叫python指令碼的意義就不講了,至少你可以把它當成文字形式的動態鏈結庫,需要的時候還可以改一改,只要不改變介面,c 的程式一旦編譯好了,再改就沒那麼方便了 先看python的 test function def add a,b print in python function add p...