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.

Slider/Health Bar with Photon

redskry
2017-03-31 03:44:13

Hello everybody ! (sorry for my bad english i'm french ^^)

I use for my 2d Game a slider to make a Healthbar to my player, It's work fine in solo, but when i connect 2 player , if one get hurt, it's the slider of the second player who is changed (not the health)

The slider is attach to a canvas, and this canvas is attach to the player( to be instanciate with the player, even the slider don't care about the health value)

Thx if someone can help me ! Bye!

Comments

[Deleted User]
2017-04-03 09:16:06

Hi @redskry,

as far as I understand the player is already instantiated and has a reference to the health bar, am I right? In this case you can use for example the Update() function to regularly update the health bar with the health value from your character.

If you have problems synchronizing the health value of the characters, you may want to take a look at the Basics Tutorial. It provides a section about synchronizing a health value across the network.

redskry
2017-04-03 11:09:06

Thx ! i solved my problem , the Health bar worked perfectly but they was superposed with all bar , so i solved it with IsMine, and destroy if it's not mine ^^

Back to top