Skip to content

Commit a20755b

Browse files
authored
[v0.3.8] Update serialize reference extensions dependency
* + * [v0.3.8-pre.1] bump version * Bump version to 0.3.8 and update dependencies
1 parent c0a59ff commit a20755b

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// © 2023-2024 Nikolay Melnikov <n.melnikov@depra.org>
2+
// © 2023-2026 Depra <n.melnikov@depra.org>
33

44
using System;
55
using System.Collections.Generic;
@@ -14,16 +14,23 @@ public sealed class ComponentSerializeReference : SerializeReferenceAttribute
1414

1515
public ComponentSerializeReference(string nameSubstring) => _nameSubstring = nameSubstring;
1616

17-
public override IEnumerable<Type> GetTypes(Type referenceType) =>
18-
from assembly in AppDomain.CurrentDomain.GetAssemblies()
19-
from extractedType in assembly.GetTypes()
20-
where extractedType.IsPublic &&
21-
extractedType.IsValueType &&
22-
!extractedType.IsGenericType &&
23-
extractedType.FullName!.Contains(_nameSubstring) &&
24-
!IsDefined(extractedType, HideSerializeReferenceAttribute.TYPE)
25-
// TODO: Uncomment this line after obsolete serialization is removed.
26-
// && extractedType.GetCustomAttribute<SerializableAttribute>() != null
27-
select extractedType;
17+
public override IEnumerable<Type> GetDerivedTypes(Type referenceType)
18+
{
19+
#if UNITY_EDITOR
20+
return from extractedType in UnityEditor.TypeCache.GetTypesDerivedFrom(referenceType)
21+
where extractedType.IsPublic &&
22+
extractedType.IsValueType &&
23+
!extractedType.IsGenericType &&
24+
extractedType.FullName!.Contains(_nameSubstring) &&
25+
!IsDefined(extractedType, HideSerializeReferenceAttribute.TYPE)
26+
// TODO: Uncomment this line after obsolete serialization is removed.
27+
// && extractedType.GetCustomAttribute<SerializableAttribute>() != null
28+
select extractedType;
29+
#else
30+
return Array.Empty<Type>();
31+
#endif
32+
}
33+
34+
public override IEnumerable<Type> GetGenericTypes(Type referenceType) => Array.Empty<Type>();
2835
}
2936
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "com.depra.ecs.hybrid",
3-
"version": "0.3.7",
3+
"version": "0.3.8",
44
"displayName": "Depra.Ecs.Hybrid",
55
"description": "Unity Conversion Workflow for Depra.Ecs. Easy convert GameObjects to Entity.",
66
"unity": "2022.3",
77
"license": "Apache-2.0",
88
"dependencies": {
99
"com.depra.ecs.unity": "0.3.4",
10-
"com.depra.serialize-reference.extensions": "0.0.14"
10+
"com.depra.serialize-reference.extensions": "0.0.17"
1111
},
1212
"keywords": [
1313
"ecs",

0 commit comments

Comments
 (0)