Hello, I have a 3D Tiles model in Cesium Ion. I imported it into Unity, but when I use the script for the OBJ/FBX format game object, the information pop-up does not appear on the 3D Tiles game object. However, the script works for the OBJ/FBX format and the pop-up appears. Can anyone help with this? Thank you
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UIElements;
using UnityEngine.XR.Interaction.Toolkit;
using static BangunanDatabaseController;
public class BangunanController : MonoBehaviour
{
[TextArea(5, 5)]
public string content;
[Header("Material")]
public Outline bangunanOutline;
public PopUpController popUp;
LeftHandInteractor leftHand;
ActionBasedController leftHandABC;
public bool IsInitialized;
public bool clicked;
public BangunanDatabaseController.Bangunan bangunan;
private void Awake()
{
GetComponent<XRSimpleInteractable>().hoverEntered.AddListener(OnHoverEnter);
GetComponent<XRSimpleInteractable>().hoverExited.AddListener(OnHoverExit);
}
public void Initialize()
{
bangunanOutline = GetComponentInParent<Outline>();
popUp = FindObjectOfType<PopUpController>(true);
leftHand = FindObjectOfType<LeftHandInteractor>(true);
leftHandABC = leftHand.GetComponentInParent<ActionBasedController>(true);
leftHandABC.activateAction.action.performed += Action_performed;
bangunan = FindObjectOfType<BangunanDatabaseController>().bangunanList.Find(x => x.bangunanGameObject == gameObject);
IsInitialized = true;
}
private void Action_performed(InputAction.CallbackContext context)
{
if (this.enabled == true)
{
clicked = true;
Click();
}
}
public void Click()
{
if (DistanceCounter.instance.toggle == true)
return;
StringBuilder stringContent = new StringBuilder();
stringContent.AppendLine($"<b>NAME</b>\t: {bangunan.NAME}");
stringContent.AppendLine($"<b>HEIGHT</b>\t\t\t: {bangunan.HEIGHT}");
popUp.titleTMP.text = "INFORMATION";
popUp.contentTMP.text = stringContent.ToString();
popUp.gameObject.SetActive(false);
popUp.gameObject.SetActive(true);
bangunanOutline.enabled = true;
bangunanOutline.OutlineColor = Color.blue;
}
public void Close()
{
bangunanOutline.enabled = false;
bangunanOutline.OutlineColor = Color.white;
}
private void Update()
{
if (clicked == true && popUp.gameObject.activeSelf == false)
{
clicked = false;
this.enabled = false;
bangunanOutline.OutlineColor = Color.white;
bangunanOutline.enabled = false;
}
}
public void OnFocusEnter()
{
}
public void OnFocusExit()
{
}
public void OnHoverEnter(HoverEnterEventArgs args)
{
if (DistanceCounter.instance.toggle == true)
return;
if (!IsInitialized)
{
Initialize();
}
if (clicked)
return;
this.enabled = true;
Debug.Log("Hover Entered");
bangunanOutline.OutlineColor = Color.yellow;
bangunanOutline.enabled = true;
}
public void OnHoverExit(HoverExitEventArgs args)
{
if (DistanceCounter.instance.toggle == true)
return;
if (clicked)
return;
this.enabled = false;
Debug.Log("Hover Exit");
bangunanOutline.OutlineColor = Color.white;
bangunanOutline.enabled = false;
}
}