Hi, I am returning to UE4 after some time and ran into an issue with updating my project to 4.6 version.
The latest tested and working version for my project was 4.5.1.
Now I tried this 2 ways, first I just opened the project in 4.6 and it automatically compiles it to 4.6 version,
then I also tried recreating the whole project from start.
I ended up with same problem, I can’t seem to spawn blueprints, the log says:
" SpawnActor failed because no class was specified "!
The rest of the game works fine.
I assume the problem is something about ObjectInitializer which seems to have changed from
FPostConstructInitializeProperties& PCIP way of doing it ?? I tried it both ways, no luck so far.
Here’s the code , .h:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/GameMode.h"
#include "JumpyFrogsGameMode.generated.h"
/** GameMode class to specify pawn and playercontroller */
UCLASS(minimalapi)
class AJumpyFrogsGameMode : public AGameMode
{
GENERATED_BODY()
public:
AJumpyFrogsGameMode(const FObjectInitializer& ObjectInitializer);
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = JumpyFrogs)
UClass* SlotBP;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = JumpyFrogs)
UClass* FrogBP;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = JumpyFrogs)
AActor* MeshHolder;
// and so on…
.cpp:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "JumpyFrogs.h"
#include "JumpyFrogsGameMode.h"
#include "JumpyFrogsPlayerController.h"
#include "ConstructorHelpers.h"
#include "JumpyFrogCharacter.h"
#include "Engine.h"
AJumpyFrogsGameMode::AJumpyFrogsGameMode(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// no pawn by default
DefaultPawnClass = NULL;
// use our own player controller class
PlayerControllerClass = AJumpyFrogsPlayerController::StaticClass();
bIsFrogSelected = false;
bIsMoveValid = false;
bIsFrogInAction = false;
static ConstructorHelpers::FObjectFinder <UBlueprint> FrogOb(TEXT("Blueprint'/Game/FrogChar/Blueprints/FrogBP.FrogBP'"));
if (FrogOb.Object != NULL)
{
FrogBP = (UClass*)FrogOb.Object->GeneratedClass;
}
static ConstructorHelpers::FObjectFinder <UBlueprint> SlotOb(TEXT("Blueprint'/Game/Blueprints/EmptySlotBP.EmptySlotBP'"));
if (SlotOb.Object != NULL)
{
SlotBP = (UClass*)SlotOb.Object->GeneratedClass;
}
}
and so on… and the spawning part:
TheSlotsArray.Add(GetWorld()->SpawnActor<AActor>(SlotBP, FVector(0.0f, 440.0f, 60.0f), FRotator(0.0f, 0.0f, 0.0f), SpawnInfo));
FrogsArray.Add(GetWorld()->SpawnActor<AJumpyFrogCharacter>(FrogBP, MojVektor, FRotator(0.0f, 0.0f, 0.0f), SpawnInfo));
FrogsArray.Add(GetWorld()->SpawnActor<AJumpyFrogCharacter>(FrogBP, FVector(0.0f, 220.0f, 60.0f), FRotator(0.0f, 0.0f, 0.0f), SpawnInfo));
FrogsArray.Add(GetWorld()->SpawnActor<AJumpyFrogCharacter>(FrogBP, FVector(0.0f, 660.0f, 60.0f), FRotator(0.0f, 0.0f, 0.0f), SpawnInfo));