Here is my script.
using FishNet.Object;
using FishNet.Object.Synchronizing;
using FishNet.Transporting;
using System.Collections;
using UnityEngine;
using HutongGames.PlayMaker;
namespace Client.Health
{
public class ClientHealth : NetworkBehaviour
{
[SyncVar(Channel = Channel.Unreliable, ReadPermissions = ReadPermission.Observers, SendRate = 0.1f, OnChange = nameof(OnServerHealth))]
private float ServerHealth;
public float LocalHealth;
private void OnServerHealth(float prev, float next, bool asServer)
{
if (!asServer)
LocalHealth = ServerHealth;
else
Debug.Log($"New health value: {next}.");
}
}
}
I keep getting this error: [TargetParameterCountException: Number of parameters specified does not match the expected number]
I am trying to use Set Property on the script to get the private float, ServerHealth but it just doesnt work. What am I doing wrong?