Hi,
So I have been running into some issue’s when using the “Begin Play” event with networking. I understand that these problems may not necessarily be issues as such and may have legitimate reasons for this but if I could at least understand why this happens and the reason for it then I can understand how to sensibly work around these issues with creating even more problems.
So the first issue that is apparent is that when a client is connected to a server there is a significant delay between an object spawning and when its begin play function is called. For example, in the below two screen shots it is only the second that actually works
^^^^^^^^^
This doesnt work :s
^^^^^^^^^
This does work
And this is the function being called for clarity:
So I believe from what I have learnt so far, that this delay is some kind of result given due to the time taken for the objects to become properly initialized and replicated across the server and all clients. So it would make sense for begin play to be delayed until all of this stuff (whatever that may be) has been handled. However the tick functions of this actors still run as normal. So in this case the Tick event will run for a good few seconds before begin play is called. I am aware that there are work arounds for this but i would just like to understand what is actually going on here, the reasoning for it and the best solution to solve this issue.
The second issue that I am currently faced with is a little more confusing, but still related to this begin play issue. I have a c++ function that is blueprint callable, which is called during the begin play execution flow of an actor. I am printing a string before the function is called, during the function itself and after the function should have been executed. The nodes before and after the function print out as expected. So there is absolutely no doubt that the function should be called. However the function never is and the print is never called. Below is a screenshot of this:
If the highlighted (in red) function is called from any other event on any actor then it is called fine and prints expected string. However during the above execution flow from begin play, it is NEVER CALLED.
So yeah, this is pretty much all the information i have right now that is useful. So if anyone could shed some light on any of these issues it would be greatly appreciated.
Thanks, .