private LayoutRouting GetLayoutRouting(Layout layout)
        {
            var layoutRouting = new LayoutRouting();

            layoutRouting.rootNodeName = layout.rootNodeName;
            layoutRouting.assetPath    = layout.assetPath;
            foreach (var component in layout.components)
            {
                foreach (var visualResponse in component.Value.visualResponses)
                {
                    switch (visualResponse.Value.componentProperty)
                    {
                    case ComponentPropertyTypes.button:
                        layoutRouting.buttons[component.Value.gamepadIndices.button.Value] = visualResponse.Value;
                        break;

                    case ComponentPropertyTypes.xAxis:
                        layoutRouting.axes[component.Value.gamepadIndices.xAxis.Value] = visualResponse.Value;
                        break;

                    case ComponentPropertyTypes.yAxis:
                        layoutRouting.axes[component.Value.gamepadIndices.yAxis.Value] = visualResponse.Value;
                        break;
                    }
                }
            }
            return(layoutRouting);
        }
        public async void Init(LayoutRouting layoutRouting, string url, System.Action <bool> callback = null)
        {
            this.layoutRouting = layoutRouting;
            _transform         = transform;
            onLoadCallback     = callback;
            if (gltfAsset == null)
            {
                gltfAsset = gameObject.AddComponent <GLTFast.GltfAsset>();
            }
            gltfAsset.loadOnStartup = false;
            gltfAsset.url           = url;
            var deferAgent = gameObject.AddComponent <WebGLDeferAgent>();
            var loadResult = await gltfAsset.Load(gltfAsset.url, null, deferAgent);

            OnGltfLoaded(loadResult);
        }
        private LayoutRouting[] CreateLayoutRoutings(Profile profile)
        {
            var layoutRoutings = new LayoutRouting[3];

            if (profile.layouts.left_right_none != null)
            {
                var layoutRouting = GetLayoutRouting(profile.layouts.left_right_none);;
                layoutRoutings[(int)Handedness.none]  = layoutRouting;
                layoutRoutings[(int)Handedness.left]  = layoutRouting;
                layoutRoutings[(int)Handedness.right] = layoutRouting;
            }
            else if (profile.layouts.left_right != null)
            {
                var layoutRouting = GetLayoutRouting(profile.layouts.left_right);;
                layoutRoutings[(int)Handedness.left]  = layoutRouting;
                layoutRoutings[(int)Handedness.right] = layoutRouting;
            }
            else
            {
                if (profile.layouts.left != null)
                {
                    layoutRoutings[(int)Handedness.left] = GetLayoutRouting(profile.layouts.left);
                }
                if (profile.layouts.right != null)
                {
                    layoutRoutings[(int)Handedness.right] = GetLayoutRouting(profile.layouts.right);
                }
            }

            if (profile.layouts.none != null)
            {
                layoutRoutings[(int)Handedness.none] = GetLayoutRouting(profile.layouts.none);
            }

            return(layoutRoutings);
        }