I’ve been messing around with InputFields in Needle and found that they work fine for regular characters, but got an error with accented ones like “á”. Any ideas on how to fix this? Also, I noticed TextMeshPro InputFields aren’t working, only the legacy ones - is that right?
To get around the accented characters issue, I thought about using a standard HTML input field and button, and reading the input text from it in Needle. Maybe I could read the input box directly after a button press, or even read a parameter from the website URL. I’ve done this with regular Unity and WebGL exports before, but I’m not sure how to make it work with Needle.
Hello, the character needs to be present in the font atlas that is automatically generated. By default it includes all Ascii characters and all characters found on export in existing text components. You have a few options, either:
Add an AdditionalFontCharacter component in the scene and add the chars that must be included
Add a text component somewhere (you can set it to Editor Only) and add the characters there
edit the FontAsset import settings and explicitly setup your character set (default is dynamic)
TextMeshPro is currently exported as a static mesh by UnityGLTF and not dynamic. It is currently not fully supported
About your input suggestion: thats pretty much how the InputField works behind the scenes in Needle to make the keyboard show up etc
Awesome! thanks. I will try your suggestions during the day. Regarding reading a parameter from the url, like index.html?test=“hello”, is it possible to read this using Needle? I’m thinking reading the parameter using a javascript function added to the template, and then sending the variable somewhere?
Thanks! alright so I imagine the previous import and const goes in the template right? Now in Unity, how could I get the myParam const and do something with that? sorry for asking for a step by step haha but I’m a little lost!
So you write your application in typescript / javascript. You dont get it back into Unity. It’s the other way around (you setup your component, animations, materials in Unity and it gets exported to be used in threejs/Typescript/…)
Ohh I see, thanks for clearing that up. I was hoping on building a small app that takes some text from a url parameter and then displays a custom 3D model for each letter. So, the best way to go about this would be coding the logic directly in threejs/Typescript? Could I build the logic for this using regular C# inside Unity? I know the question is somewhat redundant but I just want to be clear on the limitations and possibilities
You have to code the logic in Typescript yes, C# logic is not exported.
For maybe trying to get a headstart if you have some C# script already there’s an experimental feature for converting Typescript skeleton files from existing C# code (they build the variable fields and methods but not the logic inside the methods). It’s available via Context Menus on components or script assets
It might be useful to get familiar with the syntax. But in general its very fast if you code in Typescript (and we have a compiler that builds Unity stub components for you from your Typescript files - so everything it’s really the other way around )