Mirror Network Discovery event help

Hello, I don’t understand how to add network discovery event on Mirror component, on my script code I have provide

public void OnDiscovery(Mirror.Discovery.ServerResponse response)
{

}

but on Uniy I can’t see the event, thank you, Cheers…

It should be as simple as that, can you show me your class?

Hello, many thanks for your interest, next a short of my script where I would like to call a discovery class method when a client found a server on LAN :

I have manually added the OnServerFound but the code doesn’t work, Cheers…

I just realized what you did. You dragged the script directly into the event.

Try this instead:

  1. scroll down to the bottom of the inspector, and click on AddComponent
  2. Select UserScript
  3. It should add your UserScript as a component to your NetworkObject GameObject.
  4. Now, drag the newly added component into the event.
  5. Now the drop down should list all the components in NetworkObject, select the UserScript component and you should see the OnDiscovery method
1 Like

Yes, sorry, I have dragged the game object that contains the script and then the component recognized the method, thank you for all, Cheers…