Skip to main content

UI offset displaced wrong orientation in Luna

Possible solution:

  • Write a script / add code to toggle the object being enabled in the scene. Delaying this toggle by a few frames may be beneficial.
CLICK HERE for an example.
public GameObject ObjectToToggle;
public int frameCount = 0;
bool toggled = false;

private void Start()
{
if(ObjectToToggle == null)
{
ObjectToToggle = GameObject.Find("LayoutGroup");
}

StartCoroutine(Wait1Frame());
if (!toggled)
{
ObjectToToggle.SetActive(false);
toggled = true;
}
}

private void Update()
{
if (!ObjectToToggle.activeSelf)
{
if(frameCount < 5)
{
frameCount++;
}
else
{
ObjectToToggle.SetActive(true);
}
}
}

IEnumerator Wait1Frame()
{
yield return 0;
}