fr.jeanf.eventsystem 0.1.68 → 0.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,11 @@ public class ScriptableObjectManager : MonoBehaviour, IDebugBehaviour
18
18
 
19
19
  private Dictionary<Object, Dictionary<string, Object>> genericDictionary = new Dictionary<Object, Dictionary<string, Object>>();
20
20
 
21
- private void Awake()
21
+ private void OnEnable() => Subscribe();
22
+ private void OnDisable() => Unsubscribe();
23
+ private void OnDestroy() => Unsubscribe();
24
+
25
+ private void Subscribe()
22
26
  {
23
27
  foreach (var so in listOfPingableObjects)
24
28
  {
@@ -26,11 +30,10 @@ public class ScriptableObjectManager : MonoBehaviour, IDebugBehaviour
26
30
  so.OnEventRaised += RegisterSO;
27
31
  so.OnEventRemove += RemoveSOFromLists;
28
32
  }
33
+ RefreshPingableObjects.RaiseEvent();
29
34
  }
30
35
 
31
- private void OnEnable() => RefreshPingableObjects.RaiseEvent();
32
-
33
- private void OnDestroy()
36
+ private void Unsubscribe()
34
37
  {
35
38
  foreach (var so in listOfPingableObjects)
36
39
  {
@@ -38,6 +41,8 @@ public class ScriptableObjectManager : MonoBehaviour, IDebugBehaviour
38
41
  so.OnEventRaised -= null;
39
42
  so.OnEventRemove -= null;
40
43
  }
44
+ genericDictionary.Clear();
45
+ genericDictionary.TrimExcess();
41
46
  }
42
47
 
43
48
  private void RegisterSO(string id, ScriptableObject so)
@@ -0,0 +1,16 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!114 &11400000
4
+ MonoBehaviour:
5
+ m_ObjectHideFlags: 0
6
+ m_CorrespondingSourceObject: {fileID: 0}
7
+ m_PrefabInstance: {fileID: 0}
8
+ m_PrefabAsset: {fileID: 0}
9
+ m_GameObject: {fileID: 0}
10
+ m_Enabled: 1
11
+ m_EditorHideFlags: 0
12
+ m_Script: {fileID: 11500000, guid: d84ad29ba75bd634eb5eda8abf406faf, type: 3}
13
+ m_Name: RefreshPingableObjects 1
14
+ m_EditorClassIdentifier:
15
+ _guid:
16
+ description:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 9aa4febc867c7144b8a17028b2aa9a27
3
+ NativeFormatImporter:
4
+ externalObjects: {}
5
+ mainObjectFileID: 11400000
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"fr.jeanf.eventsystem",
3
- "version":"0.1.68",
3
+ "version":"0.1.69",
4
4
  "displayName":"Event System",
5
5
  "description":"This package contains a basic Event System based on Scriptable Objects as communication medium",
6
6
  "unity": "2021.3",