The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Pun2 working in android mode debug. but not working mode production

Jhoan_steve_1994
2019-09-04 04:11:21

When I work photon test mode works without problems, but when I generate the apk and install it it generates the following error:

https://drive.google.com/file/d/1LEhemHSI-7QQQrqxJO_cdGniSWxiU5uX/view?usp=sharing

apparently says that class 'photon.pun' does not exist

Comments

Jhoan_steve_1994
2019-09-06 01:11:02

when I exported in 'Build an rund' mode I have no problems with photon, but when I export in 'Build' mode and install it manually I have the following problem

JohnTube
2019-09-06 15:36:01

Hi @Jhoan_steve_1994,

Thank you for your report!

What PUN version are you using?
What Unity version are you using?

Could you share the whole stacktrace of the exception and the code snippet where you set PhotonNetwork.NickName.
This is a tricky timing issue.

Jhoan_steve_1994
2019-09-07 02:53:52

Unity 2018.4.8.f1 LTS
Pun2-FREE / Pun 2.12 photon lib:4.1.2.14

El problem is PhotonNetwork.GameVersion, PhotonNetwork.NickName, PhotonNetwork.AutomaticallySyncScene , etc.

I have problems with every photon in modo 'Build'

Jhoan_steve_1994
2019-09-08 02:59:54

My configuration @JohnTube mod

https://drive.google.com/file/d/1iEdR6O3QhG63f3DJdz82tLvLT0oU2lxL/view?usp=sharing

https://drive.google.com/file/d/1HFbb6tBINd78VCXVnfCFrnmErC9mRzFS/view?usp=sharing

https://drive.google.com/file/d/1Wjv79R0ztmRrsWm2xtpBvEGNCoj6M-Qz/view?usp=sharing

Jhoan_steve_1994
2019-09-08 21:14:35

// My code, error en PhotonNetwork.GameVersion.
//Object reference not set to an instance of an object in .Photon.Pun.PhotonNetwork.set_GameVersion
//

using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;  
using Photon.Pun;  
using Photon.Realtime;  
using UnityEngine.UI;  
using System;

public class MenuNetworking : MonoBehaviourPunCallbacks
{
public Text NetworkClientState;
public GameObject PanelCreate;
public GameObject cargando;
public InputField nameRoom;
public Text scenaMap, ModeGame, MaxPlayer, MaxKills, errrror;
int mapIndex = 0;
int ModeGameIndex = 0;
int MaxPlayerIndex = 2;
int MaxKillsIndex = 0;

}

JohnTube
2019-09-09 09:55:14

Hi @Jhoan_steve_1994,

Even if there is no NullReferenceException, the following line code will not work as expected and the PhotonNetwork.GameVersion will not bet set and will be overridden by the PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion inside PhotonNetwork.ConnectUsingSettings();

PhotonNetwork.GameVersion = "1";  
PhotonNetwork.ConnectUsingSettings() no longer takes gameVersion parameter. Instead the AppVersion parameter set from the Unity Editor in the PhotonServerSettings, AppSettings section is used as PhotonNetwork.GameVersion. If you want to set the PhotonNetwork.GameVersion from code you could either:
  • set PhotonNetwork.GameVersion just after calling PhotonNetwork.ConnectUsingSettings()
  • set PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion before calling PhotonNetwork.ConnectUsingSettings()
[source]

Otherwise, about the issue itself of the NullReferenceException in some PhotonNetwork properties, it looks like PhotonNetwork.NetworkingClient is still null while accessing those properties' getters or setters which is unexpected. We will investigate further.

Also, I don't think you have NullReferenceException in PhotonNetwork.NickName or PhotonNetwork.AutomaticallySyncScene. Please provide full stack trace if you do. You can easily test this by adding those lines before PhotonNetwork.GameVersion = "1";.

Jhoan_steve_1994
2019-09-10 01:23:59

I created a new scene and a new script, I'm still having problems:

https://drive.google.com/file/d/1Fp9nVbcJcLmS1FhBmWBJSIKEqgfgKmqS/view?usp=sharing

Jhoan_steve_1994
2019-09-10 01:24:12

using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;  
using Photon.Pun;  
using Photon.Realtime;  
using UnityEngine.UI;  
using System;

public class DebugPhoton : MonoBehaviourPunCallbacks  
{  
    public Text error,Status;  
    void Start()  
    {  
        try  
        {  
            if (!PhotonNetwork.IsConnected)  
            {  
                //PhotonNetwork.PhotonServerSettings.AppSettings.FixedRegion = "us";  
                PhotonNetwork.AutomaticallySyncScene = true;  
                PhotonNetwork.ConnectUsingSettings();  
                //PhotonNetwork.GameVersion = "1";

            }  
        }  
        catch (Exception e)  
        {  
            error.text = e.ToString();

        }  
    }

    // Update is called once per frame  
    void Update()  
    {  
        Status.text = PhotonNetwork.NetworkClientState.ToString();  
    }

    public override void OnDisconnected(DisconnectCause cause)  
    {  
        Debug.Log("Diconnect:" + cause.ToString());  
        error.text = error.text + "|" + cause.ToString();  
        //connect();  
        //reconectar();  
    }

}

JohnTube
2019-09-10 10:54:45

Hi @Jhoan_steve_1994,

Maybe the issue in the way you install the apk.
How do you install it?

JohnTube
2019-09-16 14:04:22

hey @Jhoan_steve_1994,

any news regarding this?


For me, it looks like there is an issue with your project or your machine or your device.
This is unprecedented and we can't reproduce.

Try:

  • Create a new empty fresh clean Unity project

  • Import only PUN2

  • properly setup PhotonServerSettings and make sure it's there

  • setup demo scenes

  • setup player settings for Android or whatever target platform

  • for the Build Settings, enable all debug options to be able to see whole stack trace (line numbers and methods chain calls), "Script Debugging", "Development Build" etc.

  • build and test demos scenes

  • build and test the demo scene + test script DebugPhoton

If the issue persists:

  • try on different devices
  • try different Unity version
  • try different development machine
  • disable anti-virus software if any

Jhoan_steve_1994
2019-09-20 17:26:34

already solved

JohnTube
2019-09-21 18:15:04

Hi @Jhoan_steve_1994,

Could you share with us how?

Back to top