Gist df11eb7e467ca076297a95d810e7539d
✓ Published0🌍 Public
UUtopiah
Last edited May 9, 2020
Created on May 9, 2020
This example demonstrates how to programmatically change a user’s avatar in a Mozilla Hubs client by targeting a specific avatar ID. It shows a function, `changeAvatarByAvatarId`, that updates the user’s profile state using the `window.APP.store.update` method, merging the new `avatarId` into the existing profile object. The code relies on the Hubs application’s internal React state management and exposes a testing hook via `window.APP.store.resetToRandomDefaultAvatar()`. It also references the avatar-editor component’s upload path for potential programmatic avatar customization, using the React framework.
AI-generated description