I had to delete and re-download the Bull Cow game because it kept crashing unreal.
Now when I try to play the game, none of my compiled code effects the game at all.
I am up to the end of the “Bolean” video code and Unreal WILL compile it without problem, BUT it effect nothing in the game.
I opened up a fresh visual studio code through Unreal and reentered all code.
Not sure what to do. Thanks
Could you show me your code?
Yeah, here’s a screenshot of both the .cpp file and header file. Also I cut out the dev // notes when I coped the code to ‘Notepad’ to save it and paste it to the new .cpp file.
Thanks for getting back to me
And what are you getting in-game? And are you pressing tab once pressing Play?
The IN-Game is just like when we 1st download the cowbell program. There is only the <$ and you can type in the terminal. It shows none of my programmed print code and does react if I type anything like the correct HiddenWord or mistake.
Close Unreal and then in VS Code do the following
- Ctrl + Shift + B
- Select ProjectNameEditor Win64 Development Rebuild
Tried running the CowBullgameEditor Win64Development Rebuild -No Luck.
Also did the F5 DeBug and got this reply.
And you’re sure you have your component attached to the terminal?
I’m not sure man, I will, how do I make sure of that? I do know it compiles, and then if I mess up the code intentionally, it will give a failure to compile message.
Click on the signpost in the level and see if it has the BullCowCartridge in it’s component list.
I got repeated crashing too and it turned out that I had called the function BeginPlay() when I should have called SetUpGame(). Calling BeginPlay() I learned seems to guarantee a crash.
So in your case, is there some elicit function you’ve called in error?
When were you calling BeginPlay
? Do you mean Super::BeginPlay
?
Just BeginPlay()
By the way, is it explained in a later video what Super::BeginPlay() means? i.e. what is “super”? Sorry, probably a dumb question but I am totally new to coding.
You shouldn’t be calling that yourself.
I’m pretty sure it’s explained when it’s seen, I’ll look into it.
Not stupid. Super
is a type alias for the parent (aka super) class which Unreal generates for you. It’s one of the things the GENERATED_BODY
macro is doing.
So in the case of UBullCowCartridge
that would be using Super = UActorComponent;
i.e. Super
is just another way to say UActorComponent
. This will be dependant on what the parent class is.
Code example:
https://godbolt.org/z/XopwwX
Dan - thank you so much. Very helpful.
Dan - another possibly dumb question…what does the term “cartridge” mean? As in BullCowCartridge.cpp. Is a cartridge a special coding terminology? It sounds like a thing one would plug in to another thing.
Because the idea was you could swap the cartridge for another one on the terminal to play a different game.
Should be an end of section challenge to re-create TripleX