求助:关于Component类的一个问题

[复制链接]
查看3401 | 回复6 | 2017-10-12 09:49:54 | 显示全部楼层 |阅读模式
新人小白第一次发帖,按照官方文档教程https://docs.unrealengine.com/la ... onents/1/index.html做的,报“USphereComponent”: 未声明的标识符,求各位大神指点一下。


Nick | 2017-10-12 16:22:07 | 显示全部楼层
贴下完整的代码 这样看不出来的
回复 支持 反对

使用道具 举报

aa8947 | 2017-10-12 17:43:29 | 显示全部楼层
Nick 发表于 2017-10-12 16:22
贴下完整的代码 这样看不出来的

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

#include "CollidingPawn.h"


// Sets default values
ACollidingPawn::ACollidingPawn()
{
        // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
        PrimaryActorTick.bCanEverTick = true;
        USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"))
}

// Called when the game starts or when spawned
void ACollidingPawn::BeginPlay()
{
        Super::BeginPlay();
       
}

// Called every frame
void ACollidingPawn::Tick(float DeltaTime)
{
        Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void ACollidingPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
        Super::SetupPlayerInputComponent(PlayerInputComponent);

}

回复 支持 反对

使用道具 举报

pdsmgyg | 2017-10-13 11:35:27 | 显示全部楼层

回帖奖励 +2 枚能量币

aa8947 发表于 2017-10-12 17:43
// Fill out your copyright notice in the Description page of Project Settings.

#include "Collidin ...

加下头文件 Engine.h,我也遇到过,貌似4.16就开始有这个问题了。不知道是不是官方改东西了
回复 支持 反对

使用道具 举报

aa8947 | 2017-10-13 13:01:53 | 显示全部楼层
pdsmgyg 发表于 2017-10-13 11:35
加下头文件 Engine.h,我也遇到过,貌似4.16就开始有这个问题了。不知道是不是官方改东西了 ...

好的,多谢,我试一下
回复 支持 反对

使用道具 举报

aa8947 | 2017-10-14 08:51:37 | 显示全部楼层
aa8947 发表于 2017-10-13 13:01
好的,多谢,我试一下

十分感谢,真的可以了
回复 支持 反对

使用道具 举报

sgs1236 | 2017-12-6 12:44:52 | 显示全部楼层
在头文件中加载下USphereComponent的头文件就可以了,用那个加那个
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

47

主题

155

回帖

622

积分

初阶编码师

积分
622