Debugging SpawnActor failed because no class was specified

My Blueprint-based game throws a SpawnActor warning that I cannot seem to identify. The log output is below. The game is in four blueprints (Character, GameModeBase, UMG.UserWidget, and aText3DActor [via Plugin]). The Text3DActors are spawned at the beginning of play; however it is clear from the log that the warning is thrown before any of these actors are spawned. In the output below, I added Print String nodes to each BeginPlay event as well as the contruction event/functions for the UMG and character.

The game works as intended in the editor; however a packaged game does not spawn the Text3DActors. Outside of the aforementioned Print String nodes, I have migrated this level to a new project, deleted all scenery except for floors, and have been unable to do anything to affect the warning. I have yet to try recreating the blueprints from scratch into a blank project which is my next step, but I’m hoping to get some suggestions before taking that nuclear approach.

I don’t know what else is needed from me in terms of which Blueprints are actually useful.

LogLoad: Game class is ā€˜ChickenGameMode_C’

LogWorld: Bringing World /Game/Maps/UEDPIE_0_Lab-02.Lab-02 up for play (max tick rate 0) at 2020.07.10-16.00.31

LogWorld: Bringing up level for play took: 0.005083

LogOnline: OSS: Creating online subsystem instance for: :Context_24

LogSpawn: Warning: SpawnActor failed because no class was specified

LogBlueprintUserMessages: [ChickenCharacter_C_0] Character Construction

LogBlueprintUserMessages: [ChickenGameMode_C_0] GameMode BeginPlay

LogBlueprintUserMessages: [elementBP_C_0] BP construct

LogBlueprintUserMessages: [elementBP_C_1] BP construct

LogBlueprintUserMessages: [elementBP_C_2] BP construct

LogBlueprintUserMessages: [ChickenUI_C_0] UI Cosntruct

LogBlueprintUserMessages: [Lab-02_C_0] Level

Spawn actor function cannot find that class you specified .which means that class is not included in packaged build. head to project options ->packaging ->check cook all inside content folder

Thanks for your suggestion. It did not change the behavior, unfortunately. I am having problems identifying when this error is triggered because I only have one SpawnActor node in my blueprints, and this error triggers before that node is entered.

LogSpawn: Warning: SpawnActor failed because no class was specified

LogBlueprintUserMessages: [ChickenCharacter_C_0] Character Construction

LogBlueprintUserMessages: [ChickenGameMode_C_0] GameMode BeginPlay

your spawn happens before gamemode beginplay . Which event from which BP calls Spawn?

That’s the question - The spawn happens before each beginplay of my blueprints, or the construction functions/scripts for UMG widgets and character BP. I don’t know how to identify where this spawn is being called, using the editor’s search feature has not provided any help.

open game mode and see if any of default bp’s are set to something unreasonable . btw you should spawn your pawns and chars inside gamemode by overriding postlogin function.

5 Likes

This was the problem. Since I’m using widgets for making the display, I set HUD to None in Project Settings. Changing it to the base HUD class eliminated the error.

10 Likes

Two years later & your comment here fixed the issue I was having. Extremely vague ā€œLogSpawn: Warning: SpawnActor failed because no class was specifiedā€ with no further details triggering after every Play In Editor run was driving me crazy. Turns out HUD in Maps & Modes had somehow gotten set to None. Not sure how that happened, really.

Wish the editor was more detailed about what was trying to be spawned in that circumstance…

10 Likes

Thank you! Can’t believe they didn’t put a nullcheck there…

I had the message SpawnActor failed becaus no class was specified when building a C++ based game project just now.

It turned out to be because I had used forward declarations for a type needed in the spawn.

eg

class MyActor;

UCLASS()
class MYGAME_API ACoolActor : public AActor
{
	GENERATED_BODY()
	
public:	
	ACoolActor();

	/* stuff here */

	/*  Oops, I am not completely defined - I'm just a pointer */
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSubclassOf< MyActor> CameraActorToSpawn;
};

Ugh. Mea culpa.

I am now not sure that the forward declaration issue was causing the SpawnActor failed message.

I was seeing a crash due to the forward declaration for a UPROPERTY issue. And just above the crash I had seen the message, and (most likely) leapt to the wrong conclusion.

So after a time I noticed that I was still getting the message about SpawnActor failed. Just because there was no crash to pause the log, I had not seen it.

However I noticed that it was there while debugging another issue, went hunting and tried the fix mentioned in this thread: and it fixed the problem.

Sigh.