Compare commits

..

4 Commits

Author SHA1 Message Date
github-actions[bot] 93d7e13f62 feat: Update package.json to 1.2.1 2024-01-10 07:02:25 +00:00
Makihiro f522e0f285 Merge pull request #47 from mackysoft/fix/compatibility-less-than-2021-3
Fix compatibility for less than Unity 2021.3
2024-01-10 16:01:46 +09:00
Makihiro d061f748b8 Fix compatibility for less than Unity 2021.3 2024-01-10 15:58:31 +09:00
Makihiro afb3089943 Update README.md 2023-12-31 18:56:57 +09:00
4 changed files with 13 additions and 4 deletions
@@ -1,4 +1,5 @@
#if UNITY_2019_3_OR_NEWER
// NOTE: managedReferenceValue getter is available only in Unity 2021.3 or later.
#if UNITY_2021_3_OR_NEWER
using UnityEditor;
using UnityEngine;
@@ -8,14 +8,19 @@ namespace MackySoft.SerializeReferenceExtensions.Editor {
public static class ManagedReferenceUtility {
public static object SetManagedReference (this SerializedProperty property,Type type) {
object result;
object result = null;
#if UNITY_2021_3_OR_NEWER
// NOTE: managedReferenceValue getter is available only in Unity 2021.3 or later.
if (property.managedReferenceValue != null)
{
// Restore an previous values from json.
string json = JsonUtility.ToJson(property.managedReferenceValue);
result = JsonUtility.FromJson(json, type);
}
else
#endif
if (result == null)
{
result = (type != null) ? Activator.CreateInstance(type) : null;
}
@@ -2,7 +2,7 @@
"name": "com.mackysoft.serializereference-extensions",
"displayName": "SerializeReference Extensions",
"author": { "name": "MackySoft", "url": "https://github.com/mackysoft" },
"version": "1.2.0",
"version": "1.2.1",
"unity": "2021.3",
"description": "Provide popup to specify the type of the field serialized by the [SerializeReference] attribute in the inspector.",
"keywords": [ "SerializeReference", "Editor" ],
+3
View File
@@ -15,6 +15,9 @@ The `SubclassSelector` attribute allows you to easily set subclasses of those ab
- Easily set subclass by popup.
- **[New]** Type finding by fuzzy finder.
- **[New]** Override the type name and path by the `AddTypeMenu` attribute.
- **[New]** Restore values of previous object from JSON when subclass is changed.
- **[New]** Copy & Paste the subclass properties.
- **[New]** Available `CustomPropertyDrawer` for subclasses.
## 📥 Installation