title: Subscriber method not getting invoked
body: <p>I have some script in Unity that uses events in c#. In development the game plays correctly, however in build, it seems like the OnHit method subscribed to an event, does not get triggered.</p>
  <p>I provide two EXCERPTS of files used.</p>
  <p>AnimationEvents.cs</p>
  <pre><code>    public class AnimationEvents : MonoBehaviour
      {
          public event Action&lt;string&gt; OnCustomEvent = s =&gt; { };
  </code></pre>
  <p>Slash.cs
  File using the event above.</p>
  <pre><code>  public override void Activate(GameObject gameObject, Animator animator, float time)
      {
          var animationController = animator.GetComponent&lt;AnimationEvents&gt;();
          animationController.OnCustomEvent += OnHit;
  
          if (player == null)
          {
              player = gameObject;
          }
          
          animator.SetTrigger(&quot;attack&quot;);
          
          
          Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(gameObject.transform.position, attackRadius, enemyLayers);
  
          foreach(Collider2D enemy in hitEnemies)
          {
              Debug.Log(&quot;We hit &quot; + enemy.name);          
          }              
      }
      
      public void OnHit(string text)
      {
          GameObject.Find(&quot;DebugLog&quot;).GetComponent&lt;TextMeshProUGUI&gt;().text = enemyHits.Count.ToString();
          foreach (var enemy in enemyHits)
          {
              var damage = Random.Range(15, 30);
              var enemyScript = enemy.GetComponent&lt;Enemy&gt;();
              if (enemyScript)
              {
                  TakeDamage(player, enemyScript, damage);
              }
          }
          
          enemyHits = new List&lt;Collider2D&gt;();
      }
  </code></pre>