RPC Not loading upon new player joining

Options
N1warhead
N1warhead ✭✭
Hey guys, I've been trying to figure this out all day.

Here's what I have going on here.

I have a structure that can be destroyed.
Anyways, I have health syncing across network just fine, however, no matter what I have tried, the players joining don't get the buffered RPC.

However, as I have said, it syncs fine if players are already in game, EXAMPLE.

I shoot power plant, take half it's health, players in game see it, lets say I take 99% of it's health, everyone in game sees it, lets say somebody joins, it doesn't show it, but the way I have it coded, if I take the last 1% away, it will show the health sliders go to dead, etc. It's just all the INBETWEEN damage it doesn't seem to understand.

here is my code, maybe I can get an idea on what to do.

(P.S. - I'VE TRIED A SERIALIZEVIEW, it didn't work either, so I erased it.)
using UnityEngine.UI;

public class Green_PowerplantHealth : Photon.MonoBehaviour {

	public float health;                 // Starting health.
	public float curHealth;              // Current Health.
	public float damageAmount;
	public Slider healthSlider;
	public bool isDead;

	// Damage Variables
	public float StandardShell;          // This is the Standard Tank Shell.
	
	
	// Use this for initialization
	void Start () {
		curHealth = health;
		CheckHealth ();
	}


	public void CheckHealth(){
		curHealth -= damageAmount;
		}

	public void TakeDamage (float amount){
		
		curHealth -= amount;
		damageAmount = amount;
		if (curHealth <= 0 && !isDead) {
			photonView.RPC ("Die", PhotonTargets.AllBufferedViaServer);
		}
	}
	
	[RPC]
	void Die(){
		isDead = true;
		curHealth = 0;
		Debug.Log ("Green Power Plant DEAD");
		
	}

	public void OnTriggerEnter(Collider col){
		
		if (col.gameObject.tag == "StandardGreenShell") {     // ANY RED TEAM DAMAGES
			TakeDamage(StandardShell);
			Destroy(col.gameObject);
		}
		
	}
}

And here is my HEALTH SLIDER CODE
Encase it's needed.
// Update is called once per frame
	void Update () {

		GameObject other = GameObject.Find ("GreenPowerPlant");
		HealthSlider.value = other.gameObject.GetComponent<Green_PowerplantHealth> ().curHealth;
		}
}

Comments

  • N1warhead
    Options
    Well I feel about as dumb as a bag of rocks.

    I was doing the Serialize View fine when I did it earlier (I decided to try it again).

    Well, guess what, hahaahahah, I forgot to drag it into the Photon View... (Don't I just feel stupid LOL).