Skip to main content

UIController

Creates and updates a UI canvas, handles layout passes, and dispatches UI input events.

Create in the Editor​

  1. Create a GameObject and add UIController.
  2. Add UI elements as children under this object.

How to Use​

  1. Get the component with myObject.findComponent(UIController.class).
  2. Read and write the component properties to control behavior.
  3. Test input or layout in Play mode.

Java Example​

SpatialObject myObject = /* your object */;
UIController comp = myObject.findComponent(UIController.class);
if (comp != null) {
// set the allowScreenTouch value:
comp.allowScreenTouch = true;
// read the allowScreenTouch value:
boolean allowScreenTouchValue = comp.allowScreenTouch;

// set the drawToScreen value:
comp.drawToScreen = true;
// read the drawToScreen value:
boolean drawToScreenValue = comp.drawToScreen;

// set the fixedResolutionPixelsHeight value:
comp.fixedResolutionPixelsHeight = 1;
// read the fixedResolutionPixelsHeight value:
int fixedResolutionPixelsHeightValue = comp.fixedResolutionPixelsHeight;

// set the fixedResolutionPixelsWidth value:
comp.fixedResolutionPixelsWidth = 1;
// read the fixedResolutionPixelsWidth value:
int fixedResolutionPixelsWidthValue = comp.fixedResolutionPixelsWidth;
// read the frameBuffer value:
FrameBuffer frameBufferValue = comp.frameBuffer;
// read the frameBufferH value:
int frameBufferHValue = comp.frameBufferH;
// read the frameBufferW value:
int frameBufferWValue = comp.frameBufferW;

// set the freeResolutionPixels value:
comp.freeResolutionPixels = 1;
// read the freeResolutionPixels value:
int freeResolutionPixelsValue = comp.freeResolutionPixels;
// read the imageRatio value:
float imageRatioValue = comp.imageRatio;

// set the pxSize value:
comp.pxSize = 1f;
// read the pxSize value:
float pxSizeValue = comp.pxSize;

// set the renderTextureFile value:
comp.renderTextureFile = "value";
// read the renderTextureFile value:
String renderTextureFileValue = comp.renderTextureFile;

// set the resolutionMode value:
comp.resolutionMode = new ResolutionMode();
// read the resolutionMode value:
ResolutionMode resolutionModeValue = comp.resolutionMode;

// set the resolutionPercentage value:
comp.resolutionPercentage = 1f;
// read the resolutionPercentage value:
float resolutionPercentageValue = comp.resolutionPercentage;
// read the touchPos value:
Vector2 touchPosValue = comp.touchPos;
// read the virtualToucheAt value:
Touch virtualToucheAtValue = comp.virtualToucheAt;

}