- Home /
SyncVar hook value is null
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class PrefabScript : NetworkBehaviour {
[SyncVar(hook="MakeTheChange")]
public Material material;
[SyncVar]
public Material newMaterial;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void MakeTheChange(Material value) {
GetComponent<MeshRenderer> ().material = value;
}
}
I can see MakeTheChange firing in the debugger, but value is always null. Any idea why it isn't passing the correct value?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612000240im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
3D Grappling Hook? 0 Answers
UNET syncvar hook not being called 1 Answer
How create Tool in Project area 1 Answer
SyncVar Hook not Updating after Client Joins 0 Answers
Grappling Hook? 1 Answer