Trcioo
(Trcioo)
March 19, 2018, 6:07pm
3
Fluppi393:
I would avoid binding a delegate to the controller in BeginPlay as it might not necessarily be set yet. A safer place would be for example in PossessedBy, don’t forget to unbind the delegate either when the character is unpossessed though (might lead to unexpected behavior)! However, depending on your game design I would try to make the interface between the character and the controller more abstracted and not mixing up the character, its components and the player controller to that level. I would rather have the component tell the controller (maybe over the character) that a target is required, when the controller selected a target it calls a generic “OnTargetActorSelected” function on the character which passes it on to its components. If the target selection is very specific to one character or a spell then maybe it makes more sense to implement the target selection on the character or component.
saw the problem with begin play right after testing in a dedicated server environment (eheheh), moving it to possessed solved, thanks for the tip.
I’m avoiding the character to make the component as generic as possible, I wish to use it in future projects without too much copy paste code.