クラス

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"


UCLASS(BlueprintType)	//BP変数として使える
class TESTLIB_API AMyActor : public AActor
{
	GENERATED_BODY()	//定義の先頭に必ず必要
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};
#include "MyActor.h"

// Sets default values
AMyActor::AMyActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void AMyActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

プロパティ

// [property]
UPROPERTY(BlueprintReadWrite, Category = "My Lib")
int32 IntProp;

FUNCTION

// [function]
//class method -> static
UFUNCTION(BlueprintCallable, Category = "My Lib")
    static float DelayOfSound(const float dist);

//instance method
UFUNCTION(BlueprintCallable, Category = "My Lib")
    void SetVelocity(const float velocity);

UFUNCTION(BlueprintCallable, Category = "My Lib")
    float Delay(const float dist) const;

UFUNCTION(BlueprintCallable, Category = "My Lib")
    float MyFunc(const float in_val);

callback C++-> Blueprint

// [callback] C++ -> Blueprint
//
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FZeroInputDelegate);
UPROPERTY(BlueprintAssignable, Category = "My Lib")
	FZeroInputDelegate TheZeroInputDelegate;

DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FTwoInputsDelegate, float, FloatVal, int32, IntVal);
UPROPERTY(BlueprintAssignable, Category = "My Lib")
		FTwoInputsDelegate TheTwoInputsDelegate;

UFUNCTION(BlueprintCallable, Category = "My Lib")
		void startTimer(int32 sleep);

Event Blueprint -> C++

//[BP Event] Blueprint -> C++ 
	//c++で実装なし
	UFUNCTION(BlueprintImplementableEvent, Category = "My Lib")
		void TestEvent(const float fValue);

	//c++で実装あり
	UFUNCTION(BlueprintNativeEvent, Category = "UE C++ book")
		void VectorInputEvent(const FVector& VecValue);

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です