Hello, I wanted to know how to do Scriptable items or kind I have an enumeration (Health, mana, armor). and I can put a value on what I choose but where can I put more
. Thank you for your help
You can’t change value of enumeration because it’s set of constants names.
What you can do is make ScriptableObject which has health points in it and you change it values by reference to this scriptable.
[CreateAssetMenu(fileName = "Health", menuName = "Health")]
public class ScriptableObjectHealth : ScriptableObject {
public HealthPoints;
public MaxHealthPoints;
public void Decrase/Increase(float value) // You can do it in mono, whatever
{
//....
}
}
public class MyMonoClass : Monobehaviour
{
public ScriptableObjectHealth health;
// anywhere in code
//health.Decrease/Increase(value);
}
Also for more information I recommend some videos about ScriptableObjects:
um ok but for example i can not make a class that would have an enum and a value to change which for example my class would be called Power and in it I would have an enum and a float to change and in my class ScriptableObject I would do something like his “public power [ ] a;” and as I could put in the size time I want with the enums and the value directly to get it back?