cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Create a 3D Label widget from script

Laurenz
7-Bedrock

Create a 3D Label widget from script

I would like to parse some JSON and then create 3D Labels at runtime via script. Is it possible to create widgets from script?
What i found so far is the Home.json which stores all elements in the scene, and it seems Icould be able to add objects by writing to this file, but this honestly feels a little rough and i also doubt that that will work at runtime.
1 REPLY 1
jmikesell
15-Moonstone
(To:Laurenz)

I don't believe there is any way to create widgets at run. A solution and what i do it to just change the content (text or image src) via JS as needed. So for example i have localization of my experiences and i load a JSON object with all the things i want to change for each language. Some are images with local language text on them others are raw text for things like buttons and toggles. Then when you pick a language i just blast thru the section of this object with the chosen language key and feed it all into a $scope.setWidgetProp function.

 

With the exception of the problem you have found about 3D images not accepting new widths (and also not recalculating 'auto' widths) this works well.

Top Tags