PhotonNetwork.Instantiate calls aren't buffered?

Options
ubhkid
ubhkid
I was under the impression that PhotonNetwork.Instantiate calls were buffered calls, and connecting clients would receive the calls upon connecting even after the instantiate was already called? Am I wrong about this assumption? I've tried turning autoCleanUpPlayerObjects off to no avail. I'm not really sure what else I can try. Any insight?

Comments

  • ubhkid
    Options
    In my case I've got my character spawn script, which gets called on each client that connects to our "server".
    function Spawn(t : int) : IEnumerator {
    	if(!gameRules) return;
    	while(true) {
    		var randomize : int = Random.Range(0, gameRules.spawnPoints.length);
    		if(gameRules.spawnPoints[randomize].team == GameSetup.team) {
    			break;
    		}
    		Debug.Log("Looking for Spawn Point");
    		yield;
    	}
    	if(gameRules._gameType == GameType.Deathmatch) {
    		if(t == 1) {
    			localRef = PhotonNetwork.Instantiate(marinePrefab, gameRules.spawnPoints[randomize].transform.position, gameRules.spawnPoints[randomize].transform.rotation, 0);
    			playerGUI.WeaponSelect(localRef.transform);
    			totalMarines++;
    			photonView.RPC("SyncStats", PhotonTargets.Others, totalMarines, totalInsurgents);
    			team = 1;
    		} else if(t == 2) {
    			localRef = PhotonNetwork.Instantiate(insurgentPrefab, gameRules.spawnPoints[randomize].transform.position, gameRules.spawnPoints[randomize].transform.rotation, 0);
    			playerGUI.WeaponSelect(localRef.transform);
    			totalInsurgents++;
    			photonView.RPC("SyncStats", PhotonTargets.Others, totalMarines, totalInsurgents);
    			team = 2;
    		} else if(t == 3) {
    			Debug.Log("Attempting Auto Assign");
    			if(totalMarines < totalInsurgents) {
    				Debug.Log("Assigned To Marines");
    				Spawn(1);
    			} else if(totalInsurgents < totalMarines) {
    				Debug.Log("Assigned To Insurgents");
    				Spawn(2);
    			} else {
    				var randomizeTeam : int = Random.Range(1, 3);
    				if(randomizeTeam == 3) {
    					Spawn(3);
    					return;
    				}
    				Debug.Log("Random team: " + randomizeTeam);
    				Spawn(randomizeTeam);
    			}
    		}
    	}
    }
    

    The characters are only there on other clients if they're already connected prior to "spawning". Newly connected clients can't see the old ones. Is it just a flaw in my thinking? IIRC this was working before I updated photon, but I can't know for sure.

    EDIT* Confirmed that this wasn't a problem about a month ago, just tested on an old build of our game and this wasn't a problem. I'm at a loss here :( Is there any known bugs with 1.8?
  • Tobias
    Options
    It's not a known bug in 1.8 but maybe it's an unknown one.
    It should be buffered.
    We will look it up asap.
  • ubhkid
    Options
    In the mean time, could you think of anything at all that could be causing this on my end?
  • ubhkid
    Options
    I do use PhotonNetwork.isMessageQueueRunning = false / true while loading up levels. But I've already tried commenting that out to see if it was ignoring the buffered call on the first frame or something, no luck. I've also added in PhotonNetwork.autoCleanUpPlayerObjects = false to see if it was getting rid of the object on its own, also no luck. Are there any other settings that would dump buffered calls?
  • ubhkid
    Options
    How could I even remove something from the buffer? This problem has brought our project to a screeching halt. :(
  • dreamora
    Options
    by clearing the buffer which if you took Unity example code is actually done prior scene loading.
    Also remove all buffered calls for players naturally would do the same

    you don't happen to switch rooms when you load a new scene do you? cause RPCs exist only within the room they are issued, a roomswitch will 'reset' the environment basically
  • ubhkid
    Options
    No scene switching going on here. I clean up RPCs and player objects upon a round ending, just in case that was causing an issue I commented that code out. Still the same thing happening. I am at a complete loss. This is a very large project with tens of thousands of lines of code that has been crushed by a seemingly simple problem :oops:
  • ubhkid
    Options
    Wow, it was an issue on our end (of course). We ended up adding an intentional delay between scene switching (main menu -> game scene) for a better UX transition. This was added after the room had already been entered by photon, thus all buffered RPCs/Instantiates were being called inside of the main menu scene instead of the game scene. All is well now, and thank you for attempting to help us! Great team you guys have here!
  • dreamora
    Options
    Glad you got it sorted out :)
  • Tobias
    Options
    Oh, that's a tricky cause for this issue.
    Great to read you found it! Looking forward to see your game!