fix: SyncGameObjectToList adding object multiple times to list (#389)

This commit is contained in:
Soraphis 2023-07-18 23:09:23 +02:00 committed by GitHub
parent fb471754bc
commit f75215adba
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
{
/// <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>
[AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Sync GameObject To List")]
[EditorIcon("atom-icon-delicate")]
@ -13,7 +13,7 @@ namespace UnityAtoms.BaseAtoms
[SerializeField]
private GameObjectValueList _list = default;
void OnEnable()
void Start()
{
Assert.IsNotNull(_list);
_list.Add(gameObject);