Checkbox in UI

Is there checkbox functionality built in to needle? or i should imitate it myself using button.ts and different canvases?

Original Post on Discord

by user 697872771497328640

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.

Help requested: please wait a moment…

Qemist, Needle Engine does not have a built-in checkbox functionality. As mentioned in the documentation, UI components such as Button, Image, and RawImage can be used to create interactive elements (see the documentation). To imitate a checkbox, you can utilize a Button component and swap between different canvas objects or textures to represent the checked or unchecked state. You will need to manage the state and appearance changes in your scripts.

1 messages left GPT 4
thread_7QZ2sXqti5WdENLBM88xMc83
Thanks for your feedback!

Guys, I am not complaining, but this kind of functionality would be great to have in the future

by user 697872771497328640

A neat thing about NeedleEngine is that it matches component names. So you just need to add a component with the same name and the serialized property names to patch what you need.

Canvas stuff is a bit annoying though, because there’s like a second copy of all elements in a canvas.

However if you’re working with the engine, you probably really want to learn how to code typescript components and translating some of the default Unity Components is a good starting point to get familiar.
Toggle.ts

by user 165409711020179457

You can derive from the BaseUIComponent (instead of Behaviour) here to get some methods for easier canvas object access (if you need it) like the shadowComponent (which is the underlying three-mesh-ui object) or canvas or markDirty to force a three-mesh-ui update

awesome

by user 165409711020179457

Ohhh, great, thank you, @elZach thank you too

by user 697872771497328640