Search Unity

Third Party Using Mirror when Offline

Discussion in 'Multiplayer' started by Kokowolo, Dec 24, 2020.

  1. Kokowolo

    Kokowolo

    Joined:
    Mar 26, 2020
    Posts:
    60
    I have this scene where a player can edit a map offline before taking the scene online to play with other clients. The problem is I don't want the players to be able to edit the map (and it's characters) once they are online, but be able to do so when they are offline. Here is an example:

    Code (CSharp):
    1. [Server]
    2. public void ServerExampleFunction()
    3. {
    4.     // code I want to run when offline but not online...
    5. }
    The function ServerExampleFunction() can only execute on the Server at the moment. When the scene is offline, any call to this function will fail. How do I get it to run offline while ensuring that a malicious client can't hack the game when it's taken online? Do I have to make the offline player a host of his own lobby when offline to give them permission to call the function? Is there a way to toggle the [Server] attribute when offline and enable it once the game is taken online?

    I know this is a confusing question, but any pointers would be really helpful.
     
    Last edited: Dec 24, 2020