Skip to content

Commit

Permalink
Throttle UI updateRate
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-liang committed Nov 13, 2023
1 parent d444323 commit ef77943
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/systems/ui/arenaui.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import MonoFontImage from './fonts/Roboto-Mono.png';
import { EVENTS } from '../../constants/ui';

AFRAME.registerSystem('arena-ui', {
schema: {
updateRate: { type: 'number', default: 50 },
},

init() {
this.tick = AFRAME.utils.throttleTick(this.tick, this.data.updateRate, this);

Promise.all([import('./fonts/Roboto-Regular-msdf.json'), import('./fonts/Roboto-Mono-msdf.json')]).then(
([RegularFontJSON, MonoFontJSON]) => {
ThreeMeshUI.FontLibrary.prepare(
Expand Down

0 comments on commit ef77943

Please sign in to comment.