Skip to content

Commit f4d5da0

Browse files
committed
Merge branch 'develop'
2 parents 4030355 + fb455eb commit f4d5da0

5 files changed

Lines changed: 58 additions & 3 deletions

File tree

Assets/Editor Toolbox/Editor/Drawers/Regular/TagSelectorAttributeDrawer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,5 @@ public override bool IsPropertyValid(SerializedProperty property)
5858
{
5959
return property.propertyType == SerializedPropertyType.String;
6060
}
61-
62-
63-
private TagSelectorAttribute Attribute => attribute as TagSelectorAttribute;
6461
}
6562
}

Assets/Editor Toolbox/Scripts/Attributes/RegularAttributes/TypeConstraintAttribute.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected TypeConstraintAttribute(Type assemblyType)
2828
/// </summary>
2929
public virtual List<Type> GetFilteredTypes()
3030
{
31+
#if UNITY_EDITOR
3132
var types = TypeCache.GetTypesDerivedFrom(AssemblyType).ToList();
3233
for (var i = types.Count - 1; i >= 0; i--)
3334
{
@@ -41,6 +42,9 @@ public virtual List<Type> GetFilteredTypes()
4142
}
4243

4344
return types;
45+
#else
46+
return new List<Type>();
47+
#endif
4448
}
4549

4650
/// <summary>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
#if UNITY_EDITOR
3+
using UnityEditor;
4+
#endif
5+
6+
namespace UnityEngine
7+
{
8+
[Serializable]
9+
public class SerializedDirectory : ISerializationCallbackReceiver
10+
{
11+
#if UNITY_EDITOR
12+
[SerializeField]
13+
private DefaultAsset directoryAsset;
14+
#endif
15+
[SerializeField, Disable]
16+
private string path;
17+
18+
void ISerializationCallbackReceiver.OnAfterDeserialize()
19+
{ }
20+
21+
void ISerializationCallbackReceiver.OnBeforeSerialize()
22+
{
23+
#if UNITY_EDITOR
24+
path = directoryAsset ? AssetDatabase.GetAssetPath(directoryAsset) : null;
25+
#endif
26+
}
27+
28+
#if UNITY_EDITOR
29+
public DefaultAsset DirectoryAsset
30+
{
31+
get => directoryAsset;
32+
set => directoryAsset = value;
33+
}
34+
#endif
35+
public string Path
36+
{
37+
get => path;
38+
set => path = value;
39+
}
40+
}
41+
}

Assets/Editor Toolbox/Scripts/Serialization/SerializedDirectory.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Examples/Scenes/SampleScene.unity

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,11 @@ MonoBehaviour:
706706
var2:
707707
scene1:
708708
sceneReference: {fileID: 102900000, guid: f11034f4657f51a47aac14f26410c500, type: 3}
709+
sceneName: SampleScene
709710
buildIndex: 0
710711
scene2:
711712
sceneReference: {fileID: 102900000, guid: f11034f4657f51a47aac14f26410c500, type: 3}
713+
sceneName: SampleScene
712714
buildIndex: 0
713715
bigNumber: 12345678
714716
currency: 20.41

0 commit comments

Comments
 (0)