From 20db73a43fcdb12b85a57ea8520ce4c998acb238 Mon Sep 17 00:00:00 2001 From: Adam Ramberg Date: Thu, 19 Mar 2020 08:20:15 +0100 Subject: [PATCH] Move sync variable instancer to collection to its own MB --- .../Assets/InfinityWaves/Enemy/Enemy.prefab | 54 +++++++++++++-- .../SyncGameObjectToList.cs | 2 +- .../SyncVariableInstancerToCollection.cs | 67 +++++++++++++++++++ .../SyncVariableInstancerToCollection.cs.meta | 11 +++ .../SyncVariableInstancerToCollection.meta | 8 +++ .../SyncBoolVariableInstancerToCollection.cs | 12 ++++ ...cBoolVariableInstancerToCollection.cs.meta | 11 +++ ...Collider2DVariableInstancerToCollection.cs | 12 ++++ ...der2DVariableInstancerToCollection.cs.meta | 11 +++ ...ncColliderVariableInstancerToCollection.cs | 12 ++++ ...liderVariableInstancerToCollection.cs.meta | 11 +++ .../SyncColorVariableInstancerToCollection.cs | 12 ++++ ...ColorVariableInstancerToCollection.cs.meta | 11 +++ .../SyncFloatVariableInstancerToCollection.cs | 12 ++++ ...FloatVariableInstancerToCollection.cs.meta | 11 +++ ...GameObjectVariableInstancerToCollection.cs | 12 ++++ ...bjectVariableInstancerToCollection.cs.meta | 11 +++ .../SyncIntVariableInstancerToCollection.cs | 12 ++++ ...ncIntVariableInstancerToCollection.cs.meta | 11 +++ ...SyncStringVariableInstancerToCollection.cs | 12 ++++ ...tringVariableInstancerToCollection.cs.meta | 11 +++ ...yncVector2VariableInstancerToCollection.cs | 12 ++++ ...ctor2VariableInstancerToCollection.cs.meta | 11 +++ ...yncVector3VariableInstancerToCollection.cs | 12 ++++ ...ctor3VariableInstancerToCollection.cs.meta | 11 +++ Packages/Core/Editor/Generator/AtomTypes.cs | 23 ++++--- ...ate__SyncVariableInstancerToCollection.txt | 17 +++++ ...SyncVariableInstancerToCollection.txt.meta | 7 ++ Packages/Core/Runtime/Interfaces/IVariable.cs | 7 ++ .../Core/Runtime/Interfaces/IVariable.cs.meta | 11 +++ .../MonoBehaviourHelpers/VariableResetter.cs | 2 +- .../AtomBaseVariableInstancer.cs | 2 +- .../SyncVariableInstancerToCollection.meta | 8 +++ ...hUserInputVariableInstancerToCollection.cs | 13 ++++ ...InputVariableInstancerToCollection.cs.meta | 11 +++ .../SyncVariableInstancerToCollection.meta | 8 +++ ...GameObjectVariableInstancerToCollection.cs | 13 ++++ ...bjectVariableInstancerToCollection.cs.meta | 11 +++ ...GameObjectVariableInstancerToCollection.cs | 13 ++++ ...bjectVariableInstancerToCollection.cs.meta | 11 +++ .../SyncVariableInstancerToCollection.meta | 8 +++ ...SceneFieldVariableInstancerToCollection.cs | 13 ++++ ...FieldVariableInstancerToCollection.cs.meta | 11 +++ 43 files changed, 545 insertions(+), 16 deletions(-) create mode 100644 Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs.meta create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs create mode 100644 Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs.meta create mode 100644 Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt create mode 100644 Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt.meta create mode 100644 Packages/Core/Runtime/Interfaces/IVariable.cs create mode 100644 Packages/Core/Runtime/Interfaces/IVariable.cs.meta create mode 100644 Packages/Mobile/Runtime/SyncVariableInstancerToCollection.meta create mode 100644 Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs create mode 100644 Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs.meta create mode 100644 Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection.meta create mode 100644 Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs create mode 100644 Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs.meta create mode 100644 Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs create mode 100644 Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs.meta create mode 100644 Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection.meta create mode 100644 Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs create mode 100644 Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs.meta diff --git a/Examples/Assets/InfinityWaves/Enemy/Enemy.prefab b/Examples/Assets/InfinityWaves/Enemy/Enemy.prefab index 4a31b703..de2b03d7 100644 --- a/Examples/Assets/InfinityWaves/Enemy/Enemy.prefab +++ b/Examples/Assets/InfinityWaves/Enemy/Enemy.prefab @@ -24,6 +24,8 @@ GameObject: - component: {fileID: 4095674729113015293} - component: {fileID: 5231109137669188302} - component: {fileID: 3219820094781281706} + - component: {fileID: 3464795203355677658} + - component: {fileID: 9113883788723746504} m_Layer: 0 m_Name: Enemy m_TagString: Untagged @@ -274,8 +276,8 @@ MonoBehaviour: _syncToCollection: _usage: 1 _collection: {fileID: 0} - _instancer: {fileID: 5231109137669188302} - _syncToCollectionKey: Health + _instancer: {fileID: 0} + _syncToCollectionKey: _syncToList: _usage: 1 _list: {fileID: 0} @@ -350,8 +352,8 @@ MonoBehaviour: _syncToCollection: _usage: 1 _collection: {fileID: 0} - _instancer: {fileID: 5231109137669188302} - _syncToCollectionKey: Position + _instancer: {fileID: 0} + _syncToCollectionKey: _syncToList: _usage: 1 _list: {fileID: 0} @@ -404,3 +406,47 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _list: {fileID: 11400000, guid: 118b16031adba41c2921b637788fa016, type: 2} +--- !u!114 &3464795203355677658 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2421445419809145576} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84fa545dc2b5d4429a502d265e32b9e1, type: 3} + m_Name: + m_EditorClassIdentifier: + _variableInstancer: {fileID: -2978108162882953924} + _syncToCollection: + _usage: 1 + _collection: {fileID: 0} + _instancer: {fileID: 5231109137669188302} + _syncToCollectionKey: Health + _syncToList: + _usage: 0 + _list: {fileID: 0} + _instancer: {fileID: 0} +--- !u!114 &9113883788723746504 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2421445419809145576} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c9fe1eb9a37bc421e9d54b82844bbf9e, type: 3} + m_Name: + m_EditorClassIdentifier: + _variableInstancer: {fileID: 1637442682690422268} + _syncToCollection: + _usage: 1 + _collection: {fileID: 0} + _instancer: {fileID: 5231109137669188302} + _syncToCollectionKey: Position + _syncToList: + _usage: 0 + _list: {fileID: 0} + _instancer: {fileID: 0} diff --git a/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncGameObjectToList.cs b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncGameObjectToList.cs index bf70ced4..1c6bbbde 100644 --- a/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncGameObjectToList.cs +++ b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncGameObjectToList.cs @@ -6,7 +6,7 @@ namespace UnityAtoms.BaseAtoms /// /// Adds a GameObject to a GameObject Value List on OnEnable and removes it on OnDestroy. /// - [AddComponentMenu("Unity Atoms/Sync GameObject To List")] + [AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Sync GameObject To List")] [EditorIcon("atom-icon-delicate")] public class SyncGameObjectToList : MonoBehaviour { diff --git a/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs new file mode 100644 index 00000000..6421bfb0 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs @@ -0,0 +1,67 @@ +using System; +using UnityEngine; +using UnityEngine.Assertions; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds a Variable from a Variable Instancer to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [EditorIcon("atom-icon-delicate")] + public class SyncVariableInstancerToCollection : MonoBehaviour + where V : AtomBaseVariable + where VI : class, IVariable + { + /// + /// The Variable Instancer whose Variable will get synced to the List and / or Collection defined. + /// + [SerializeField] + private VI _variableInstancer = default; + + /// + /// If assigned the Variable from the Variable Instancer will be added to the Collection on Start using `_syncToCollectionKey` as key or if not specified it uses the gameObject's instance id as key. The value will also be removed from the collection OnDestroy. + /// + [SerializeField] + private AtomCollectionReference _syncToCollection = default; + + /// + /// If this string is not null or white space and if a Collection to sync to is defined, this is the key that will used when adding the Variable to the Collection. If not defined the key defaults to this GameObject's instance id. + /// + [SerializeField] + private String _syncToCollectionKey = default; + + /// + /// If assigned the Variable from the Variable Instancer will be added to the list on Start. The value will also be removed from the list OnDestroy. + /// + [SerializeField] + private AtomListReference _syncToList = default; + + private void Start() + { + Assert.IsNotNull(_variableInstancer); + + if (_syncToCollection != null && _syncToCollection.GetValue() != null) + { + _syncToCollection.GetValue().Add(String.IsNullOrWhiteSpace(_syncToCollectionKey) ? GetInstanceID().ToString() : _syncToCollectionKey, _variableInstancer.Variable); + } + + if (_syncToList != null && _syncToList.GetValue() != null) + { + _syncToList.GetValue().Add(_variableInstancer.Variable); + } + } + + private void OnDestroy() + { + if (_syncToCollection != null && _syncToCollection.GetValue() != null) + { + _syncToCollection.GetValue().Remove(GetInstanceID().ToString()); + } + + if (_syncToList != null && _syncToList.GetValue() != null) + { + _syncToList.GetValue().Remove(_variableInstancer.Variable); + } + } + } +} \ No newline at end of file diff --git a/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..3835d595 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/MonoBehaviourHelpers/SyncVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 967ccc983ae8b4c49981f43f4b63de04 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection.meta new file mode 100644 index 00000000..97b300f4 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9d95601f8b1234ea18f7905c2a8fc8fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs new file mode 100644 index 00000000..429e75a7 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Bool Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncBoolVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..07d205b6 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncBoolVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96223c1559f544ce4a760452682223c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs new file mode 100644 index 00000000..8db5a267 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider2D Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncCollider2DVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..52ddb2a3 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncCollider2DVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0568445422ca44e7fa6d63d6453d5f30 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs new file mode 100644 index 00000000..2e5b0bbf --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncColliderVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..76dfde0e --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColliderVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ca68c6198e834819b7eefbf74c2fd42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs new file mode 100644 index 00000000..f694a2b0 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Color Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncColorVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..c528a0f5 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncColorVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ce530051602d436a8b25f28e9dcf88f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs new file mode 100644 index 00000000..2648dd52 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Float Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncFloatVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..26e518f9 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncFloatVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3bf191c5ab7c84f7184abfa947bd24ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs new file mode 100644 index 00000000..e1ddac10 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync GameObject Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..012f95df --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncGameObjectVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5d51231331004e00b6f2fbdc91768d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs new file mode 100644 index 00000000..1f1e26b9 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Int Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncIntVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..e1c678d4 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncIntVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84fa545dc2b5d4429a502d265e32b9e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs new file mode 100644 index 00000000..def366c1 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync String Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncStringVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..55603daf --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncStringVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2ae57eed554524e648a16aab8b026232 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs new file mode 100644 index 00000000..0265aa73 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Vector2 Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncVector2VariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..68efd133 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector2VariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8392210b17ca241a1922f4f2d8cb6d6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs new file mode 100644 index 00000000..f0ea6223 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs @@ -0,0 +1,12 @@ +using UnityAtoms.BaseAtoms; +using UnityEngine; + +namespace UnityAtoms.BaseAtoms +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Vector3 Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncVector3VariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs.meta b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..7a899391 --- /dev/null +++ b/Packages/BaseAtoms/Runtime/SyncVariableInstancerToCollection/SyncVector3VariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9fe1eb9a37bc421e9d54b82844bbf9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/Core/Editor/Generator/AtomTypes.cs b/Packages/Core/Editor/Generator/AtomTypes.cs index bef90a58..c5e487f8 100644 --- a/Packages/Core/Editor/Generator/AtomTypes.cs +++ b/Packages/Core/Editor/Generator/AtomTypes.cs @@ -84,6 +84,11 @@ namespace UnityAtoms.Editor templateName: "UA_Template__SetVariableValue.txt", relativeFileNameAndPath: Path.Combine(Runtime.IsUnityAtomsRepo ? "Runtime" : "", "Actions", "SetVariableValue", $"Set{{VALUE_TYPE_NAME}}VariableValue.cs") ); + public static readonly AtomType SYNC_VARIABLE_INSTANCER_TO_COLLECTION = new AtomType( + displayName: "Sync Variable Instancer To Collection", + templateName: "UA_Template__SyncVariableInstancerToCollection.txt", + relativeFileNameAndPath: Path.Combine(Runtime.IsUnityAtomsRepo ? "Runtime" : "", "SyncVariableInstancerToCollection", $"Sync{{VALUE_TYPE_NAME}}VariableInstancerToCollection.cs") + ); public static readonly AtomType UNITY_EVENT = new AtomType( displayName: "Unity Event", templateName: "UA_Template__UnityEvent.txt" @@ -137,6 +142,7 @@ namespace UnityAtoms.Editor AtomTypes.EVENT_REFERENCE, AtomTypes.PAIR_EVENT_REFERENCE, AtomTypes.SET_VARIABLE_VALUE, + AtomTypes.SYNC_VARIABLE_INSTANCER_TO_COLLECTION, AtomTypes.UNITY_EVENT, AtomTypes.PAIR_UNITY_EVENT, AtomTypes.VARIABLE, @@ -154,33 +160,32 @@ namespace UnityAtoms.Editor { AtomTypes.VALUE_LIST, new List() { AtomTypes.EVENT } }, { AtomTypes.BASE_EVENT_REFERENCE_LISTENER, new List() { AtomTypes.EVENT, AtomTypes.BASE_EVENT_REFERENCE, AtomTypes.UNITY_EVENT } }, { AtomTypes.EVENT_REFERENCE_LISTENER, new List() { - AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, - AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_REFERENCE, AtomTypes.UNITY_EVENT, AtomTypes.PAIR } + AtomTypes.EVENT, AtomTypes.EVENT_REFERENCE, AtomTypes.UNITY_EVENT } }, { AtomTypes.PAIR_EVENT_REFERENCE_LISTENER, new List() { - AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, - AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_REFERENCE, AtomTypes.PAIR_UNITY_EVENT, AtomTypes.PAIR } + AtomTypes.PAIR_EVENT, AtomTypes.PAIR_EVENT_REFERENCE, AtomTypes.PAIR_UNITY_EVENT} }, { AtomTypes.REFERENCE, new List() { AtomTypes.CONSTANT, AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR } }, { AtomTypes.BASE_EVENT_REFERENCE, new List() {AtomTypes.EVENT, AtomTypes.EVENT_INSTANCER } }, - { AtomTypes.EVENT_REFERENCE, new List() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, - AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_INSTANCER, AtomTypes.PAIR } + { AtomTypes.EVENT_REFERENCE, new List() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_INSTANCER } }, - { AtomTypes.PAIR_EVENT_REFERENCE, new List() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, - AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_INSTANCER, AtomTypes.PAIR } + { AtomTypes.PAIR_EVENT_REFERENCE, new List() { AtomTypes.VARIABLE, AtomTypes.PAIR_EVENT, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_INSTANCER } }, { AtomTypes.SET_VARIABLE_VALUE, new List() { AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE, AtomTypes.CONSTANT, AtomTypes.REFERENCE, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR } }, + { AtomTypes.SYNC_VARIABLE_INSTANCER_TO_COLLECTION, new List() { + AtomTypes.VARIABLE, AtomTypes.VARIABLE_INSTANCER } + }, { AtomTypes.PAIR_UNITY_EVENT, new List() { AtomTypes.PAIR } }, { AtomTypes.VARIABLE, new List() { AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.PAIR } }, { AtomTypes.VARIABLE_INSTANCER, new List() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.PAIR } }, { AtomTypes.EVENT_INSTANCER, new List() { AtomTypes.EVENT } }, - { AtomTypes.PAIR_EVENT_INSTANCER, new List() { AtomTypes.EVENT, AtomTypes.PAIR } } + { AtomTypes.PAIR_EVENT_INSTANCER, new List() { AtomTypes.PAIR_EVENT } } }; } } diff --git a/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt b/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt new file mode 100644 index 00000000..ae447869 --- /dev/null +++ b/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt @@ -0,0 +1,17 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; +<%IF TYPE_HAS_NAMESPACE%>using {TYPE_NAMESPACE};<%ENDIF%> + +<%IF HAS_SUB_UA_NAMESPACE%> +namespace UnityAtoms.{SUB_UA_NAMESPACE} +<%ELSE%> +namespace UnityAtoms +<%ENDIF%> +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync {VALUE_TYPE_NAME} Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class Sync{VALUE_TYPE_NAME}VariableInstancerToCollection : SyncVariableInstancerToCollection<{VALUE_TYPE}, {VALUE_TYPE_NAME}Variable, {VALUE_TYPE_NAME}VariableInstancer> { } +} diff --git a/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt.meta b/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt.meta new file mode 100644 index 00000000..f4669f25 --- /dev/null +++ b/Packages/Core/Editor/Generator/Resources/UA_Template__SyncVariableInstancerToCollection.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cf6a161b0fbad45fab39780ebd140c99 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/Core/Runtime/Interfaces/IVariable.cs b/Packages/Core/Runtime/Interfaces/IVariable.cs new file mode 100644 index 00000000..6942802e --- /dev/null +++ b/Packages/Core/Runtime/Interfaces/IVariable.cs @@ -0,0 +1,7 @@ +namespace UnityAtoms +{ + public interface IVariable + { + T Variable { get; } + } +} \ No newline at end of file diff --git a/Packages/Core/Runtime/Interfaces/IVariable.cs.meta b/Packages/Core/Runtime/Interfaces/IVariable.cs.meta new file mode 100644 index 00000000..98847912 --- /dev/null +++ b/Packages/Core/Runtime/Interfaces/IVariable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8810e38924433414b85a64e28b5c161e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/Core/Runtime/MonoBehaviourHelpers/VariableResetter.cs b/Packages/Core/Runtime/MonoBehaviourHelpers/VariableResetter.cs index 3633c71c..48ffc52a 100644 --- a/Packages/Core/Runtime/MonoBehaviourHelpers/VariableResetter.cs +++ b/Packages/Core/Runtime/MonoBehaviourHelpers/VariableResetter.cs @@ -3,7 +3,7 @@ using UnityEngine; namespace UnityAtoms { - [AddComponentMenu("Unity Atoms/Variable Resetter")] + [AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Variable Resetter")] [DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_RESETTER)] [EditorIcon("atom-icon-delicate")] public class VariableResetter : MonoBehaviour diff --git a/Packages/Core/Runtime/VariableInstancers/AtomBaseVariableInstancer.cs b/Packages/Core/Runtime/VariableInstancers/AtomBaseVariableInstancer.cs index 058f3978..16702b3a 100644 --- a/Packages/Core/Runtime/VariableInstancers/AtomBaseVariableInstancer.cs +++ b/Packages/Core/Runtime/VariableInstancers/AtomBaseVariableInstancer.cs @@ -17,7 +17,7 @@ namespace UnityAtoms /// Function of type T => T [EditorIcon("atom-icon-hotpink")] [DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_INSTANCER)] - public abstract class AtomBaseVariableInstancer : MonoBehaviour + public abstract class AtomBaseVariableInstancer : MonoBehaviour, IVariable where V : AtomBaseVariable where CO : IGetValue where L : IGetValue diff --git a/Packages/Mobile/Runtime/SyncVariableInstancerToCollection.meta b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection.meta new file mode 100644 index 00000000..196da72b --- /dev/null +++ b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e0f09b8091f4495f98f91f403072169 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs new file mode 100644 index 00000000..92f67db3 --- /dev/null +++ b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; +using UnityAtoms.Mobile; + +namespace UnityAtoms.Mobile +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync TouchUserInput Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncTouchUserInputVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs.meta b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..8727202b --- /dev/null +++ b/Packages/Mobile/Runtime/SyncVariableInstancerToCollection/SyncTouchUserInputVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21ffdc4ff8dcc40fbb3c56c93619656b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection.meta b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection.meta new file mode 100644 index 00000000..c4c54287 --- /dev/null +++ b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b3501a99b022468a9ed549befdc7dc1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs new file mode 100644 index 00000000..f987125f --- /dev/null +++ b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; +using UnityAtoms.MonoHooks; + +namespace UnityAtoms.MonoHooks +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider2DGameObject Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncCollider2DGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs.meta b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..9894526d --- /dev/null +++ b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncCollider2DGameObjectVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ec40bfabc10254768947e2748b790283 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs new file mode 100644 index 00000000..5624435f --- /dev/null +++ b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; +using UnityAtoms.MonoHooks; + +namespace UnityAtoms.MonoHooks +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync ColliderGameObject Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncColliderGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs.meta b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..78c05ad4 --- /dev/null +++ b/Packages/MonoHooks/Runtime/SyncVariableInstancerToCollection/SyncColliderGameObjectVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70a860013e0574439a7cff1ffcab164c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection.meta b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection.meta new file mode 100644 index 00000000..de1fcf02 --- /dev/null +++ b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b588e9c7d0764aeabe6db1605827fef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs new file mode 100644 index 00000000..c047e5fb --- /dev/null +++ b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using UnityAtoms.BaseAtoms; +using UnityAtoms.SceneMgmt; + +namespace UnityAtoms.SceneMgmt +{ + /// + /// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy. + /// + [AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync SceneField Variable Instancer to Collection")] + [EditorIcon("atom-icon-delicate")] + public class SyncSceneFieldVariableInstancerToCollection : SyncVariableInstancerToCollection { } +} diff --git a/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs.meta b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs.meta new file mode 100644 index 00000000..538813c6 --- /dev/null +++ b/Packages/SceneMgmt/Runtime/SyncVariableInstancerToCollection/SyncSceneFieldVariableInstancerToCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d451cebd701174f53bea83243f25b809 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3} + userData: + assetBundleName: + assetBundleVariant: