BlancではC++フォルダができなかった。
ThirdPersonでやった。
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-16.png)
親クラスに Blueprint Function Libraryを選択
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-17.png)
Nameに適当にZFunctionsと入れCreate Class。
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-18.png)
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-19-1024x562.png)
VisualStudioへ移動し
ZFunctions.h
// 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 UE542PYTHONCALLCPP1_API UZFunctions : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
//ここから追加////////
public:
UFUNCTION(BlueprintCallable)
static void CalledFromPython(FString InputString);
//ここまで追加//////
};
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);
}
//ここまで追加//////
SolutionExplorer > your Project Name (right click)>Build
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-21.png)
実行する。(Local Windows Debagger)
Outputlogで実行する unrealのクラス一覧
import unreal
for x in sorted(dir(unreal)):
print(x)
めっちゃ重い
ZFunction が出る
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-20.png)
クラスを使ってみる unreal.ZFunctionsのメソッド一覧
import unreal
for x in sorted(dir(unreal.ZFunctions)):
print(x)
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-22.png)
called_from_python が出てくる。
呼んでみる
unreal.ZFunctions.called_from_python('my test string')
![](https://furcraea.verse.jp/wp/wp-content/uploads/2024/06/image-23.png)
作った関数によりエラーのメッセージが返ってきた。
参考URL