fix: FSM not compatible with disabled domain reload (#402) (#422)

This commit is contained in:
Soraphis 2023-08-03 07:20:29 +02:00 committed by GitHub
parent 1d3d3f8607
commit 7992efc98d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -138,7 +138,7 @@ namespace UnityAtoms
_value = RunPreChangeTransformers(_value);
}
private void OnEnable()
protected virtual void OnEnable()
{
SetInitialValues();
TriggerInitialEvents();

View File

@ -1,4 +1,5 @@
using System;
using System.Transactions;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
@ -64,8 +65,10 @@ namespace UnityAtoms.FSM
/// </summary>
private string _currentFlatValue;
private void OnEnable()
protected override void OnEnable()
{
base.OnEnable(); // handles resetting and initial values and all that.
if (CompleteCurrentTransition != null && CompleteCurrentTransition.ReplayBufferSize > 0)
{
Debug.LogWarning("The Complete Current Transition event had a replay buffer size great than 0, which would cause unwanted behaviour. Setting it to 0 in order to avoid unexpected behaviour.");