Dynamic UI
Learn how to make UIs dynamic, responding to changes in data.
Reference variables
import { UiEntity, ReactEcs } from '@dcl/sdk/react-ecs'
import { playerCurrentPosition } from '/index.ts'
import { Color4 } from '@dcl/sdk/math'
// draw UI
export const uiMenu = () => (
<UiEntity
uiTransform={{
width: '100%',
height: '100px',
justifyContent: 'center',
alignItems: 'center',
}}
uiText={{ value: `Player: `+ playerCurrentPosition, fontSize: 40 }}
uiBackground={{ color: Color4.create(0.5, 0.8, 0.1, 0.6) }}
/>
)Call functions from inside a UI
Toggle a UI on and off
Dynamic UI entities
Last updated