Ammo, reloads and strange Unreal behaviour

 This last week I've been studying mostly on the ammo system, this involved the system to reload the gun if the player has ammo in the inventory, update the HUD of the player based on the ammo and the animation of the player reloading.

I'm not a big fan of editing animations because I feel like sometimes it can be a bit repetitive but this weekend it was really satisfying, I realized that I'm now able to make simple edits on the animations by my own to match them to what I need. I'm pretty sure this new skill will help me to work faster because I used to spend a lot of time looking for the perfect animation for each situation and now, I can modify animations which are near to what I need.

The ugly part of the week was an error which made me stay some hours debugging and checking my code line by line without finding an answer, I added some lines of code on a component class and after that my component was broken. After some debugging, I discovered that the component became null when the game started, everything worked fine during the constructor but at the beginning of the game the component was destroyed without a clear reason.
After some time investigating, I read on the Unreal blog one of the strangest solutions I've ever seen, changing the name of the component variable. Changing the name was the solution, but I'm not sure at all why, I'm sure that the first thought you had was "You were using a reserved word", but I don't think it was the problem, I had been using the variable for at least three weeks and I never had any problem with it, until that point. I'll investigate more about it, and I hope I'll bring you an explanation on my next blog post.

Additionally, this week I had some great progress working with the AI plugin I talked about some blog posts ago, I haven't worked with it the last weeks, but last weekend I made some interesting improvements to allow an enemy to have a better behavior during the game, although this is all I can say about it.

I think this is all for this week, I hope you have enjoyed my blog, thanks for your time.

Comments