Beispiel #1
0
        public void TransferFromUnityComponents(Entity entity, IBindingContext context)
        {
            var canvas = context.GetUnityComponent <UnityEngine.Canvas>(entity);
            var scaler = context.GetUnityComponent <UnityEngine.UI.CanvasScaler>(entity);

            context.SetComponentData(entity, new UICanvas
            {
                matchWidthOrHeight  = scaler.matchWidthOrHeight,
                referenceResolution = scaler.referenceResolution,
                uiScaleMode         = scaler.uiScaleMode.Convert(),
                camera = context.GetEntityFromUnityComponent(canvas)
            });

            SetUnsupportedFields(canvas, scaler);
        }