Double appearance of text

I’m facing this weird problem in which whatever I have programmed to print initially, appears twice. I have followed the tutorial and am executing the same program. Although the info is printed twice. You could have a look at the below screenshot
Capture

in order to figure out why this is happening, i’d need to see your code. Does the sign say that the moment you start the game? or is it just not clearing between ENTER presses?

At the start of the game. On hitting enter it does clear the screen… Do you still need to see the code?

I’d still need to see the code to know for sure, but i think i know why it’s doing it. Remember when you put the SetupGame code in the BeginPlay() function? Then later moved that code to a new function called SetupGame()? I think that when you moved the code over to the SetupGame() function, you never removed it from BeginPlay(), and still called SetupGame(), so the code is running twice. Check your BeginPlay() for the SetupGame code, and if it’s there, then delete it, and just call SetupGame().

Below attached are the screenshot of the code and the output respectively
Do let me know what the issue is…Thanks
Capture.JPG

My hunch was correct: In your begin play function, on line 8, you setup the game using the SetupGame() function. Then on lines 10-14, you set it up again manually. Delete lines 10-14 and that should fix your problem. You had a double appearance of text because you used SetupGame()'s code twice, when you only need the one call of SetupGame().

1 Like

Hey! I tried deleting lines 10-14…yet the text appears twice… Due to which the entire terminal gets covered:( Would you be able to help?

Could you post your full code?

Did you re-compile your code?

Hey! I guess there was a technical issue with my laptop. I’ve moved onto another laptop and there is no double appearance.
Thank you so much

I’m glad it works now! Happy coding!

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

Privacy & Terms