11Mdp
(11Mdp)
May 8, 2021, 6:25pm
1
Hello, I’m having problem with the OnComponentHit activation.
Basically I’ve written this code for my projectile class:
And this is how the OnHit function is declared and defined:
The problem is that the OnHit function is never called.
The collision settings on my projectile’s static mesh component (which is the root component and the only scene component of the actor) are the following:
And those are the collision settings of the object type “Enemy”:
In game, the only things that actually block my projectile are indeed actors with collision type of “Enemy”, but the OnHit function is never called.
Can somebody help me and tell me what I’m missing here? Thanks a lot!
Tuerer
(Tuerer)
May 9, 2021, 12:28pm
2
Try binding in BeginPlay() instead of the constructor. For some reason the constructor doesn’t always bind to events correctly.
DuneGames
(DuneGames)
September 16, 2022, 6:22pm
3
Hey, I have the same problem with the same class. Only, binding this event in BeginPlay vs the constructor isn’t helping.
You may be asking why the similarity - it’s because it’s a tutorial on Udemy we’re following.
My code:
DuneGames
(DuneGames)
September 16, 2022, 6:28pm
4
Never mind, found someone that had the same issue in the tutorial forums - link here if you have the course to read it yourself.
The answer is though, close unreal editor, recompile (build) and then relaunch editor.
1 Like
alx881
(alx881)
January 14, 2024, 9:18pm
5
Thanks man! Still having trouble figure out how Visual Code, Unreal Engine and LiveCoding vs. ‘normal’ Compiling plays together…
ToonTanks right? So how is your Unreal Journey going so far?
DuneGames
(DuneGames)
January 17, 2024, 3:54am
6
A year and a half in, it does start making sense!
I don’t remember if it was ToonTanks, but it was that tutorial series on Udemy. It really helped me a lot.
You can see an update of where I’m at in building ‘the game’ here - Edge Emperor - Game Update - Harvesting Improvements - YouTube