title: Method is inaccessible due to its protection level
body: <p>I am using Unity3d and C#, and I have two scripts:</p>
  
  <p><strong>script 1:</strong></p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class PlayerAttack : MonoBehaviour {
  
      public GameObject target;
  
      // Update is called once per frame
      void Update () {
  
          if(Input.GetKeyUp(KeyCode.F))
          {
              Attack();
          }
      }
       void Attack() {
          EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
          eh.HealthRulse(-10);
      }
  
  }
  </code></pre>
  
  <p><strong>script 2:</strong>  </p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class EnemyHealth : MonoBehaviour {
  public int curHealth = 100;
  public int maxHealth = 100;
  public float healthBarLeangth;
      // Use this for initialization
      void Start () {
      healthBarLeangth = Screen.width / 2;
      }
  
      // Update is called once per frame
      void Update () {
           HealthRulse(0);
      }
      void OnGUI() {
          GUI.Box(new Rect(10,40,Screen.width / 2 / (maxHealth / curHealth),20),curHealth + "/" + maxHealth);
      }
      void HealthRulse(int adj){
          if ( curHealth &lt; 0)
              curHealth = 0;
          if (curHealth &gt; maxHealth)
              curHealth = maxHealth;
          if(maxHealth &lt; 1)
              maxHealth = 1;
  
          curHealth += adj;
          healthBarLeangth = (Screen.width / 2) * (curHealth / (float)maxHealth);
      }
  }
  </code></pre>
  
  <p>The function "HeathRulse()" defined in "script 2" and called in "script 1" by GetComponent is throwing an error-<br>
  "Method is inaccessible due to its protection level"</p>
  
  <p>I need help with that...</p>