Skip to main content

Common Issues - UI

This page is dedicated to common issues surrounding UI. If you are experiencing an issue that does not relate to UI consider looking at one of the other pages in this section, which are also listed here.

Make sure to Update Playable!
A lot of times issues can be fixed by simply updating your plugin to the latest version, please make sure to check you are on the latest release version before looking further into this section. More info on how to do this here

Button.interactable set to false does not change color of button to visually see the button being disabled#

This may be caused by doing multiple actions with a button on the same frame.

Possible solution:

  • Wait 1 frame to do the action, as shown below.
IEnumerator TurnOffInteractable(Button button){    button.interactable = true;    yield return null; // We need to wait one frame so other code is excecuted    button.interactable = false;}

Screen Space - Camera with sorting set to highest gets buried under other elements#

This could be caused by Prefab values being taken over Scene values.

Possible solutions:

  • Set camera to Screen Space Overlay.
  • Unpack the Prefab.

Missing TMP Text#

This could be because the Resources option under Export type has not been ticked for inclusion (As TMP settings are stored inside of the Resources folder).

Possible solution:

  • Tick the Resources option under Export type. More info on how to do this here.

Cannot see sprite when using canvas in a canvas, with a sorting layer on the second canvas#

This could be because Luna handles canvas in a canvas differently than Unity.

Possible solution:

  • Don't use 2 canvasses stacked in each other.

Cannot set transform.position of a UI Image component using Image.transform.position it just stays as zero#

This occurs do to this behaviour currently being unsupported in the Luna engine.

Possible solution:

  • Try to use Image.transform.localPosition instead as this can be set. If you are setting the UI Image position from world space position using Camera.main.WorldToScreenPoint(), you may need to offset the final UI Image pixel position by doing the following:
pixelPositionFromWorldSpacePosition.x -= Screen.width / 2;
pixelPositionFromWorldSpacePosition.y -= Screen.height / 2;
Image.gameObject.transform.localPosition = pixelPositionFromWorldSpacePosition;

Icon and other UI buttons scaled incorrectly#

Possible solution:

  • Adjust the following Canvas Scaler settings:
    Screen Match Mode: 'Match Width Or Height'
    Reference Resolution values to fit and scale properly in different orientations.