using System.Collections; using System.Collections.Generic; using UnityEngine; public class FunctionSync_Active : OneValueSyncObject { public void Init() { if (!hasInit) { InitDynamic("active_" + gameObject.name, CallBack, ValueType.Bool); } } /// /// 显示物体 /// public void ShowObject() { gameObject.SetActive(true); mybool = true; SendSync(); } /// /// 隐藏物体 /// public void DisShowObject() { gameObject.SetActive(false); mybool = false; SendSync(); } /// /// 回调 /// /// public void CallBack(string id,bool isEnterRoom) { if(mybool) { gameObject.SetActive(true); } else { gameObject.SetActive(false); } } }