c# script in unity3d/error cs0117........

Assets/scripts/Player_Health.cs(16,26): error cs0117: “unityEngine.Screen” does not contain a definition for “weidht”

using UnityEngine;

using System.Collections;

public class Player_Health : MonoBehaviour

{

public int maxHealth=100;

private int _curHealth=100;

private float healthBarLenght;

void Start () {

healthBarLenght = Screen.weidht/2;

if(maxHealth<1) maxHealth=1;

_curHealth=maxHealth;}

void Update () {

}

void OnGUI () {

GUI.Box(new Rect(10,10,healthBarLenght,20),_curHealth + “/” + maxHealth);

}

public void AddjustCurrentHealth ( int adj){

_curHealth=adj;

if (_curHealth < 0) _curHealth=0;

if (_curHealth > maxHealth) _curHealth = maxHealth;

healthBarLenght = ( Screen.width / 2 ) * (_curHealth /(float) maxHealth);}

}

Did you ever get this resolved? Looks like a simple typo: “width” was misspelled as “weidht”.

using UnityEngine;
using System.Collections;
public class Player_Health : MonoBehaviour
{
    public int maxHealth=100;
    private int _curHealth=100;
    private float healthBarLength;
    
    void Start () {
        healthBarLength = Screen.width/2; // <-- this should fix it
        if (maxHealth<1) maxHealth=1;
        _curHealth=maxHealth;
    }
    
    void Update () {
    }
    
    void OnGUI () {
        GUI.Box(new Rect(10, 10, healthBarLength, 20), _curHealth + "/" + maxHealth);
    }
    public void AddjustCurrentHealth ( int adj){
        _curHealth=adj;
        if (_curHealth < 0) _curHealth=0;
        if (_curHealth > maxHealth) _curHealth = maxHealth;
        healthBarLength = ( Screen.width / 2 ) * (_curHealth /(float) maxHealth);
    }
}