OnRealtimeModelReplaced is not being called
using UnityEngine;
using Normal.Realtime;
using System.Collections;
using UnityEngine.XR.Interaction.Toolkit;
public class windStormPowerUp : RealtimeComponent<windStormPowerUpModel>
{
public bool shouldStart;
public GameObject wind;
public MeshRenderer meshRenderer;
public Collider coll;
public XRGrabInteractable grab;
public ParticleSystem particles;
public float windDuration;
void Start()
{
wind = GameObject.FindGameObjectWithTag("weather").transform.GetChild(0).gameObject;
}
protected override void OnRealtimeModelReplaced(windStormPowerUpModel previousModel, windStormPowerUpModel currentModel) {
print("test");
if (previousModel != null) {
previousModel.startedDidChange -= StartedDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.started = shouldStart;
}
UpdateStarted();
currentModel.startedDidChange += StartedDidChange;
}
}
private void StartedDidChange(windStormPowerUpModel model, bool value) {
UpdateStarted();
}
private void UpdateStarted() {
shouldStart= model.started;
print("get");
if(shouldStart)
{
meshRenderer.enabled = false;
coll.enabled = false;
grab.enabled=false;
particles.Stop();
StartCoroutine(windForce(windDuration));
}
else
{
wind.gameObject.SetActive(false);
}
}
public void SetStarted(bool started) {
model.started = started;
print("set");
}
}using UnityEngine;
using Normal.Realtime;
using System.Collections;
using UnityEngine.XR.Interaction.Toolkit;
public class windStormPowerUp : RealtimeComponent<windStormPowerUpModel>
{
public bool shouldStart;
public GameObject wind;
public MeshRenderer meshRenderer;
public Collider coll;
public XRGrabInteractable grab;
public ParticleSystem particles;
public float windDuration;
void Start()
{
wind = GameObject.FindGameObjectWithTag("weather").transform.GetChild(0).gameObject;
}
protected override void OnRealtimeModelReplaced(windStormPowerUpModel previousModel, windStormPowerUpModel currentModel) {
print("test");
if (previousModel != null) {
previousModel.startedDidChange -= StartedDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.started = shouldStart;
}
UpdateStarted();
currentModel.startedDidChange += StartedDidChange;
}
}
private void StartedDidChange(windStormPowerUpModel model, bool value) {
UpdateStarted();
}
private void UpdateStarted() {
shouldStart= model.started;
print("get");
if(shouldStart)
{
meshRenderer.enabled = false;
coll.enabled = false;
grab.enabled=false;
particles.Stop();
StartCoroutine(windForce(windDuration));
}
else
{
wind.gameObject.SetActive(false);
}
}
public void SetStarted(bool started) {
model.started = started;
print("set");
}
}when i run SetStarted(true), i only get "set" in the console. i tried re-adding the component and it didnt work.