title: Calling all scripts with the Interface, not just a single one
body: <p>I have a few scripts which all inherit from an Interface I have called IPlayer. The goal of this interface is to register Damage, Experience, and LevelUp.</p>
  <pre><code>public interface IPlayer {
  void TakeDamage(int damage);
  
  void GiveExperience(int experience);
  
  void LevelUp();
  }
  </code></pre>
  <p>For example, 2 scripts at the moment which inherit from IPlayer:</p>
  <ol>
  <li><p>PlayerStatus:</p>
  <pre><code>public void GiveExperience(int experience)
  {
      currentExperience += experience;
  
      if (currentExperience &gt;= maxExperience)
      {
          LevelUp();
          return;
      }
      UpdateUI();
  }
  
  public void LevelUp()
  {
      print(&quot;Player has Leveled up!&quot;);
       maxExperience *= 2;
       if (maxExperience &gt;= 2000)
       {
           return;
       }
       currentExperience = 0;
  
       currentHealth = playerStats.maxHealth;
       vitTime = (-1 * Mathf.Sqrt(playerStats.vit / 130) + 1) / 2;
  
       currentMana = playerStats.maxMana;
       wisTime = (-1 * Mathf.Sqrt(playerStats.wis / 130) + 1) / 2;
       UpdateUI();
   }
  
   public void TakeDamage(int damage)
   {
       currentHealth -= damage;
       if (currentHealth &lt;= 0)
       {
           currentHealth = 0;
           //UpdateUI();               /// MAYBE NEEDED LATER WHEN Death() actually does something.
           Death();
       }
       UpdateUI();
   }
  </code></pre>
  </li>
  <li><p>PlayerStats:</p>
  <pre><code> public void LevelUp()
   {
       maxHealth += Random.Range(8, 16);
  
       maxMana += Random.Range(8, 16);
  
       level++;
  
       uiStats.UpdateUI();
   }
  
   public void TakeDamage(int dmage)
   {
  
   }
  
   public void GiveExperience(int exp)
   {
  
   }
  </code></pre>
  </li>
  </ol>
  <p>Now the problem is, that in PlayMode, nothing actually happens, the health doesnt go down, experience doesnt go up, and ofcourse no levels are gained.
  My first inclination is that when this is called for example:</p>
  <pre><code>IPlayer Iplayer = collision.transform.GetComponent&lt;IPlayer&gt;();
  
  if (Iplayer != null)
  {
      Iplayer.TakeDamage(damage);
  }
  </code></pre>
  <p>It will find the first script which inherits from IPlayer, and call that Method(TakeDamage). Instead I want it to find ALL scrips that inherit from IPlayer(scr_PlayerStatus, scr_PlayerStats, and more scripts that ALL inherit from IPlayer, and call ALL IPlayer methods on ALL Scripts attached to that gameobject, not just the first one it finds.</p>
  <p>So my player basically has multiple scripts that all inherit from IPlayer, and I want them ALL to execute, when the interface is called.</p>
  <p>I hope my explanation is clear and the code can hopefully paint a picture aswell.</p>
  <p>BTW, I know this works when I use multiple Interfaces, one IDamage, IExperience and ILevelUp, but now I combined those 3 interfaces into one to make the code cleaner and easier to read, but that borked it unfortunately. There are no errors, nullreferences or anything like that, really I am convinced that the interface is only calling the first script it finds and not all of them attached to the GameObject.</p>