public static void OnDisplayRemoved(Ex.Display display, ExEntityLink link) { DisplayHook hook = link.GetComponent <DisplayHook>(); if (hook != null) { if (hook.child != null) { GameObject.Destroy(hook.child.gameObject); } DisplayHook.Destroy(hook); } }
public static void OnDisplayRemoved(Ex.Typed display, ExEntityLink link) { TypedHook hook = link.GetComponent <TypedHook>(); if (hook != null) { if (hook.type != null) { link.gameObject.name = "" + link.id; } DisplayHook.Destroy(hook); } }
public static void OnDisplayChanged(Ex.Display display, ExEntityLink link) { DisplayHook hook = link.Require <DisplayHook>(); if (hook.child == null || hook.prefab != display.prefab) { if (hook.child != null) { GameObject.Destroy(hook.child.gameObject); } hook.prefab = display.prefab; Transform prefab = SafeLoad <Transform>(display.prefab, "Models/Error"); Transform copy = GameObject.Instantiate(prefab, link.transform); hook.child = copy; } hook.child.localPosition = display.position; hook.child.localRotation = Quaternion.Euler(display.rotation); }