using System.Collections.Generic;
using TMPro;
using UnityEngine;
namespace WebViewStream
{
public class ConfigureNavBar : MonoBehaviour
{
[SerializeField]
private EndpointLoader endpointLoader;
private bool isVisible = false;
///
/// Toggles the visibility of the address field in the nav bar.
///
public void ToggleVisibilityMethod()
{
List canvases = endpointLoader.GetInstantiatedItems();
isVisible = !isVisible;
foreach (GameObject canvas in canvases)
{
TMP_InputField inputField = canvas.GetComponentInChildren(true);
if (inputField != null)
{
Debug.Log("Setting address field visibility to " + isVisible);
inputField.gameObject.SetActive(isVisible);
}
BoxCollider boxCollider = canvas.GetComponent();
if (boxCollider != null)
{
boxCollider.size = new Vector3(
boxCollider.size.x,
isVisible ? 400 : 370,
boxCollider.size.z
);
boxCollider.center = new Vector3(0, isVisible ? 0 : -16, 0);
}
}
}
}
}