Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MrLucid72 · Nov 19, 2016 at 01:02 PM · multiplayermultiplayer-networkinglobbymatchmaking

[Multiplayer] OnMatchList() isn't firing after ListMatches() when using NetworkLobbyManager


TL;DR summary:

  • I have [SerializeField] NetworkLobbyManager lobbyMgr and dropped in the new NetworkLobbyManager component and attached a Mono lobbyScript.cs

  • Inside lobbyScript, I lobbyMgr.StartMatchMaker()

  • I then make a match, lobbyMgr.MatchMaker.CreateMatch(...lobbyMgr.OnMatchCreate). Notice the callback for the serialized lobbyMgr instance.

  • I need to override lobbyMgr.OnmatchCreate >> How?


TL;DR trial and error:

  • I tried changing the script to inherit from NetworkLobbyManager instead of Mono - however, I then had 2 separate NetworkLobbyManager instances. I could generally override void OnMatchCreate, but if I do this, then: OnMatchCreate() callback never fires. lobbyMgr.ListMatches() returns nothing. It's out of sync. Different instances?

  • I tried to use my own callback: .CreateMatch(...OnMatchCreateCustom), and the callback DID fire, however, similar to #1, it became out of sync. Apparently when lobbyMgr gets a callback, it probably also saves the match in the background. I need to override the lobbyMgr instance -- not use my own callback. OnMatchCreate() DOES fire, but.. lobbyMgr.ListMatches() returns nothing. It's out of sync. Different instances?


Details:

I call the serialized LobbyNetworkManager (lobbyMgr) via

lobbyMgr.matchMaker.ListMatches(params, etc, nextParamIsCallback, lobbyMgr.OnmatchList)

Then.. the Lobby script derived from MonoBehaviour:

 public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
 {
     Debug.Log("@ OnMatchCreate - WHICH NEVER FIRES");
 }

That is when I dove into the matchmaking class and realized that .. you can't override on MonoBehaviour, but inheriting from NetworkLobbyManager causes conflicts with ... well, your serialized lobbyMgr!

So how do I access the serialized lobbyMgr's matchmaking callbacks?

I can't do anything like override void lobbyMgr.OnWhatever(), so how do I do it in 5.5b+?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MrLucid72 · Nov 19, 2016 at 02:09 PM 0
Share

11/19 update: I discovered 5.5b API doc conflicts:

I discovered that this 5.5b doc says that On$$anonymous$$atchList returns is:

On$$anonymous$$atchList(List$$anonymous$$atchResponse matchList)

However, this 5.5b doc shows completely different format and parameters:

On$$anonymous$$atchList(bool success, string extendedInfo, List<$$anonymous$$atchInfoSnapshot> matchList)

EDIT 2: The old code that allegedly worked was this (which no longer works):

 public override void On$$anonymous$$atchCreate(Create$$anonymous$$atchResponse create$$anonymous$$atchResponse)
  {
      base.On$$anonymous$$atchCreate(create$$anonymous$$atchResponse);
      Debug.Log("@ On$$anonymous$$atchCreate);
  }

EDIT 3: The callback with the longer params is the correct one: https://docs.unity3d.com/550/Documentation/$$anonymous$$anual/UpgradeGuide54Networking.html

avatar image MrLucid72 MrLucid72 · Nov 25, 2016 at 03:18 AM 0
Share

11/25/2016 Update:

Although the syntax is accepted with my own callback ins$$anonymous$$d of lobby$$anonymous$$gr.On$$anonymous$$atchList, and is fired, it apparently makes my serialized lobby$$anonymous$$gr component out of sync! Likely because of different instances?

If I use this way,

PC-A starts matchmaking, looks for an open game in list, nothing in list, so creates a match.

PC-B start matchmaking, looks for an open game in list, nothing in list -- this means that although the game exists somewhere, not in the same instance as my serialized lobby$$anonymous$$gr component.


This means I still have issues.

I need to find a way to access the serialized lobby$$anonymous$$gr.OnWhatever() callback events INSIDE lobby$$anonymous$$gr.

I tried changing my lobbyScript [attached to my serialized lobby$$anonymous$$gr component to inherit from NetworkLobby$$anonymous$$anager - originally from $$anonymous$$ono. I could then properly void override On$$anonymous$$atchList(), but it was never fired because it's a different instance -- I then technically have two NetworkLobby$$anonymous$$anager's -- this isn't the solution. I need to specifically access lobby$$anonymous$$gr.On$$anonymous$$atchList() somehow. How do I do it?

I can't simply do override void lobby$$anonymous$$gr.On$$anonymous$$atchList because it's a syntax error - but that is what I am trying to achieve, ultimately, if someone has the correct syntax to do so

avatar image MrLucid72 MrLucid72 · Nov 29, 2016 at 02:37 AM 0
Share

11/29: Still awaiting an answer -- trial and error can only go so far :/

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

84 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Unet] NetworkManager singleton auto-destruction 0 Answers

Create Multiplayer lobby sytem 0 Answers

MatchMaker sometimes can't see created games 0 Answers

Multiple match with same name - Unity Match Maker 0 Answers

Best solution for low bandwidth multiplayer game 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges