C# No overload error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Harley Baird
    New Member
    • Feb 2012
    • 1

    C# No overload error

    Hello i'm a newbie to C# so i was wonder if any one could help me here I'm trying to make a simple health bar/ hit point bar which ever one you want to call it but it keeps coming up with "No Overload for method 'Box; takes '1' arguments"
    Hers the solution:
    using UnityEngine;
    using System.Collecti ons;

    public class playerHealth : MonoBehaviour {
    public int maxHealth = 100;
    public int curHealth = 100;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    void OnGUI() {
    GUI.Box(new Rect(10, 10, Screen.width / 2 / (maxHealth / curHealth), 20) + "/" + maxHealth);
    }
    }
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    We'll need to see the code for Box. It sounds like you got a constructor that takes either no parameter or one that requires multiple parameters.

    Comment

    Working...