UN4 C++接入和蓝图的输出

1.蓝图输出控制

2.c++输出

2.1Repor.cpp

#include "Reporter.h"

// Sets default values for this component's properties
UReporter::UReporter()
{
    // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
    // off to improve performance if you don't need them.
    PrimaryComponentTick.bCanEverTick = true;

    // ...
}


// Called when the game starts
void UReporter::BeginPlay()
{
    Super::BeginPlay();
    //获得actor指针//GetOwner()返回值是指针
    AActor *Owner = GetOwner();
    //.h文件#include "GameFramework/Actor.h"
    FString Name= Owner->GetName();//名字
    FVector Location= Owner->GetActorLocation();//位置
    UE_LOG(LogTemp,Warning,TEXT("Name:%s  Location:%s"),*Name,*Location.ToString ());//输出

    FRotator    NewRotation = FRotator(0.0F, 90.0F, 0.0F);

    Owner->SetActorRotation(NewRotation);//旋转90度

}


// Called every frame
void UReporter::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // ...
}

2.2Reporter.h

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameFramework/Actor.h"
#include "Reporter.generated.h"

//报错1.uclass在第十行 2.编译保存,developmontEider>developmnet>保存一下

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class RADARSYSTEM_API UReporter : public UActorComponent
{
    GENERATED_BODY()

public:    
    // Sets default values for this component's properties
    UReporter();

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

public:    
    // Called every frame
    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

        
};

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]中的示例代码展示了如何使用C++的set容器来存储一组元素,并按照排序顺序输出。set容器是一个有序的容器,它会自动根据元素的值进行排序。插入、删除和查找元素的时间复杂度是常量的,除非发生rehashing操作,这可能会导致线性复杂度。\[2\] 引用\[2\]中的示例代码展示了如何使用C++的unordered_set容器来存储一组元素,并按照无序的方式输出。unordered_set容器是一个无序的容器,它使用哈希函数来确定元素的存储位置。插入、删除和查找元素的时间复杂度是常量的,不受rehashing操作的影响。\[2\] 引用\[3\]中的示例代码展示了如何使用C++的unordered_set容器来存储vector<int>类型的元素,并自定义哈希函数。在这个示例中,我们定义了一个特化的hash结构体,用于计算vector<int>类型的哈希值。然后我们可以像使用普通的unordered_set一样使用这个特化的unordered_set容器。\[3\] 综上所述,C++中的set和unordered_set容器都可以用来存储一组元素,但set容器会按照排序顺序进行存储,而unordered_set容器则是无序的。插入、删除和查找元素的时间复杂度在两种容器中都是常量的,但set容器可能会受到rehashing操作的影响。如果需要自定义哈希函数来存储特定类型的元素,可以使用特化的unordered_set容器。 #### 引用[.reference_title] - *1* *2* [c++中set和unordered_set的区别](https://blog.csdn.net/qq_45662588/article/details/121785943)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [c++ set unordered_set区别](https://blog.csdn.net/haluoluo211/article/details/82468061)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值