Begin Play Doesn't Fire

Hi.

I made a blueprint deriving from a c++ class.
I try to add a new widget variable when begin play fires, but it doesn’t.

Here is the BP:

when the game starts, it doesn’t print “Hello”…

the code for begin play in the C++ class:

Super::BeginPlay();

	gameStatePtr = (AVikingKingGameState*)(GetWorld()->GetGameState());
	gameModePtr = (AVikingKingGameMode*)GetWorld()->GetAuthGameMode();

UE4 is binary, ver: 4.7.6-2513093

Anyone? Staff?

What class? Is it an AActor? Can i see your header file and the entire begin play function? Give us more info so we can help, or don’t expect too much. :slight_smile:

@Azarus That was the entire begin play. Also it derives from another class which is a base building class which derives from AActor
Header for the barracks:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "VikingKingGameState.h"
#include "VikingKingGameMode.h"

#include "BuildingsMain.h"
#include "BarracksBuilding.generated.h"
UCLASS()
class VIKINGKING_API ABarracksBuilding : public ABuildingsMain
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnyWhere, BlueprintReadWrite)
		TArray<float> warriorRespawnTime;				//How much time to wait between every warrior respawn
	UPROPERTY(EditAnyWhere, BlueprintReadWrite)
		TArray<float> archerRespawnTime;				//How much time to wait between every archer respawn
	UPROPERTY(EditAnyWhere, BlueprintReadWrite)
		TArray<float> mageRespawnTime;					//How much time to wait between every mage respawn
	
	float warriorRespawnTimer, archerRespawnTimer, mageRespawnTimer;	//Timer between each spawn

	ABarracksBuilding(const FObjectInitializer& ObjectInitializer);
	virtual void BeginPlay() override;
	virtual void Tick(float DeltaSeconds) override;


	UFUNCTION(BlueprintCallable, Category = "Setting")
		bool PurchaseVikingWarrior();	//Buy warrior - return if there were enough resources 

	UFUNCTION(BlueprintCallable, Category = "Setting")
		bool PurchaseVikingArcher();	//Buy archer - return if there were enough resources 

	UFUNCTION(BlueprintCallable, Category = "Setting")
		bool PurchaseVikingMage();		//Buy mage - return if there were enough resources 
private:
	AVikingKingGameState* gameStatePtr;
	AVikingKingGameMode* gameModePtr;
};

Header for the parent class (too long for comment)link text

I am pretty sure that you missed a Super::BeginPlay(); in one one of your classes? Check ABuildingsMain if it calls the BeginPlay function of its parent class.
By the way the ReceiveBeginPlay(); calls the blueprint event, adding that to your code should work.

@Azarus you are right. I did miss it. I feel so stupid :/. write that as an answer and I’ll approve.