How to sync a property??
Ok so here is the issue. I made my player class already, pretty much implemented a lot dependent upon player and vice-a-versa. I know about syncVars, and I know about synclists(including struct), but I am still having trouble trying to figure out how to sync my Non- MonoBehaviour or NetworkBehaviour class sync some important information.
So basically say I actually want my player's max health to be sync'd. Now say I am using a system like the one here https://forum.unity.com/threads/tutorial-character-stats-aka-attributes-system.504095/
Player is not derived from another class. Might look like this:
using System;
using System.Generic;
using UnityEngine;
public class Player
{
int _maxHealth = 0;
public int MaxHealth
{
get{
if statBonus()
{return statBonus(_maxHealth);}
else
{return _maxHealth;}
I need to be able to sync the MaxHealth result somehow. I have been trying to figure out how to do this from a class that isn't MonoBehaviour or NetworkBehaviour class specifically.
Any ideas, thoughts or insights someone might want to share I would be very appreciative of some help on this matter. I do ofc have a NetworkBehaviour class like PlayerController on the player gameobject, after it is instantiated it initializes with a member of type player. Idk how this helps but I thought it was worth mentioning.
Your answer
Follow this Question
Related Questions
Unity Mirror OnStartServer spawn GameObjects 1 Answer
UNET Door sync 0 Answers
Network Rotation not sync 2 Answers
How to serialize a List of ContentPacks (from Morph3D) in Photon Unity Networking? 0 Answers
Unet Syncing Flashlights 2 Answers