UIDynamicJoystick
Joystick que aparece onde o usuario toca e gera um eixo 2D.
Criar no Editor
- Garanta que existe um
UIControllerna cena. - Crie um GameObject e adicione
UIRect. - Adicione o componente
UIDynamicJoystick.
Como Usar
- Pegue o componente com
myObject.findComponent(UIDynamicJoystick.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 */;
UIDynamicJoystick comp = myObject.findComponent(UIDynamicJoystick.class);
if (comp != null) {
Texture tex = /* load texture */ null;
// set the backgroundColor value:
comp.backgroundColor = new Color(255, 255, 255, 255);
// read the backgroundColor value:
Color backgroundColorValue = comp.backgroundColor;
// set the backgroundTexture value:
comp.backgroundTexture = tex;
// read the backgroundTexture value:
Texture backgroundTextureValue = comp.backgroundTexture;
// set the handleSize value:
comp.handleSize = 1;
// read the handleSize value:
int handleSizeValue = comp.handleSize;
// set the handlerColor value:
comp.handlerColor = new Color(255, 255, 255, 255);
// read the handlerColor value:
Color handlerColorValue = comp.handlerColor;
// set the handlerTexture value:
comp.handlerTexture = tex;
// read the handlerTexture value:
Texture handlerTextureValue = comp.handlerTexture;
// set the size value:
comp.size = 1;
// read the size value:
int sizeValue = comp.size;
}
Notas
- Voce pode substituir imagens ou texturas no inspetor ou via codigo quando o componente suporta isso.