/// The variable that the in memory copy will be based on when created at runtime.
/// </summary>
[SerializeField]
protectedV_base=null;
/// <summary>
/// If assigned the in memory copy variable will be added to the collection on Start using the gameObject's instance id as key. The value will also be removed from the collection OnDestroy.
/// </summary>
[SerializeField]
privateCO_syncToCollection=default(CO);
/// <summary>
/// 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.
/// </summary>
[SerializeField]
privateString_syncToCollectionKey=default;
/// <summary>
/// If assigned the in memory copy variable will be added to the list on Start. The value will also be removed from the list OnDestroy.
/// </summary>
[SerializeField]
privateL_syncToList=default(L);
/// <summary>
/// Override to add implementation specific setup on `OnEnable`.
/// </summary>
protectedvirtualvoidImplSpecificSetup(){}
privatevoidOnEnable()
{
Assert.IsNotNull(Base);
_inMemoryCopy=Instantiate(Base);
ImplSpecificSetup();
}
voidStart()
{
// Adding to the collection on Start instead of OnEnable because of timing issues that otherwise occurs when listeners register themselves OnEnable.
// This is an issue when a Game Object has a Variable Instancer attached to it when the scene starts and at the same time their is an AtomBaseListener listening to the associated Added event to a Collection.