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

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.

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.

Help syncing Health

2017-12-31 15:33:11

So i am working on FPS game. When i first made it (i followed tutorial on Photon website) it was working well. I had projectile firing and after it hit other player that player died no problem. I decided to add Raycast shooting rather than projectile however i have this huge issue... Health doesn't seem to be syncing and whenever lets say Player1 kills Player2, Player1 leaves the game instead of Player2... here are codes:


void Fire()
RaycastHit hit;
Debug.DrawRay (fpsCam.transform.position, fpsCam.transform.forward,;
if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit)) {
Debug.Log (;
PlayerManager1 target = hit.transform.GetComponent ();


public void TakeDamage (float amount)
Health -= amount;
if (Health <= 0f)


void Die ()

Please help. I am beginner in Photon and I'm kind of lost because there aren't too much tutorials out there :)


2018-01-03 11:40:57


Typically, you must not have each client check for damage, only the owner or only the masterClient, else you will run into race conditions and most likely differences in behavior due to the latency of the network, which is something unavoidable.

I strongly advice you check the basic tutorial which will show you one secure way to check for damage.

Make sure you go through the whole tutorial if it's not clear, this is a step by step tutorial. Let me know if you have questions after you went through it.



Back to top