From a5b6e6110d6920d4062bc9fd76566b0c3e8bef0b Mon Sep 17 00:00:00 2001 From: Pasha Date: Wed, 28 Jan 2026 20:50:45 +0000 Subject: [PATCH] Removed static field support --- .../Editor/Caches/InspectorCallableCache.cs | 2 +- .../Pacore/Editor/Caches/MonoScriptCache.cs | 2 +- .../Caches/StaticInspectorFieldCache.cs | 57 ---------- .../Caches/StaticInspectorFieldCache.cs.meta | 3 - Assets/Pacore/Editor/Data.meta | 3 - .../Editor/Data/CreateScriptableObject.cs | 25 ----- .../Data/CreateScriptableObject.cs.meta | 3 - .../Pacore/Editor/Data/PacoreDataCreator.cs | 42 ------- .../Editor/Data/PacoreDataCreator.cs.meta | 3 - .../Data/StaticFieldValuesExtensions.cs | 97 ---------------- .../Data/StaticFieldValuesExtensions.cs.meta | 3 - .../Drawers/DetectInspectorChangesDrawer.cs | 2 +- .../Editor/Drawers/InspectorReadOnlyDrawer.cs | 2 +- .../Editor/Drawers/MonoBehaviourDrawer.cs | 54 +-------- .../Pacore/Editor/Drawers/MonoScriptDrawer.cs | 2 +- .../Editor/EditorWindows/ProfilerWindow.cs | 2 +- .../Attributes/DetectInspectorChanges.cs | 2 +- .../Runtime/Attributes/MonoScriptAttribute.cs | 2 +- .../Attributes/StaticInspectorField.cs | 2 +- Assets/Pacore/Runtime/ClassAttributeCache.cs | 5 - Assets/Pacore/Runtime/Data.meta | 3 - Assets/Pacore/Runtime/Data/DataLoader.cs | 106 ------------------ Assets/Pacore/Runtime/Data/DataLoader.cs.meta | 3 - .../Pacore/Runtime/Data/StaticFieldValues.cs | 22 ---- .../Runtime/Data/StaticFieldValues.cs.meta | 3 - .../Pacore/Runtime/DevTools/CodeProfiler.cs | 2 +- .../Runtime/Threading/ThreadDispatcher.cs | 2 +- .../Runtime/Threading/ThreadEnforcer.cs | 5 +- .../Pacore/Runtime/Threading/ThreadSafeTry.cs | 2 +- Assets/TestMonoBehaviour.cs | 24 ---- Assets/TestMonoBehaviour.cs.meta | 11 -- 31 files changed, 16 insertions(+), 480 deletions(-) delete mode 100644 Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs delete mode 100644 Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs.meta delete mode 100644 Assets/Pacore/Editor/Data.meta delete mode 100644 Assets/Pacore/Editor/Data/CreateScriptableObject.cs delete mode 100644 Assets/Pacore/Editor/Data/CreateScriptableObject.cs.meta delete mode 100644 Assets/Pacore/Editor/Data/PacoreDataCreator.cs delete mode 100644 Assets/Pacore/Editor/Data/PacoreDataCreator.cs.meta delete mode 100644 Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs delete mode 100644 Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs.meta delete mode 100644 Assets/Pacore/Runtime/Data.meta delete mode 100644 Assets/Pacore/Runtime/Data/DataLoader.cs delete mode 100644 Assets/Pacore/Runtime/Data/DataLoader.cs.meta delete mode 100644 Assets/Pacore/Runtime/Data/StaticFieldValues.cs delete mode 100644 Assets/Pacore/Runtime/Data/StaticFieldValues.cs.meta delete mode 100644 Assets/TestMonoBehaviour.cs delete mode 100644 Assets/TestMonoBehaviour.cs.meta diff --git a/Assets/Pacore/Editor/Caches/InspectorCallableCache.cs b/Assets/Pacore/Editor/Caches/InspectorCallableCache.cs index 806a4e7..1050d1d 100644 --- a/Assets/Pacore/Editor/Caches/InspectorCallableCache.cs +++ b/Assets/Pacore/Editor/Caches/InspectorCallableCache.cs @@ -55,4 +55,4 @@ namespace PashaBibko.Pacore.Editor.Caches return array; } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/Caches/MonoScriptCache.cs b/Assets/Pacore/Editor/Caches/MonoScriptCache.cs index 777b1c8..c72fb4c 100644 --- a/Assets/Pacore/Editor/Caches/MonoScriptCache.cs +++ b/Assets/Pacore/Editor/Caches/MonoScriptCache.cs @@ -31,4 +31,4 @@ namespace PashaBibko.Pacore.Editor.Caches return script; } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs b/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs deleted file mode 100644 index c567cd2..0000000 --- a/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs +++ /dev/null @@ -1,57 +0,0 @@ -using PashaBibko.Pacore.Attributes; -using System.Collections.Generic; -using System.Reflection; -using System; - -namespace PashaBibko.Pacore.Editor.Caches -{ - public static class StaticInspectorFieldCache - { - public struct FieldData - { - public FieldInfo Info; - public object Value; - } - - private const BindingFlags BINDING_FLAGS = - BindingFlags.Static | - BindingFlags.NonPublic | - BindingFlags.Public; - - private static Dictionary Cache { get; } = new(); - - public static FieldData[] GetAllFieldsOfType(Type type) - { - /* Checks the cache for the type */ - if (Cache.TryGetValue(type, out FieldData[] cached)) - { - return cached; - } - - /* Else finds all the fields with the attribute */ - FieldInfo[] fields = type.GetFields(BINDING_FLAGS); - List instances = new(); - - foreach (FieldInfo field in fields) - { - StaticInspectorFieldAttribute attribute - = field.GetCustomAttribute(); - - if (attribute != null) - { - FieldData data = new() - { - Info = field - }; - - instances.Add(data); - } - } - - /* Adds the fields to the cache before returning */ - FieldData[] array = instances.ToArray(); - Cache.Add(type, array); - return array; - } - } -} \ No newline at end of file diff --git a/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs.meta b/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs.meta deleted file mode 100644 index e890ecf..0000000 --- a/Assets/Pacore/Editor/Caches/StaticInspectorFieldCache.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7c0d83f0696f4a8d92f0ad89514645f4 -timeCreated: 1769350289 \ No newline at end of file diff --git a/Assets/Pacore/Editor/Data.meta b/Assets/Pacore/Editor/Data.meta deleted file mode 100644 index 22716e6..0000000 --- a/Assets/Pacore/Editor/Data.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 023429caa3904eb99618d2b079e3a508 -timeCreated: 1769386974 \ No newline at end of file diff --git a/Assets/Pacore/Editor/Data/CreateScriptableObject.cs b/Assets/Pacore/Editor/Data/CreateScriptableObject.cs deleted file mode 100644 index caff907..0000000 --- a/Assets/Pacore/Editor/Data/CreateScriptableObject.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.IO; -using UnityEditor; -using UnityEngine; - -namespace PashaBibko.Pacore.Editor.Data -{ - public static class ScriptableObjectGenerator - { - public static T Create(string path, string name) where T : ScriptableObject - { - /* Creates the asset instance */ - T asset = ScriptableObject.CreateInstance(); - - /* Creates the file on disk */ - string fullpath = Path.Join(path, name); - AssetDatabase.CreateAsset(asset, fullpath); - - /* Refreshes the asset database before returning */ - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - - return asset; - } - } -} diff --git a/Assets/Pacore/Editor/Data/CreateScriptableObject.cs.meta b/Assets/Pacore/Editor/Data/CreateScriptableObject.cs.meta deleted file mode 100644 index d5bc177..0000000 --- a/Assets/Pacore/Editor/Data/CreateScriptableObject.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 670c37fd285242438eabfb6c328a7e53 -timeCreated: 1769363293 \ No newline at end of file diff --git a/Assets/Pacore/Editor/Data/PacoreDataCreator.cs b/Assets/Pacore/Editor/Data/PacoreDataCreator.cs deleted file mode 100644 index 7b852d4..0000000 --- a/Assets/Pacore/Editor/Data/PacoreDataCreator.cs +++ /dev/null @@ -1,42 +0,0 @@ -using PashaBibko.Pacore.Data; -using UnityEditor; -using System.IO; -using System.Reflection; - -namespace PashaBibko.Pacore.Editor.Data -{ - [InitializeOnLoad] public static class PacoreDataCreator - { - private static StaticFieldValues ValuesAsset; - - static PacoreDataCreator() // Runs on editor startup or recompile - { - /* Creates the folder for the data files */ - if (!Directory.Exists(PacoreDataLoader.FullResourcesPath)) - { - Directory.CreateDirectory(PacoreDataLoader.FullResourcesPath); - } - - /* Creates the ScriptableObject asset file for StaticFieldValues */ - const string VALUES_NAME = "StaticFieldValues.asset"; // .asset is REQUIRED by unity API - string valuesPath = Path.Combine(PacoreDataLoader.ResourcesPath, VALUES_NAME); - if (!File.Exists(valuesPath)) - { - ValuesAsset = ScriptableObjectGenerator.Create - ( - path: PacoreDataLoader.ResourcesPath, - name: VALUES_NAME - ); - } - - /* If one already exists loads it */ - else - { - ValuesAsset = AssetDatabase.LoadAssetAtPath(valuesPath); - } - } - - public static void SetStaticFieldValue(FieldInfo field, object value) - => ValuesAsset.AddValue(field, value); - } -} diff --git a/Assets/Pacore/Editor/Data/PacoreDataCreator.cs.meta b/Assets/Pacore/Editor/Data/PacoreDataCreator.cs.meta deleted file mode 100644 index 8e7b230..0000000 --- a/Assets/Pacore/Editor/Data/PacoreDataCreator.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: da662fed35ba45aa890b57c00f94a987 -timeCreated: 1769375660 \ No newline at end of file diff --git a/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs b/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs deleted file mode 100644 index d0d5345..0000000 --- a/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using PashaBibko.Pacore.Data; -using UnityEditor; -using UnityEngine; - -namespace PashaBibko.Pacore.Editor.Data -{ - public static class StaticFieldValuesExtensions - { - public static void AddValue(this StaticFieldValues asset, FieldInfo info, object value) - { - /* Checks field has a declaring type */ - Type declaringType = info.DeclaringType; - if (declaringType == null) - { - Debug.LogError($"[StaticFieldValues] Cannot add field {info.Name} because it has no declaring type"); - return; - } - - /* Checks if the type is already contained */ - string typename = declaringType.FullName; - int tIdx = -1; - - if (asset.StoredValues != null) - { - for (int i = 0; i < asset.StoredValues.Length; i++) - { - if (asset.StoredValues[i].Typename == typename) - { - tIdx = i; - break; - } - } - } - - /* Adds the type if it is not contained */ - if (tIdx == -1) - { - StaticFieldValues.TypeFieldValues newType = new() - { - Typename = typename, - Fields = Array.Empty() - }; - - List types = asset.StoredValues?.ToList() ?? - new List(); - types.Add(newType); - - asset.StoredValues = types.ToArray(); - tIdx = types.Count - 1; // -1 for 0 based indexing - } - - /* Checks if the field is already contained in the type */ - string fieldName = info.Name; - int sIdx = -1; - - Debug.Assert(asset.StoredValues != null, nameof(asset.StoredValues) + " != null"); - for (int i = 0; i < asset.StoredValues[tIdx].Fields.Length; i++) - { - if (asset.StoredValues[tIdx].Fields[i].Name == fieldName) - { - sIdx = i; - break; - } - } - - /* Adds the field if it is not contained */ - if (sIdx == -1) - { - StaticFieldValues.FieldValue newValue = new() - { - SerializedValue = value.ToString(), - Name = fieldName - }; - - List fields = asset.StoredValues[tIdx].Fields?.ToList() ?? - new List(); - fields.Add(newValue); - - asset.StoredValues[tIdx].Fields = fields.ToArray(); - } - - /* Else updates the value */ - else - { - asset.StoredValues[tIdx].Fields[sIdx].SerializedValue = value.ToString(); - } - - /* Tells Unity to save the value */ - EditorUtility.SetDirty(asset); - AssetDatabase.SaveAssets(); - } - } -} \ No newline at end of file diff --git a/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs.meta b/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs.meta deleted file mode 100644 index 4bca6b9..0000000 --- a/Assets/Pacore/Editor/Data/StaticFieldValuesExtensions.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4ba9a121a4524876b105945f75e1e79d -timeCreated: 1769387061 \ No newline at end of file diff --git a/Assets/Pacore/Editor/Drawers/DetectInspectorChangesDrawer.cs b/Assets/Pacore/Editor/Drawers/DetectInspectorChangesDrawer.cs index 3b20c42..34175a5 100644 --- a/Assets/Pacore/Editor/Drawers/DetectInspectorChangesDrawer.cs +++ b/Assets/Pacore/Editor/Drawers/DetectInspectorChangesDrawer.cs @@ -43,4 +43,4 @@ namespace PashaBibko.Pacore.Editor.Drawers EditorGUI.EndProperty(); } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/Drawers/InspectorReadOnlyDrawer.cs b/Assets/Pacore/Editor/Drawers/InspectorReadOnlyDrawer.cs index be5e091..377d202 100644 --- a/Assets/Pacore/Editor/Drawers/InspectorReadOnlyDrawer.cs +++ b/Assets/Pacore/Editor/Drawers/InspectorReadOnlyDrawer.cs @@ -20,4 +20,4 @@ namespace PashaBibko.Pacore.Editor.Drawers } } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/Drawers/MonoBehaviourDrawer.cs b/Assets/Pacore/Editor/Drawers/MonoBehaviourDrawer.cs index 9f6d1ac..c60ea3c 100644 --- a/Assets/Pacore/Editor/Drawers/MonoBehaviourDrawer.cs +++ b/Assets/Pacore/Editor/Drawers/MonoBehaviourDrawer.cs @@ -2,9 +2,6 @@ using UnityEditor; using UnityEngine; using System; -using System.Reflection; -using PashaBibko.Pacore.Attributes; -using PashaBibko.Pacore.Editor.Data; using Object = UnityEngine.Object; namespace PashaBibko.Pacore.Editor.Drawers @@ -16,7 +13,6 @@ namespace PashaBibko.Pacore.Editor.Drawers { DrawDefaultInspector(); DrawFunctionButtons(target); - DrawStaticFields(target); } public static void DrawFunctionButtons(Object target) @@ -42,53 +38,5 @@ namespace PashaBibko.Pacore.Editor.Drawers } } } - - public static void DrawStaticFields(Object target) - { - Type type = target.GetType(); - StaticInspectorFieldCache.FieldData[] fields - = StaticInspectorFieldCache.GetAllFieldsOfType(type); - - if (fields.Length == 0) - { - return; - } - - EditorGUILayout.Space(); - EditorGUILayout.LabelField("Static Fields (only applied at runtime)", EditorStyles.boldLabel); - - for (int i = 0; i < fields.Length; i++) - { - EditorGUI.BeginChangeCheck(); - fields[i].Value = DrawStaticField(fields[i].Info, fields[i].Value); - bool changed = EditorGUI.EndChangeCheck(); - - if (changed) - { - PacoreDataCreator.SetStaticFieldValue(fields[i].Info, fields[i].Value); - } - } - } - - private static object DrawStaticField(FieldInfo field, object current) - { - Type type = field.FieldType; - string label = field.Name; - - if (type == typeof(int)) - return EditorGUILayout.IntField(label, current as int? ?? 0); - - if (type == typeof(float)) - return EditorGUILayout.FloatField(label, current as float? ?? 0f); - - if (type == typeof(string)) - return EditorGUILayout.TextField(label, current as string ?? ""); - - if (type == typeof(bool)) - return EditorGUILayout.Toggle(label, current as bool? ?? false); - - EditorGUILayout.LabelField(label, $"Unsupported type: {type.FullName}"); - return current; - } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/Drawers/MonoScriptDrawer.cs b/Assets/Pacore/Editor/Drawers/MonoScriptDrawer.cs index 324da35..f7c54a0 100644 --- a/Assets/Pacore/Editor/Drawers/MonoScriptDrawer.cs +++ b/Assets/Pacore/Editor/Drawers/MonoScriptDrawer.cs @@ -77,4 +77,4 @@ namespace PashaBibko.Pacore.Editor.Drawers property.stringValue = type.FullName; } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Editor/EditorWindows/ProfilerWindow.cs b/Assets/Pacore/Editor/EditorWindows/ProfilerWindow.cs index adfc17e..43bd23e 100644 --- a/Assets/Pacore/Editor/EditorWindows/ProfilerWindow.cs +++ b/Assets/Pacore/Editor/EditorWindows/ProfilerWindow.cs @@ -94,4 +94,4 @@ namespace Pacore.Editor.EditorWindows EditorGUILayout.EndScrollView(); } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Attributes/DetectInspectorChanges.cs b/Assets/Pacore/Runtime/Attributes/DetectInspectorChanges.cs index 9f052a6..d272b67 100644 --- a/Assets/Pacore/Runtime/Attributes/DetectInspectorChanges.cs +++ b/Assets/Pacore/Runtime/Attributes/DetectInspectorChanges.cs @@ -14,4 +14,4 @@ namespace PashaBibko.Pacore.Attributes ActionName = function; } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Attributes/MonoScriptAttribute.cs b/Assets/Pacore/Runtime/Attributes/MonoScriptAttribute.cs index ca79553..80e1d8b 100644 --- a/Assets/Pacore/Runtime/Attributes/MonoScriptAttribute.cs +++ b/Assets/Pacore/Runtime/Attributes/MonoScriptAttribute.cs @@ -21,4 +21,4 @@ namespace PashaBibko.Pacore.Attributes MonoType = type; } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Attributes/StaticInspectorField.cs b/Assets/Pacore/Runtime/Attributes/StaticInspectorField.cs index 1c4eb4b..38b3d37 100644 --- a/Assets/Pacore/Runtime/Attributes/StaticInspectorField.cs +++ b/Assets/Pacore/Runtime/Attributes/StaticInspectorField.cs @@ -4,4 +4,4 @@ namespace PashaBibko.Pacore.Attributes { [AttributeUsage(validOn: AttributeTargets.Field)] public class StaticInspectorFieldAttribute : Attribute { } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/ClassAttributeCache.cs b/Assets/Pacore/Runtime/ClassAttributeCache.cs index a4043db..db8da39 100644 --- a/Assets/Pacore/Runtime/ClassAttributeCache.cs +++ b/Assets/Pacore/Runtime/ClassAttributeCache.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System; -using PashaBibko.Pacore.Data; using UnityEngine; namespace PashaBibko.Pacore @@ -53,10 +52,6 @@ namespace PashaBibko.Pacore AttributeCache[type].Add(current); } } - - /* Initializes PacoreDataLoader as it requires this to have been loaded first */ - // TODO: Add a way for this to trigger an event that can be run by other scripts dynamically - PacoreDataLoader.LoadAndApplyStaticValues(); } } } diff --git a/Assets/Pacore/Runtime/Data.meta b/Assets/Pacore/Runtime/Data.meta deleted file mode 100644 index f51a5f7..0000000 --- a/Assets/Pacore/Runtime/Data.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d323da97ac614fdb8e6d952111ba0b7d -timeCreated: 1769362533 \ No newline at end of file diff --git a/Assets/Pacore/Runtime/Data/DataLoader.cs b/Assets/Pacore/Runtime/Data/DataLoader.cs deleted file mode 100644 index 81c4d1a..0000000 --- a/Assets/Pacore/Runtime/Data/DataLoader.cs +++ /dev/null @@ -1,106 +0,0 @@ -using UnityEngine; -using System.IO; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace PashaBibko.Pacore.Data -{ - public static class PacoreDataLoader - { - private const string PATH_FROM_RESOURCES = "PacoreData"; - private const string BASE_PATH = "Pacore/Resources/PacoreData"; - public static string FullResourcesPath => Path.Join(Application.dataPath, BASE_PATH); - public static string ResourcesPath => Path.Join("Assets", BASE_PATH); - - public static void LoadAndApplyStaticValues() - { - /* Loads the static values from the serialized file */ - string filename = Path.Join(PATH_FROM_RESOURCES, "StaticFieldValues"); - StaticFieldValues asset = Resources.Load(filename); - if (asset is null) - { - Debug.LogWarning("Could not find StaticFieldValues asset to load"); - return; - } - - /* Applies the values to the static fields */ - foreach (StaticFieldValues.TypeFieldValues values in asset.StoredValues) - { - /* Makes sure the type is valid before trying to apply values */ - Type type = Type.GetType($"{values.Typename}, Assembly-CSharp"); - if (type is null) - { - Debug.LogWarning($"Could not find type [{values.Typename}]"); - continue; - } - - ApplyStaticValuesToType(type, values.Fields); - } - } - - private static void ApplyStaticValuesToType(Type type, StaticFieldValues.FieldValue[] fields) - { - const BindingFlags FLAGS = BindingFlags.NonPublic | - BindingFlags.Public | - BindingFlags.Static; - - /* Converts the fields to a dictionary for easier access */ - Dictionary values = fields.ToDictionary - ( - f => f.Name, - f => f.SerializedValue - ); - - /* Fetches the static field values of the current type and applies the values */ - FieldInfo[] typeFields = type.GetFields(FLAGS); - foreach (FieldInfo field in typeFields) - { - string name = field.Name; - if (values.TryGetValue(name, out string serialized)) - { - object value = ConvertFromString(field.FieldType, serialized); - field.SetValue(null, value); - - Debug.Log($"Set [{field.Name}] to [{value}]"); - } - else - { - Debug.LogWarning($"Could not find field [{name}]"); - } - } - } - - private static object ConvertFromString(Type type, string serialized) - { - if (string.IsNullOrEmpty(serialized)) - return type.IsValueType ? Activator.CreateInstance(type) : null; - - if (type.IsEnum) - return Enum.Parse(type, serialized, ignoreCase: true); - - if (type == typeof(Vector2)) - return JsonUtility.FromJson(serialized); - - if (type == typeof(Vector3)) - return JsonUtility.FromJson(serialized); - - if (type == typeof(Vector4)) - return JsonUtility.FromJson(serialized); - - if (type == typeof(Color)) - return JsonUtility.FromJson(serialized); - - if (type == typeof(string)) - return serialized; - - if (type.IsPrimitive || type == typeof(decimal)) - return Convert.ChangeType(serialized, type); - - return type.IsSerializable - ? JsonUtility.FromJson(serialized, type) - : throw new NotSupportedException($"Cannot convert {type} to type {type.FullName}"); - } - } -} diff --git a/Assets/Pacore/Runtime/Data/DataLoader.cs.meta b/Assets/Pacore/Runtime/Data/DataLoader.cs.meta deleted file mode 100644 index ca6c947..0000000 --- a/Assets/Pacore/Runtime/Data/DataLoader.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 79da011308294074b6edb339ac2f271b -timeCreated: 1769372269 \ No newline at end of file diff --git a/Assets/Pacore/Runtime/Data/StaticFieldValues.cs b/Assets/Pacore/Runtime/Data/StaticFieldValues.cs deleted file mode 100644 index ab57ebc..0000000 --- a/Assets/Pacore/Runtime/Data/StaticFieldValues.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UnityEngine; -using System; - -namespace PashaBibko.Pacore.Data -{ - public class StaticFieldValues : ScriptableObject - { - [Serializable] public struct FieldValue - { - public string SerializedValue; - public string Name; - } - - [Serializable] public struct TypeFieldValues - { - public string Typename; - public FieldValue[] Fields; - } - - public TypeFieldValues[] StoredValues; - } -} diff --git a/Assets/Pacore/Runtime/Data/StaticFieldValues.cs.meta b/Assets/Pacore/Runtime/Data/StaticFieldValues.cs.meta deleted file mode 100644 index 912c2c9..0000000 --- a/Assets/Pacore/Runtime/Data/StaticFieldValues.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7e0846e954a8489cbc43e81d8f1dcc01 -timeCreated: 1769362550 \ No newline at end of file diff --git a/Assets/Pacore/Runtime/DevTools/CodeProfiler.cs b/Assets/Pacore/Runtime/DevTools/CodeProfiler.cs index dcd3f8d..6892ff6 100644 --- a/Assets/Pacore/Runtime/DevTools/CodeProfiler.cs +++ b/Assets/Pacore/Runtime/DevTools/CodeProfiler.cs @@ -39,4 +39,4 @@ namespace PashaBibko.Pacore.DevTools } } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Threading/ThreadDispatcher.cs b/Assets/Pacore/Runtime/Threading/ThreadDispatcher.cs index a9f91b6..2bb646c 100644 --- a/Assets/Pacore/Runtime/Threading/ThreadDispatcher.cs +++ b/Assets/Pacore/Runtime/Threading/ThreadDispatcher.cs @@ -115,4 +115,4 @@ namespace PashaBibko.Pacore.Threading } } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Threading/ThreadEnforcer.cs b/Assets/Pacore/Runtime/Threading/ThreadEnforcer.cs index bd30802..8ae9416 100644 --- a/Assets/Pacore/Runtime/Threading/ThreadEnforcer.cs +++ b/Assets/Pacore/Runtime/Threading/ThreadEnforcer.cs @@ -13,7 +13,8 @@ namespace PashaBibko.Pacore.Threading { public IncorrectThreadException(string message) : base(message) - { } + { + } } [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] @@ -40,4 +41,4 @@ namespace PashaBibko.Pacore.Threading } } } -} \ No newline at end of file +} diff --git a/Assets/Pacore/Runtime/Threading/ThreadSafeTry.cs b/Assets/Pacore/Runtime/Threading/ThreadSafeTry.cs index 4b676ce..b615a5b 100644 --- a/Assets/Pacore/Runtime/Threading/ThreadSafeTry.cs +++ b/Assets/Pacore/Runtime/Threading/ThreadSafeTry.cs @@ -22,4 +22,4 @@ namespace PashaBibko.Pacore.Threading finally { final?.Invoke(); } } } -} \ No newline at end of file +} diff --git a/Assets/TestMonoBehaviour.cs b/Assets/TestMonoBehaviour.cs deleted file mode 100644 index fefe8b3..0000000 --- a/Assets/TestMonoBehaviour.cs +++ /dev/null @@ -1,24 +0,0 @@ -using PashaBibko.Pacore.Attributes; -using UnityEngine; - -[CreateInstanceOnStart] public class TestMonoBehaviour : MonoBehaviour -{ - public int TestValue; - - [StaticInspectorField] private static string StaticText; - [StaticInspectorField] private static string OtherStaticText; - [StaticInspectorField] private static int StaticInt = 0; - [StaticInspectorField] private static int OtherStaticInt = 0; - - [InspectorCallable(nameof(PrintStaticFields))] - public void PrintStaticFields() - { - Debug.Log - ( - $"{nameof(StaticInt)}: [{StaticInt}] " + - $"{nameof(OtherStaticInt)}: [{OtherStaticInt}] " + - $"{nameof(StaticText)}: [{StaticText}] " + - $"{nameof(OtherStaticText)}: [{OtherStaticText}]" - ); - } -} diff --git a/Assets/TestMonoBehaviour.cs.meta b/Assets/TestMonoBehaviour.cs.meta deleted file mode 100644 index 448f27b..0000000 --- a/Assets/TestMonoBehaviour.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a411a69d284bfd04bafc210a81b43e88 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: