x

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"

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: alt text

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

Product Version: Not Selected
Tags:
more ▼

asked May 01 '15 at 03:34 PM in Bug Reports

avatar image

kostor
67 12 16 18

avatar image kostor May 01 '15 at 07:22 PM

Anyone? Staff?

avatar image Azarus May 01 '15 at 07:30 PM

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. :)

avatar image kostor May 01 '15 at 07:33 PM

@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;
 };




 


avatar image kostor May 01 '15 at 07:35 PM

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

parent.txt (2.3 kB)
(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 01 '15 at 07:49 PM

avatar image

Azarus
1.9k 59 50 189

avatar image kostor May 01 '15 at 07:55 PM

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

(comments are locked)
10|2000 characters needed characters left
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