I need to be able to pass a ChildActorComponent reference to server (using a Custom Event RunOnServer) when clicking on any actor but when a client click on a ChildActorComponent of a different client, it sends a None value instead.
Is it a limitation or am I missing something?
My script looks like this :
And this is what’s happening :
- Server is clicking on its own ChildActorComponent. Everything is fine. receive Print is showing Ref.
- Same when Server is clicking on Client’s ChildActorComponent.
- Now Client click on Server’s ChildActorComponent. It still works !
- And bug happens when Client is clicking on server’s ChildActorComponent. Receive print is showing nothing.
Here is a zipped test project.
Ps : Unrelated, but randomly, client won’t spawn properly…
Thanks for report! I was able to reproduce this in test project you provided, and I’ve entered a bug report for issue (UE-23143). It seems Hit Actor returned for a Child Actor Component is its own Actor, rather than returning Actor, and this reference is not being communicated to Server as you would expect a separate Actor reference to do. I will update this post when I see any update on report. Thanks again!
Ok, thanks for report.
Any idea of a way to work around that problem ? Without a way to communicate that reference one way or another, I’ll be quite screwed.
I would use separate actors, rather than child components, for this. You can then attach them, if necessary.
If you’re committed to using Child Actor Components, you need to make sure Server knows which of it’s own components to reference. So, for example, you can reference each child actor component with an integer, and use that as an ID. Then you can pass server integer and tell it to reference its own child actor component with that integer ID.
Thanks for tips. It’s what I had in mind as a last resort.
Kinda dirty but that’ll do.