Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

E0513 UStaticMeshComponent

Hello, I'm just following a UE 4 tutorial from here:


and I've simply copied and pasted the code from the tutorial. Yet, there are multiple errors. I'm including the one error message that has plagued me in the past as well (with other projects).

Severity Code Description Project File Line Suppression State Error (active) E0513 a value of type "UStaticMeshComponent " cannot be assigned to an entity of type "USceneComponent " HowTo_PlayerInput e:\UnrealEnginesavedfiles\HowTo_PlayerInput\Source\HowTo_PlayerInput\MyPawn.cpp 20

Any help appreciated.

Here is the cpp file:

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

include "MyPawn.h"

// Sets default values AMyPawn::AMyPawn() { // 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;

 // Set this pawn to be controlled by the lowest-numbered player
 AutoPossessPlayer = EAutoReceiveInput::Player0;

 // Create a dummy root component we can attach things to.
     RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
 // Create a camera and a visible object
 UCameraComponent* OurCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("OurCamera"));
 OurVisibleComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OurVisibleComponent"));
 // Attach our camera and visible object to our root component. Offset and rotate the camera.
 OurCamera->SetRelativeLocation(FVector(-250.0f, 0.0f, 250.0f));
 OurCamera->SetRelativeRotation(FRotator(-45.0f, 0.0f, 0.0f));


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


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


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


Product Version: UE 4.17
more ▼

asked Sep 11 '17 at 11:11 PM in Bug Reports

avatar image

11 1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I had the very same error message from VS. However, the compile went through and build succeeded with no problems. I check the inheritance of these two components - USceneComponent and UStaticMeshComponent, and it turns out UStaticMeshComponent is indeed a subclass of USceneComponent and therefore the assignment should be fine.

It seems VS Intellisense doesn't parse the headers well and consider these two are not related. Hope this helps!

There are two ways make the error message disappear.

  1. Include below header file from the CPP

  2. Otherwise cast the pointer.

 #include <Runtime/Engine/Classes/Components/StaticMeshComponent.h>

more ▼

answered Sep 15 '17 at 07:59 AM

avatar image

16 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question