trouble with custom class

Hi!

So want my hero to have a healthbar, a shield bar and an energy bar (not edible… hehe … sorry for that).
So i created a class in a script to capsule all the information these 3 bars have.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

namespace customClasses
{
    [System.Serializable]
    public class liquidStat : Component
    {
        public string name;
        public float valMax; //max value
        public float valCurrent; //current value
        public float valReg; //regeneration per sec
        private Slider slider;  //UI.Slider
        private Text text;
    }
}

now the problems come: in order to give my hero the information i want to be able to set the variables of the class in the inspector, which isnt working.
in the inspector in the script it sais:
Health None(liquidStat) instead of a dropdown menue of all public variables.
is there away to access all the variables in the inspector ?

James Butler

Change “Component” to “MonoBehaviour”.

If it’s a class to be included in another component, do this:

using UnityEngine;
using System.Collections;
using customClasses;

public class MyComponent : MonoBehaviour {

    public liquidStat stats;

}

I changed it and made an instance just like you did, but still no option to access the variables from the inspector.

Change Component to nothing, it doesn’t need to implement anything if its just a data holder

Now it works fine. Thank you!