How to use SetTimer correctly?
I try to get warm using the Unreal Engine and try to implement a very lightweight shooter system. Therefore I had a look at the shooter game example and tried to implement a very basic version of this step by step. I want to use the SetTimer-method as the ShooterGame does to recall my HandleFiring-method again after a certain time between two shots.
So I used it similar as the ShooterGame:
If I do so, the game will crash as soon as I press the fire button and the debugger tells me that there is an access violation in the SetTimer line. But I cannot really see what I am doing wrong. For me it looks quite similar as the shooter game does handle this. So do I have to initialise this TimerManger first? Or prepare the usage somewhere? Or do you have any other idea why this piece of code could crash?
Thank you for your help.
EDIT: Okay the problem is not the TimerManager, but the World. If use getWorld() to get a pointer to the world class this pointer is NULL. So my Weapon does not have a correct world pointer. Has anyone an idea what I can do to fix this? Currently my Character class has a Weapon-Field that is set within the Character-Blueprint to my basic weapon class. So probably I have to attach the Weapon somewhere to the world. But I have no idea how I could do this, since the weapon object should only be part of the player's inventory. Do you have any hint for me?
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
answered Dec 17 '14 at 10:03 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here