Not Updating

I followed your instructions to the the letter and the 9 is not changing on my MyInt default and it shows the variables but not replacing the defaults update i change after began play:

My code in the .h file is:

public:

// Called every frame

virtual void Tick(float DeltaTime) override;

UPROPERTY(EditAnywhere)

int32 MyInt = 99;  

UPROPERTY(EditAnywhere)

bool MyBool = true;

UPROPERTY(EditAnywhere)

float Myfloat = 5.99;

};

My code for the cpp file is:

// Called when the game starts or when spawned

void AMovingPlatform::BeginPlay()

{

Super::BeginPlay();

MyInt = 9;

}

// Called every frame

void AMovingPlatform::Tick(float DeltaTime)

{

Super::Tick(DeltaTime);

}

the code is updating when I make changes to the .h file but will not override the default value in the cpp file as your instructions show. So this is a show stopper for me I cannot continue until this is resolved.

You have to save the level. Also some people were having the same problem when using Live Coding.

everything is saved. I i even turned off live coding. Exit editor. Rebuild. reload editor and it is still not updating the variable. It is using what ever I have set in the .h file but not the override in the .cpp file no matter what I do. I save everything. Rebuild through the editor, does not work. Exit editor and use visual code and rebuild through that and open unreal and still no update.

So I did a quick test when I change the number on the .h file and compile it from the editor, it updates the number right away. Its something wrong with the cpp file and it is not overriding it from the began play function. It for some reason acts like its not there or something. I feel there is something missing in the instructions which is frustrating

Could you show screenshots of what you’re getting as well as your code if you’ve changed it at all since the OP.

There is no errors to show and the code is exactly what I typed in the OP

This really stops me from continuing the lesson as If its not updating like you mentioned in the instructions then I cannot continue those lessons

I think you misunderstood what I was asking for as I didn’t ask for errors that you are getting.

I’m asking for what you’re seeing.

Hey deathjdstn are you playtesting while looking for changes, anything you put in the cpp (beginplay) file will only update in playtest mode. hope this helps

1 Like

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

Privacy & Terms