Closed davidzwa closed 5 years ago
Pinging @mackeyk24
I was gonna try this... If i can match up Unity GUI item to the equivalent BABYLON.GUI item ... plus use all the positioning and anchor info from unity to draw the Babylon GUI using that extra metadata... Then yep the toolkit will support that (When i can get time to play around with that stuff) :)
Cool, Im currently bashing my head against the BABYLON GUI tool. Will share anything usable from that on the same repo (https://github.com/davidzwa/BabylonUnityLearnings/issues)
Any hint on where I can make PR's for the Unity exporter? It's in my interest to dive in and make the conversion possible
Unless you are trying to change the core toolkit ... the best bet is to create a script component and do all the work there. I can then move your script code to the core once you workout how you do things in the script component
Yup core code (C#), most is not .ts-doable since it is about rendering the scene beforehand.
I will try to add support for Unity to Babylon GUI via metadata AFTER i get all the next toolkit stuff worked out. So wont be any time soon... Sorry... You will just have to attach a script component and write your code in a generalized way to REUSE that script component as a Unity GUI interface until i can do all this for you :)
Might post GUI work in my repo so people can reuse it.
Please do... and send to me so i can start to think about making gui support and difficult that will be for me, time, resources etc...
TL;DR Could we introduce the unity Canvas/UI designer to the scene API somewhere in the toolkit as a GUIComponent (derived from a BABYLON component, of course)?
The Question context So I'm wondering, in Unity we have an awesome way of designing a Canvas in 2D or 3D (yeah confusing: call it GUI canvas). Would it be possible to leverage this design awesomeness and create a Babylon interface which triggers either dat.js or the BABYLON.GUI AdvancedTexture on a canvas (only)? My primary focus is to update the GUI from components and provide button update callbacks to Typescript, but I'm stuck in how to do this without leaving a lot of design debt (buttons/input callbacks, text updaters)
So the typescript intellisense would know, ok, you have one GUI only and you can reference that from any GUIComponent. It would error out if you have no/more than 1 GUI's instantiated on the scene (for example a EditorScriptComponent with a Unity Canvas), so that's fine (designer stupidity isnt tolerated)
GUI data interface One of your tutorial vids (at 1:38:00) you are talking about the GUI side by introducing a .html file and injecting that into a Scene Manager option, which is not available anymore. Also, that way leaves a lot of design debt (global variables) and introduces the old way of javascript callbacks and doesnt leverage Typescript Interfaces. I come from an Angular TS/JS point of view and I no likey.
As always, let me know if I can be of any help to PR this stuff, but first, lets brainstorm.