コンテンツブラウザを右クリックしてNew C++ Class
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-15.png)
親クラスに Blueprint Function Libraryを選択
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-7.png)
Nameに適当にZFunctionsと入れCreate Class。
VisualStudioが起動し
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-8.png)
ZFunctions.h
public:
UFUNCTION(BlueprintCallable)
static void CalledFromPython(FString InputString);
を追加してこうなる。
//.Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "ZFunctions.generated.h"
UCLASS()
class UNREALPYTHONPROJECT_API UZFunctions : public UBlueprintFunctionLibrary
{
GENERATED BODY()
public:
UFUNCTION(BlueprintCallable)
static void CalledFromPython(FString InputString);
};
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-9.png)
ZFunctions.cpp
//.Fill out your copyright notice in the Description page of Project Settings.
#include "ZFunctions.h"
void UZFunctions::CalledFromPython(FString InputString) {
UE_LOG(LogTemp, Error, TEXT("%s"), *InputString);
}
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-10.png)
実行する。(Local Windows Debagger)
Outputlogで実行する
import unreal
for x in sorted(dir(unreal)):
print(x)
ZFunction が出る
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-11.png)
import unreal
for x in sorted(dir(unreal.ZFunctions)):
print(x)
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-12.png)
called_from_python が出てくる。
呼んでみる
unreal.ZFunctions.called_from_python('my test string')
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-14.png)
呼ばれて作ったエラーメッセージが出た
参考URL