4

Is there a way to use Photon library in offline mode? I am trying to access two android devices that are connected to a single hotspot without internet. Is there a way to achieve the communication?

I am using PhotonNetwork.OfflineMode = true as given on their docs, but it does not work.

    void Start()
    {
        PhotonNetwork.OfflineMode = true;
        PhotonNetwork.ConnectUsingSettings();
        print("Connecting...");
    }
 
    public override void OnConnectedToMaster()
    {
        PhotonNetwork.JoinLobby(TypedLobby.Default);
        print("Connected");
    }
 
    public override void OnJoinedLobby()
    {
        print("On Joined Lobby");
    }
 
    public override void OnJoinedRoom()
    {
        Debug.Log("Player has joined");
    }
 
    public override void OnDisconnected(DisconnectCause cause)
    {
        print("DisconnectFrom Photon");
    }
ForceVII
  • 355
  • 2
  • 16

1 Answers1

3

Photon in offline mode is true single-player mode – no network calls are made.

It sounds like you're trying to set up the game in LAN mode.

Photon always uses a dedicated server, so even in LAN you need a Photon Server running. You'll need to download Photon server and run it locally on your machine for this to work.

I don't know if it's possible to start a server on a mobile device, like you can on PC.

If LAN is a priority PUN might not be the best choice.

Iggy
  • 4,767
  • 5
  • 23
  • 34
  • Actually when I used ForgeNetworking library, it worked with LAN (Mobile Hotspot mainly) with no internet. Unfortunately it is not the same case with Photon. But I am assuming there could be a way around it. –  Jul 06 '20 at 09:49