UE5 获取GPU驱动版本号

本文指导如何在UnrealEngine4(UE4)项目中创建C++蓝图函数库,用于获取GPU驱动版本。首先在.Build.cs文件中添加RHI模块依赖,然后创建自定义蓝图函数库,定义一个获取GPU驱动版本的静态函数。在关卡蓝图中调用此函数并在BeginPlay事件中使用,以便在游戏运行时查看GPU驱动信息。
摘要由CSDN通过智能技术生成

目录

1.添加依赖

2.新建C++蓝图函数库

3. 添加函数 

4. 调用函数

5. 查看输出信息


1.添加依赖

在项目.Build.cs文件中添加 RHI  模块

PublicDependencyModuleNames.AddRange(new string[] { 
			"Core", 
			"CoreUObject", 
			"Engine", 
			"RHI",
		});

2.新建C++蓝图函数库

名字可以自定义, 我的叫 CustomBlueprintFuntionLibrary

3. 添加函数 

.h

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

#pragma once

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

/**
 * 
 */
UCLASS()
class SCIENCEANDGOLDCITY_API UCustomBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
public:
	UFUNCTION(BlueprintCallable)
	static FString GetGPUDriverVersion();

}

.cpp

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


#include "CustomBlueprintFunctionLibrary.h"
#include "GenericPlatform/GenericPlatformDriver.h"

FString UCustomBlueprintFunctionLibrary::GetGPUDriverVersion()
{
	FGPUDriverInfo GPUDriverInfo = FPlatformMisc::GetGPUDriverInfo(GRHIAdapterName);
	
	return GPUDriverInfo.InternalDriverVersion;
}

4. 调用函数

打开关卡蓝图,在BeginPlay处调用刚写的函数,也可以在return处加断点查看详细信息。

5. 查看输出信息

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值