当前位置:网站首页>U++ 创建UI
U++ 创建UI
2022-08-05 06:50:00 【是秃头的兔子呀】
.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "MyHUD.generated.h"
/**
*
*/
UCLASS()
class FLOATINGCUBE_API AMyHUD : public AHUD
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
AMyHUD();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<UUserWidget> userWidget;
UPROPERTY()
UUserWidget* refWidget;
};
.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyHUD.h"
#include "Blueprint/UserWidget.h"
AMyHUD::AMyHUD() {
}
void AMyHUD::BeginPlay() {
refWidget = CreateWidget<UUserWidget>(GetWorld(), userWidget);
if (refWidget != nullptr) {
refWidget->AddToViewport();
}
}
边栏推荐
猜你喜欢
Put Cloudflare on the website (take Tencent Cloud as an example)
Redis
TRACE32——通用寄存器查看与修改
Flink学习10:使用idea编写WordCount,并打包运行
typescript64-映射类型
AI + video technology helps to ensure campus security, how to build a campus intelligent security platform?
RNote108---显示R程序的运行进度
MySQL:order by排序查询,group by分组查询
日本卫生设备行业协会:日本温水喷淋马桶座出货量达1亿套
typescript66-分析partial的实现
随机推荐
MySQL: order by sorting query, group by grouping query
2022起重机司机(限桥式起重机)考试题库及模拟考试
Takeda Fiscal 2022 First Quarter Results Strong; On Track to Achieve Full-Year Management Guidance
Technical Analysis Mode (7) Playing the Gap
环网冗余式CAN/光纤转换器 CAN总线转光纤转换器中继集线器hub光端机
PCI Pharma Services Announces Multi-Million Dollar Expansion of UK Manufacturing Facility to Meet Growing Demand for Global High Potency Drug Manufacturing Services to Support Oncology Treatment
Summary of Text Characterization Methods
2022熔化焊接与热切割操作证考试题及模拟考试
Hash 这些知识你也应该知道
typescript61-泛型工具类型(pick)
typescript60-泛型工具类型(readonly)
"Automatic Data Collection Based on R Language"--Chapter 3 XML and JSON
IO进程线程->进程间的通信->day7
Mysql主从延迟的原因和解决方案
【Dynamic type detection Objective-C】
腾讯实习总结
After working for 3 years, I recalled the comparison between the past and the present when I first started, and joked about my testing career
MySQL:基础部分
[instancetype type Objective-C]
访问被拒绝:“microsoft.web.ui.webcontrols”的解决办法