Need help with C# error "No Overload for method "Box" takes 1 argument"

Discussion in 'C#' started by BinaryZombi, Feb 1, 2012.

  1. BinaryZombi

    BinaryZombi New Member

    Joined:
    Feb 1, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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"
    Heres the sample of how I've done it. Thanks
    Code:
    using UnityEngine;
    using System.Collections;
    
    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);
        }
    }
     
    Last edited by a moderator: Feb 1, 2012

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice