Search Unity

Third Party Implementing Single Player with Mirror

Discussion in 'Multiplayer' started by IncrediblyWalrus, Jan 19, 2023.

  1. IncrediblyWalrus

    IncrediblyWalrus

    Joined:
    Jul 22, 2019
    Posts:
    46
    Hi there,

    I'm curious on how I'd go about doing a single player and also using Mirror for networking purposes.

    I'm wanting to basically allow the switch between single player and multiplayer via just the player going to some sort of area on the map, and then connecting them through a matchmake system using PlayFab.

    How would I basically go about implementing single player so that the character information is saved when switching to multiplayer? I'm saving the data easily on PlayFab, as that is just using API calls so it's not really an issue if they're using single player or multiplayer. My problem lies with: Instantiating the player locally, instead of using Mirror's way of instantiating, and all these other things that I'll be using for the multiplayer stuff too such as player movement which will be using NetworkBehaviours, it just seems like a hassle to have different files for such local and then network.

    I've seen a few people just saying to allow them to host their own server via local host and then it secretly acts as "single player". Would there not be an issue with strict firewalls here?

    I've understood from PUN2's perspective they have an offline mode which seems like a really nice feature. Does Mirror not have anything of the sort, and if not, what's the best way of doing this without overwhelming myself?

    Thanks!
     
    Last edited: Jan 19, 2023