updated dll, peer.Service() gives Object reference not se...

ximael
edited June 2014 in DotNet
Switched to a new photon version(Replaced dll).
I run unity project and catch about 100 errors: "Object reference not set to an instance of an object" at line "peer.Service();", even if I use "if (peer != null)".
	private const string serverHost = "localhost:5055";
	private const string appName = "ZServer";
	public PhotonPeer peer;
	private IGameListener gameListener;
	public string status = "";
	private bool isAppQuit = false;
	public bool inGame = false;
	private string curLvl;

	void Awake()
	{
		Application.runInBackground = true;
		DontDestroyOnLoad(this);
		peer = new PhotonPeer(this, ConnectionProtocol.Udp);
		peer.DebugOut = DebugLevel.ALL;
	}

	void Start() {}

	public void Disconnected(StatusCode statusCode)
	{
		gameListener.Disconnected(statusCode);
		if (!isAppQuit && curLvl != "intro") Application.LoadLevel("intro");
	}

	void Update()
	{
		if (peer != null) try { peer.Service(); }
		catch (Exception e) { Debug.Log(e.Message + e.StackTrace); }
	}
Errors appears only during start.
I hadn't those errors with old lib.
Photon3Unity3D.dll v3.2.2.1
win xp,
updated unity from 4.2 to 4.3, but no changes.

Comments

  • Try to use your Explorer or Finder and find all *.dll and *.pdb files. Delete anything that's Photon related while Unity is closed.
    Then put the current dll in Assets\Plugins\ and let Unity reimport all.

    I think this is a hicckup in Unity, not in the dll. But you should also look up other errors.
    In worst case, return to your older version.
  • Deleting didn't help.
    Object reference not set to an instance of an object/n  at ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.PhotonPeer.Service () [0x00000] in <filename unknown>:0 
      at PhotonHandler.Update () [0x0000b] in D:\Dropbox\Projects\Client\Assets\Scripts\PhotonHandler.cs:51 
    UnityEngine.Debug:Log(Object)
    PhotonHandler:Update() (at Assets/Scripts/PhotonHandler.cs:52)
    
    Seems, peer.Service() throws exception when not connected to server.
  • Ah, this points me to a known issue. It's actually fixed but we didn't release the SDK for a while, which is why it's still out there.
    Sorry about that.
    As quick fix, use this dll:
    https://dl.dropboxusercontent.com/u/429 ... -0-0-0.zip

    I will update the SDKs asap. Hopefully this week.