Skip to content

Commit 7717391

Browse files
committed
Improved type look up to ignore unity and system assemblies
1 parent 3a8723d commit 7717391

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Assets/Kekser/SaveSystem/Attributes/SaveAttributeManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Reflection;
5+
using System.Text.RegularExpressions;
56
using Kekser.SaveSystem.Data;
67
using UnityEngine;
78

89
namespace Kekser.SaveSystem.Attributes
910
{
1011
public static class SaveAttributeManager
1112
{
13+
private const string AssembliesToIgnoreRegex = @"^Unity\.|^UnityEngine\.|^mscorlib|^System\.|^Mono\.";
14+
1215
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
1316
private static void Initialize()
1417
{
@@ -58,7 +61,7 @@ public static void CacheTypes()
5861

5962
foreach (Assembly assembly in assemblies)
6063
{
61-
if (!assembly.FullName.StartsWith("Assembly-CSharp") && !assembly.FullName.StartsWith("SaveSystem"))
64+
if (Regex.IsMatch(assembly.FullName, AssembliesToIgnoreRegex))
6265
continue;
6366

6467
Type[] types = assembly.GetTypes();

Assets/Kekser/SaveSystem/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.kekser.savesystem",
33
"displayName": "SaveSystem",
44
"author": { "name": "Kekser", "url": "https://github.com/DerKekser" },
5-
"version": "1.1.0",
5+
"version": "1.1.1",
66
"unity": "2020.3",
77
"description": "A save system for unity.",
88
"keywords": [ "save", "load" ],

0 commit comments

Comments
 (0)