question

madmojoman avatar image
madmojoman asked

UnityNetworkManagerMediator talk to Custom Mediator?

I'm using the PlayFab custom game server example and I've set up my own custom mediator and everything seems to work great. When a client connects, I have my custom Mediator do some things. (And this works great because it's triggered by the client.) But now, when I have a client disconnect from the server (no way to send a trigger directly from the client anymore) I want to have my custom mediator respond to this and do some stuff.

Right now, I can see that the UnityNetworkManagerMediator listens for the disconnect and performs it's stuff, but when I try to add the same listener to my custom mediator it doesn't seem to hear the MsgType.Disconnect and run the functionality I want it to.

I'm sure I'm just missing something simple, like forgetting to Inject something...but any tip on why my Mediator wouldn't detect the MsgType.Disconnect when the UnityNetworkManagerMediator does? Or how I could easily pass the detection of disconnect from the UnityNetworkManagerMediator to my own Mediator?

Custom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
marcowilliamspf avatar image
marcowilliamspf answered

I believe this is a bug and I am looking into a fix. I don't an ETA yet, but it is being worked on.
In preparation this fix will go out with a pretty large refactor.

Here is what I am doing so if you plan to upgrade to the latest Server code, you might need to make some code changes.

1> Removing PlayFab Context package. PlayFab will no longer have signals for API calls. You will need to call our APIs directly. The the context was just a wrapper around our API and it is an unnecessary extra step to using our API

2> I am refactoring the PlayFab Server & Networking code to not use signals.

3> Fix for your issue.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

madmojoman avatar image madmojoman commented ·

Sounds good, Marco. I haven't implemented anything with the PlayFab Context package, I believe. So far I just have a Manager, Mediator, and View setup. (Although I think there was an example/tutorial on using GetTitleDataSignal and GetTitleDataResponseSignal that I've commented out on my Mediator because I wasn't using it.)

On my Mediator I've injected the View, UnityNetworkingData, and LogSignal only. Then in my OnRegister I have some "NetworkServer.RegisterHandler"s setup to listen for messages from the client.

Does it sound like I'd need to change much with the latest upgrade coming? Thanks!

0 Likes 0 ·
marcowilliamspf avatar image marcowilliamspf commented ·

nope, sounds like you won't need to change anything.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.