Hello !
I’m trying to make a debug widget to show data from server and proxy versions of the same actor, so each one would send a RPC call to a replicated actor, which would store the values. But there is a problem :
Can you somehow call a server RPC from a simulated proxy ? It doesn’t have any owner so I don’t know if it’s possible, even if it’s a hack it doesn’t matter since it’s just about debugging.
Thanks
Rémy
You could use the PlayerController to pass data to the server, from your SimulatedProxy. The thing you have to figure out is how to store the pointer to the PlayerController. But that shouldn’t be much of an issue.
Mmh not sure which controller you’re talking about. Let’s take the example of a possessed Character, the AutonomousProxy of it has an owner, which is the client PC controlling it.
But the SimulatedProxy doesn’t have any (GetOwner() returns nullptr ), in fact if I’m not mistaken the only Controller it could eventually get access to is the one of the player associated with its GameInstance ? Because both its client and server PCs “controlling it” don’t exist at all in its game instance, if I’m not mistaken once again ?
So maybe the trick would be to manually assign it as its owner ? Without owner it can’t make RPCs in all cases.
Yeah I’m quite new to UE Networking so some things are still confusing to me, I think it’s a bit too much for now, I’ll go back to it when I understand a bit more how everything works. And I never saw anybody with a debug UI working with multiplayer, it doesn’t exist in the marketplace, so not sure if it’s possible at all.
It would be great tho, because printing to screen or to logs suck a lot, I wish I had an UMG widget, where I could sort everything as I like, enable / disable stuff on the fly. I did it for single player and that’s soooo much better.
Oh yeaah I’m dumb I forgot you could easily get the local controller like this, that’s a good start !
So it would go like SimulatedProxy(client) -> (calls a function on) -> LocalController(client) -> (calls RPC on) -> LocalController(server) ? The proxy would just call a function on the controller, and the controller would make the RPC itself ?
Does it really work ? Can any actor call a function on the local PC which upgrades it to a RPC ? That would be convenient, I’ll try that when I get home