PropertyDefinition CreateProperty(PropertyAssetSettings settings)
    {
        PropertyDefinition def = new PropertyDefinition
        {
            Name         = "NewProperty",
            PropertyType = new PropertyTypeFloat {
                Compression = FloatCompression.Default()
            },
            AssetSettings   = settings,
            ReplicationMode = ReplicationMode.Everyone,
        };

        def.Oncreated();
        return(def);
    }
Пример #2
0
        public static FloatCompression EditFloatCompression(FloatCompression c)
        {
            if (c == null)
            {
                c = FloatCompression.Default();
            }

            c.Enabled = Toggle(c.Enabled);

            UnityEditor.EditorGUI.BeginDisabledGroup(!c.Enabled);
            c.MinValue = Mathf.Min(IntFieldOverlay(c.MinValue, "Min"), c.MaxValue - 1);
            c.MaxValue = Mathf.Max(IntFieldOverlay(c.MaxValue, "Max"), c.MinValue + 1);
            c.Accuracy = Mathf.Max(FloatFieldOverlay(c.Accuracy, "Accuracy"), 0.001f);
            GUILayout.Label("Bits: " + (c.Enabled ? c.BitsRequired : 32), EditorStyles.miniLabel, GUILayout.Width(50));
            UnityEditor.EditorGUI.EndDisabledGroup();

            return(c);
        }