Skip to content

Commit 80da6e3

Browse files
Bruno MikoskiBruno Mikoski
authored andcommitted
Merge branch 'master' into feature/backing-field-support
2 parents cc17228 + 225fdb6 commit 80da6e3

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Scripts/Editor/Core/CodeGenerationUtility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ public static void GenerateIndirectAccessForCollectionItemType(string collection
346346

347347
// Delete any existing files that have the old deprecated extension.
348348
string deprecatedFileName = targetFileName + ExtensionOld;
349+
#if UNITY_2023_1_OR_NEWER
349350
if (AssetDatabase.AssetPathExists(deprecatedFileName))
351+
#else
352+
if (AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(deprecatedFileName) != null)
353+
#endif
350354
{
351355
Debug.LogWarning($"Deleting deprecated Indirect Access file '{deprecatedFileName}'.");
352356
AssetDatabase.DeleteAsset(deprecatedFileName);

Scripts/Editor/PropertyDrawers/CollectionItemPropertyDrawer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ internal void DrawCollectionItemDrawer(
114114
{
115115
float originY = position.y;
116116
position.height = 15;
117-
Rect prefixPosition = EditorGUI.PrefixLabel(position, label);
117+
bool shouldDrawLabel = OptionsAttribute.LabelMode != LabelMode.NoLabel;
118+
Rect prefixPosition = shouldDrawLabel ? EditorGUI.PrefixLabel(position, label) : position;
119+
118120
int indent = EditorGUI.indentLevel;
119121
EditorGUI.indentLevel = 0;
120122
if (collectionItem != null)

Scripts/Runtime/Attributes/SOCItemEditorOptionsAttribute.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ public enum DrawType
99
AsReference = 1
1010
}
1111

12+
public enum LabelMode
13+
{
14+
Default = 0,
15+
NoLabel = 1,
16+
//LabelOnSeparateLine = 2, // TODO
17+
}
18+
1219
#if UNITY_2022_2_OR_NEWER
1320
[Obsolete("DrawAsSOCItemAttribute is not needed anymore, since Unity 2022 PropertyDrawers can be applied to interfaces")]
1421
#endif
@@ -34,7 +41,9 @@ public class SOCItemEditorOptionsAttribute : Attribute
3441
/// If specified, only show collection items that belong to the collection assigned to the specified field.
3542
/// </summary>
3643
public string ConstrainToCollectionField { get; set; }
37-
44+
45+
public LabelMode LabelMode { get; set; }
46+
3847
/// <summary>
3948
/// If specified, will perform this method whenever the value changes.
4049
/// Parameters of the method should be: ItemType from, ItemType to
@@ -47,4 +56,4 @@ public class SOCItemEditorOptionsAttribute : Attribute
4756
public class CollectionItemEditorOptions : SOCItemEditorOptionsAttribute
4857
{
4958
}
50-
}
59+
}

0 commit comments

Comments
 (0)