PUN Health object (non-Player object)

Vlaxep

Active member
Hi,

Just trying to figure out what the requirements are for a non-player object/enemy which is not set up as a character, to have the health networked...

It's basically a turret using other assets and I need it's health attribute networked. Currently acts locally only.

I've done this in the past by making it 'invincible' if not master, however I don't think this keeps the actual health synced ie. in case of Host migration. So currently each remote machine is managing the health locally only, not being authorised by master.

Currently the object looks like this (or see components in pic):
- Attribute manager
- Health
- PhotonView
- Pun Health Monitor
- Pun Attribute Monitor
- Colliders applied in the 'Health' component for damageables

Am I missing any other components to make this sync, and more importantly for it to be authoritated by the MasterClient?

1649295271993.png
 
You will need a PunNetworkInfo component so the Health component knows to send the Damage event on line 312 of Health.cs
 
Top