UIController
Cria e atualiza a UI, executa layouts e despacha eventos de input.
Criar no Editor
- Crie um GameObject e adicione
UIController. - Adicione elementos de UI como filhos desse objeto.
Como Usar
- Pegue o componente com
myObject.findComponent(UIController.class). - Leia e altere as propriedades do componente para controlar o comportamento.
- Teste o input ou layout no modo Play.
Exemplo em Java
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;
}