
UCLASS
Blueprintable 可创建蓝图BlueprintType 可作为蓝图变量NotBlueprintType 不可作为蓝图变量UPROPERTY
EditAnywhere 蓝图类和实例可编辑 EditDefaultsOnly 蓝图类可编辑EditInstanceOnly 实例可编辑BlueprintReadWrite 蓝图类可读可写get/set BlueprintReadOnly 蓝图类可读getBlueprintWriteOnly 蓝图类可写setUFUNCTION
BlueprintImplementableEvent:由蓝图实现。
UFUNCTION(BlueprintImplementableEvent)
void Jump();
BlueprintNativeEvent:c++实现默认功能,蓝图重写后调用蓝图的功能。
UFUNCTION(BlueprintNativeEvent)
void OnOverlap(AActor* OverlappedActor, AActor* OtherActor);
//绑定
OnActorBeginOverlap.AddDynamic(this, &ABaseCoin::OnOverlap);
void ABaseCoin::OnOverlap_Implementation(AActor* OverlappedActor, AActor* OtherActor) {if (Cast<ABasePlayer>(OtherActor) != nullptr){Destroy();}
}
BlueprintCallable:可供蓝图调用的函数
UFUNCTION(BlueprintCallable)
void PlayCustomDeath();
创建和销毁UCLASS
UUserProfile* newobject = NewObject<UUserProfile>(GetTransientPackage(), UUserProfile::StaticClass());
if (newobject)
{ newobject->ConditionalBeginDestroy();newobject = nullptr;
}
强制内存回收
GetWorld()->ForceGarbageCollection( true );
创建结构体
USTRUCT()
struct xxx_API FColoredTexture
{GENERATED_USTRUCT_BODY()
public:UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = HUD )UTexture* Texture;UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = HUD ) FLinearColor Color;
};
创建枚举
UENUM()
enum Status
{Stopped UMETA(DisplayName = "Stopped"),Moving UMETA(DisplayName = "Moving"),Attacking UMETA(DisplayName = "Attacking"),
};
本文发布于:2024-01-28 03:01:04,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17063820744297.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
| 留言与评论(共有 0 条评论) |