assets = unreal.EditorUtilityLibrary.get_selected_assets()
AssetDataList = unreal.EditorUtilityLibrary.get_selected_asset_data()
for a in AssetDataList:
if a.asset_class_path.asset_name == "StaticMesh":
mesh = unreal.EditorAssetLibrary.find_asset_data(a.package_name).get_asset()
unreal.EditorStaticMeshLibrary.remove_collisions(mesh)
// 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
実行する。(Local Windows Debagger)
Outputlogで実行する unrealのクラス一覧
import unreal
for x in sorted(dir(unreal)):
print(x)
めっちゃ重い
ZFunction が出る
クラスを使ってみる unreal.ZFunctionsのメソッド一覧
import unreal
for x in sorted(dir(unreal.ZFunctions)):
print(x)
called_from_python が出てくる。
呼んでみる
unreal.ZFunctions.called_from_python('my test string')
//.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);
};
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);
}
実行する。(Local Windows Debagger)
Outputlogで実行する
import unreal
for x in sorted(dir(unreal)):
print(x)
ZFunction が出る
import unreal
for x in sorted(dir(unreal.ZFunctions)):
print(x)
called_from_python が出てくる。
呼んでみる
unreal.ZFunctions.called_from_python('my test string')
WindowsTargetRules.Compiler to VisualStudio2019. The current compiler version was detected as: 14.29.30152
Error Message
Running F:/Program Files/Epic Games/UE_5.3/Engine/Build/BatchFiles/Build.bat -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress
Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress
Log file: C:\Users\abcd\AppData\Local\UnrealBuildTool\Log_GPF.txt
Generating VisualStudio project files:
Discovering modules, targets and source code for project...
Microsoft platform targets must be compiled with Visual Studio 2022 17.4 (MSVC 14.34.x) or later for the installed engine. Please update Visual Studio 2022 and ensure no configuration is forcing WindowsTargetRules.Compiler to VisualStudio2019. The current compiler version was detected as: 14.29.30152