Crashing UE Editor

When I try including Actor.h header and writing log an output as shown in lecture, it makes Unreal Editor to compile properly but crashing when clicking ‘Play’. Log output worked properly until I added GetOwner()->Getname() wich being said is not being suggested by VS code completion; not even GetOwner, although Actor.h is found and accesible. Any thoughts? I guess lecture video may have been cutted on that point as of a possible UE Editor crash to be hidden for us?

FString ObjectName = GetOwner()->GetName();

UE_LOG(LogTemp, Warning, TEXT("%s"), *ObjectName);

Where did you write that? What function?

-Resolved (See next post)-
I’m running into this same issue… written in the BeginPlay function of the WorldPosition.cpp

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


#include "WorldPosition.h"
#include "GameFramework/Actor.h"

// Sets default values for this component's properties
UWorldPosition::UWorldPosition()
{
	// 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 UWorldPosition::BeginPlay()
{
	Super::BeginPlay();

	// FString Log = TEXT("Hello");
	// FString* PrtLog = &Log;

	// Log.Len();

	// (*PrtLog).Len();
	// PrtLog->Len();

	// UE_LOG(LogTemp, Warning, TEXT("%s"), **PrtLog);

	// GetOwner()->GetName();

	FString ActorName = GetOwner()->GetName();
	UE_LOG(LogTemp, Warning, TEXT("The Actors name is %s"), *ActorName);
	
}


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

	// ...
}


This worked for me, hopefully for someone else as well -
Close VS.
In UE4: File-Refresh Visual Studio Project
Reopen VS.

This fixed the squiggly lines I was getting and also fixed the crashing I was getting after adding the #include “GameFramework/Actor.h” line

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms