大家好,感谢你们检查我的问题,
我正在学习UE4.25和c++的虚幻引擎的教程。我目前被代码的静态网格部分卡住了。由于某些原因,我似乎无法访问所需的头文件,不仅是组件,而且是像Engine这样的任何主要文件夹。
当我输入#include“”时,只有松散的头文件弹出,没有一个是我需要的(图片不会发布,所以我会发布相关的代码)。
这是.h文件中的内容:
#杂注一次
#include "CoreMinimal.h“#include "GameFramework/Actor.h”#include "Bullet.generated.h“
UCLASS()
class MYPROJECT_API ABullet : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABullet();
UPROPERTY(EditAnywhere, Category = "Components")
class UStaticMeshComponent* BulletMesh;
}这是来自.cpp
#include "Bullet.h"
//Components/StaticMeshComponent.h should go here but it doesn't show with the #include for some reason
// Sets default values
ABullet::ABullet()
{
// Set this actor to call Tick() every frame. You can turn this off to
// improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
BulletMesh = CreateDefaultSubobject<UStaticMeshComponent>("BulletMesh");
}发布于 2020-09-01 23:19:28
这听起来像是Visual Studio中的intellisense问题。vanilla Visual Studio需要很长时间来解析UE,我个人刚刚将其关闭,转而使用Visual Assist X。
您可以只使用#include "Components/StaticMeshComponent.h",它应该可以很好地编译。Classifier是一个很好的免费资源,可以帮助你找到所需的包含路径,并且对开始使用虚幻非常有帮助。
另一种选择是尝试Rider for Unreal而不是Visual Studio,根据我所看到的,Visual Studio为UE提供了更好的智能感知/代码助手。
https://stackoverflow.com/questions/63683096
复制相似问题