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”,