I’m trying to use a VRCObjectPool for Billboard damage display, and I have them properly spawning, but the remote clients never get the correct values.
What’s happening is:
Billboard spawns from owner client, initializes values, and calls RequestSerialization(). Then, remote client eventually enables the Billboard, but the serialization event arrived too late and was dropped, so OnDeserialization is never called on remote client.
Is there some way for the object to request updated network variable values in OnEnable()? This is a really bad behavior, for a networked variable to not get updated, and I think I’ve followed all the best practices correctly.
Here’s a stripped down version of my code that may help.
Manager Class:
[NetworkCallable]
public void DisplayDamage(int value, Vector3 position)
{
if (!Networking.IsOwner(damageNumberPool.gameObject))
{
return;
}
GameObject obj = damageNumberPool.TryToSpawn();
if (obj != null)
{
BillboardFloat billboard = obj.GetComponent<BillboardFloat>();
billboard.Initialize(position, value.ToString());
}
}
BillboardFloat:
void OnEnable()
{
transform.position = startPos;
RequestSerialization();
}
public void Initialize(Vector3 position, string newText)
{
startPos = position;
transform.position = startPos;
text = newText;
SetText(newText);
RequestSerialization();
}
public override void OnDeserialization()
{
transform.position = startPos;
SetText(text);
base.OnDeserialization();
}