UE 用C++ 扩展FunctionLibrary 蓝图以供全局函数使用

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBPCallFunction.generated.h"



DEFINE_LOG_CATEGORY_STATIC(myLog, Log, All);
//UE_LOG(myLog,Log,TEXT("name = %s"),*customName);


/**
 * 
 */

UCLASS()
class CREATEBPLINKLIB_API UMyBPCallFunction : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()


public:
	UFUNCTION(BlueprintCallable,Category="Custom|myfun")
	static void GetCustomName(FString& myName);
	
	/*
	abc
	*/
	UFUNCTION(BlueprintCallable,Category="Custom|myfun")
	static void SetCustomName(FString setName,FString& custom);
};

  

// Fill out your copyright notice in the Description page of Project Settings.

#include "Public/MyBPCallFunction.h"

void UMyBPCallFunction::GetCustomName(FString& myName)
{
	myName = "hello!";
}


void UMyBPCallFunction::SetCustomName(FString setName,FString& customName)
{
	//customName = setName;
	customName = setName.Append("abc");	
	UE_LOG(myLog,Log,TEXT("name = %s"),*customName);
}

  

猜你喜欢

转载自www.cnblogs.com/mayichen0823/p/10401021.html
今日推荐