int2 causes constant flickers

Have a very simple editor and it just constantly flickers. Video: 8bxli

Unity version 2019.2.0a9, caused by this new PropertyField(int2)

Full source

// <copyright file="VisionInstallerEditor.cs" company="BovineLabs">
// Copyright (c) BovineLabs. All rights reserved.
// </copyright>

namespace BovineLabs.Vision.Editor
{
    using UnityEditor;
    using UnityEditor.UIElements;
    using UnityEngine;
    using UnityEngine.UIElements;

    /// <summary>
    /// The VisionInstallerEditor.
    /// </summary>
    [CustomEditor(typeof(VisionInstaller))]
    public class VisionInstallerEditor : Editor
    {
        /// <inheritdoc />
        public override VisualElement CreateInspectorGUI()
        {
            var container = new VisualElement();
            this.CreatePropertyFieldWithCheck(container, "size");
            this.CreatePropertyFieldWithCheck(container, "scale");
            this.CreatePropertyFieldWithCheck(container, "revealOpacities");
            this.CreatePropertyFieldWithCheck(container, "filterMode");

            var editorFoldout = new Foldout { text = "Editor", value = false };
            container.Add(editorFoldout);
            this.CreatePropertyFieldWithCheck(editorFoldout, "hideFog");

            return container;
        }

        private void CreatePropertyFieldWithCheck(VisualElement container, string propertyPath)
        {
            var property = this.serializedObject.FindProperty(propertyPath);
            if (property == null)
            {
                Debug.LogError($"Property {propertyPath} was not found: renamed or removed");
                return;
            }

            container.Add(new PropertyField(property));
        }
    }
}

Hello, could you also post VisionInstaller’s code? The part where the properties are declared?

Sure

// <copyright file="VisionInstaller.cs" company="BovineLabs">
//     Copyright (c) BovineLabs. All rights reserved.
// </copyright>

namespace BovineLabs.Vision
{
    using System;
    using System.Collections.Generic;
    using BovineLabs.Common.Initialization;
    using BovineLabs.Common.Variables;
    using Unity.Entities;
    using Unity.Mathematics;
    using UnityEngine;

    /// <summary>
    ///     Shared settings for fog of war and related systems.
    /// </summary>
    [CreateAssetMenu(fileName = "VisionInstaller", menuName = "BovineLabs/Installers/Vision")]
    public class VisionInstaller : Installer
    {
        [SerializeField]
        private int2 size = new int2(512, 512);

        [SerializeField]
        private int2 offset = new int2(0, 0);

        [SerializeField]
        [Range(1, 8)]
        private int scale = 1;

        [SerializeField]
        private Color32 revealOpacities = new Color32(255, 127, 26, 255);

        [SerializeField]
        private FilterMode filterMode = FilterMode.Bilinear;

#if UNITY_EDITOR
        [SerializeField]
        private BoolVariable hideFog = default;
#endif

        /// <inheritdoc />
        public override void Initialize(World world, List<Type> systems)
        {
            world.AddSystem(new FogOfWarSystem(this.size, this.offset, this.scale, this.revealOpacities));
            world.AddSystem(new FogOfWarActiveSystem(this.size, this.offset, this.scale, this.filterMode)
            {
#if UNITY_EDITOR
                HideFog = this.hideFog
#endif
            });
            world.AddSystem(new RevealedSystem(this.size, this.scale));
        }
    }
}

BoolVariable is a custom scriptable object that I have a custom property drawer for. I thought it might be responsible but the issue persists with it removed.

I should add I’ve since been able to get an exception thrown on occasion if I try to drag the input fields.

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorGUI.HasKeyboardFocus (System.Int32 controlID) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:2001)
UnityEditor.EditorGUI.DoNumberField (UnityEditor.EditorGUI+RecycledTextEditor editor, UnityEngine.Rect position, UnityEngine.Rect dragHotZone, System.Int32 id, System.Boolean isDouble, System.Double& doubleVal, System.Int64& longVal, System.String formatString, UnityEngine.GUIStyle style, System.Boolean draggable, System.Double dragSensitivity) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:2015)
UnityEditor.EditorGUI.DoLongField (UnityEditor.EditorGUI+RecycledTextEditor editor, UnityEngine.Rect position, UnityEngine.Rect dragHotZone, System.Int32 id, System.Int64 value, System.String formatString, UnityEngine.GUIStyle style, System.Boolean draggable, System.Double dragSensitivity) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1988)
UnityEditor.EditorGUI.LongFieldInternal (UnityEngine.Rect position, UnityEngine.GUIContent label, System.Int64 value, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:2307)
UnityEditor.EditorGUI.LongField (UnityEngine.Rect position, UnityEngine.GUIContent label, System.Int64 value, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7035)
UnityEditor.EditorGUI.LongField (UnityEngine.Rect position, UnityEngine.GUIContent label, System.Int64 value) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7030)
UnityEditor.EditorGUI.DefaultPropertyField (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6063)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:149)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:106)
UnityEditor.EditorGUI.PropertyFieldInternal (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6041)
UnityEditor.EditorGUI.PropertyField (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7402)
UnityEditor.EditorGUI.PropertyField (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7397)
UnityEditor.EditorGUI.MultiPropertyField (UnityEngine.Rect position, UnityEngine.GUIContent[] subLabels, UnityEditor.SerializedProperty valuesIterator, UnityEditor.EditorGUI+PropertyVisibility visibility, System.Single labelWidth, System.Boolean[] disabledMask) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4251)
UnityEditor.EditorGUI.MultiPropertyField (UnityEngine.Rect position, UnityEngine.GUIContent[] subLabels, UnityEditor.SerializedProperty valuesIterator) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4229)
UnityEditor.EditorGUI.MultiPropertyField (UnityEngine.Rect position, UnityEngine.GUIContent[] subLabels, UnityEditor.SerializedProperty valuesIterator, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4224)
Unity.Mathematics.Editor.PrimitiveVectorDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Library/PackageCache/com.unity.mathematics@1.0.0-preview.1/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs:73)
UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:23)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:139)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:106)
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:208)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9352)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9346)
UnityEditor.UIElements.PropertyField.<Reset>m__0 () (at C:/buildslave/unity/build/Editor/Mono/UIElements/Controls/PropertyField.cs:105)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:281)
UnityEditor.UIElements.Tooltip:SetTooltip(Single, Single)

and I’m using the latest version, at least it was as of checking yesterday, of the mathematics package. “com.unity.mathematics”: “1.0.0-preview.1”,

I haven’t had success reproducing this, could you log a bug with a small repro project? Thanks!

I’ve submitted a bug report with a simpe project but I’ll post the project here as well. (I’ll add the bug report # when I get it.)

Unity Version 2019.2.0a9

-edit-

#1145908 was reproduced by Unity QA

4426525–404101–Vision.Simple.7z (14.4 KB)