当前位置:网站首页>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();
}
}
边栏推荐
- 【LeetCode】235.二叉搜索树的最近公共祖先
- TRACE32——通用寄存器查看与修改
- Re regular expressions
- 工作3年,回想刚入门和现在的今昔对比,笑谈一下自己的测试生涯
- 360度反馈调查表中的问题示范
- RNote108---Display the running progress of the R program
- Invalid operator for data type.The operator is add and the type is text.
- typescript66-分析partial的实现
- Vulnhub靶机:HA_ NARAK
- typescript61-泛型工具类型(pick)
猜你喜欢
随机推荐
Hong Kong International Jewellery Show and Hong Kong International Diamond, Gem and Pearl Show kick off
Shiny04---Application of DT and progress bar in shiny
今天虚竹哥又发现了一款好用的国产化API工具
The NDK compiler so libraries
基于KECA-IGWO-KELM的间歇过程故障诊断方法
1、Citrix XenDesktop 2203之AD域系统安装(一)
FPGA parsing B code----serial 4
Week 8 Document Clustering(文本聚类)
MySQL: JDBC programming
栈与队列的基本介绍和创建、销毁、出入、计算元素数量、查看元素等功能的c语言实现,以及栈的压入、弹出序列判断,栈结构的链式表示与实现
蓝牙gap协议
typescript60-泛型工具类型(readonly)
Flink Learning 11: Flink Program Parallelism
C# FileSystemWatcher
不能比较或排序 text、ntext 和 image 数据类型
Cannot compare or sort text, ntext, and image data types
给网站套上Cloudflare(以腾讯云为例)
TRACE32——C源码关联1
2022熔化焊接与热切割操作证考试题及模拟考试
TCP的粘包拆包问题+解决方案