Skip to content

Commit

Permalink
fix for Unity < 2021.3
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerTemp committed Nov 13, 2024
1 parent 8c67513 commit 9d09f3e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.4.12 ##

Fix not work with Unity < 2021.3

## 3.4.11 ##

1. `SaintsRow` now support managed reference type. [#80](https://github.com/TylerTemp/SaintsField/issues/80)
Expand Down
2 changes: 1 addition & 1 deletion Editor/Drawers/ResizableTextAreaAttributeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using System.Reflection;
using SaintsField.Editor.Core;
using SaintsField.Editor.Utils;
using SaintsField.Utils;
using UnityEditor;
using UnityEngine;
#if UNITY_2021_3_OR_NEWER
using System;
using SaintsField.Utils;
using UnityEngine.UIElements;
#endif

Expand Down
4 changes: 4 additions & 0 deletions Editor/Playa/SaintsRowAttributeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ private static (string error, int arrayIndex, object parent, object current) Get

private IEnumerable<ISaintsRenderer> ImGuiEnsureRenderers(SerializedProperty property)
{
#if UNITY_2021_3_OR_NEWER
if(property.propertyType == SerializedPropertyType.ManagedReference && property.managedReferenceValue == null)
{
return Array.Empty<ISaintsRenderer>();
}
#endif

// string key = $"{property.serializedObject.targetObject.GetInstanceID()}:{property.propertyPath}";
// if (GlobalCache.TryGetValue(key, out IReadOnlyList<ISaintsRenderer> result))
Expand Down Expand Up @@ -95,10 +97,12 @@ private IEnumerable<ISaintsRenderer> ImGuiEnsureRenderers(SerializedProperty pro

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
#if UNITY_2021_3_OR_NEWER
if(property.propertyType == SerializedPropertyType.ManagedReference && property.managedReferenceValue == null)
{
return EditorGUIUtility.singleLineHeight;
}
#endif

float fullWidth = _filedWidthCache <= 0
? EditorGUIUtility.currentViewWidth - EditorGUI.indentLevel * 15
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ namespace: `SaintsField`
### Change Log ###
**3.4.11**
**3.4.12**
1. `SaintsRow` now support managed reference type. [#80](https://github.com/TylerTemp/SaintsField/issues/80)
2. Add `Window/Saints/Create or Edit SaintsField Config` config tweak so you can change the default behavior of auto getters. [#72](https://github.com/TylerTemp/SaintsField/issues/72#issuecomment-2453595293)
3. UI Toolkit: fix auto-indent for foldout in nested layout can incorrectly indent some fields.
Fix not work with Unity < 2021.3
See [the full change log](https://github.com/TylerTemp/SaintsField/blob/master/CHANGELOG.md).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "today.comes.saintsfield",
"version": "3.4.11",
"version": "3.4.12",
"displayName": "SaintsField",
"description": "A Unity plugin for field in inspector",
"unity": "2019.1",
Expand Down

0 comments on commit 9d09f3e

Please sign in to comment.