fix: SyncGameObjectToList adding object multiple times to list

This commit is contained in:
Soraphis 2023-02-05 14:44:41 +01:00 committed by GitHub
parent 994026fb7e
commit a90fc67e28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ using UnityEngine.Assertions;
namespace UnityAtoms.BaseAtoms namespace UnityAtoms.BaseAtoms
{ {
/// <summary> /// <summary>
/// Adds a GameObject to a GameObject Value List on OnEnable and removes it on OnDestroy. /// Adds a GameObject to a GameObject Value List on Start and removes it on OnDestroy.
/// </summary> /// </summary>
[AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Sync GameObject To List")] [AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Sync GameObject To List")]
[EditorIcon("atom-icon-delicate")] [EditorIcon("atom-icon-delicate")]
@ -13,7 +13,7 @@ namespace UnityAtoms.BaseAtoms
[SerializeField] [SerializeField]
private GameObjectValueList _list = default; private GameObjectValueList _list = default;
void OnEnable() void Start()
{ {
Assert.IsNotNull(_list); Assert.IsNotNull(_list);
_list.Add(gameObject); _list.Add(gameObject);