- Home /
What is the best way to store data about a GameObject?
I am new to unity, but not new to programming. In other languages, I would do something like this to store data about an object:
class Earth extends Planet {
private float defenseValue = 100;
public setDefenseValue(float value) {
this.defenseValue = value;
}
public getDefenseValue() {
return this.defenseValue;
}
}
But I don't see much in the way of classes like this in Unity. I am probably missing something, but I wanted to be sure. Aside from creating a new script and attaching it to the object with public variables, is there a way to make a class like above and attach it to a game object?
I hope I made sense. Thanks in advance!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
When do we need to use Class? 1 Answer
Why are variables assigned through the inspector considered not assigned when prefab is spawned? 1 Answer
Getting a custom class to contain a certain script. 1 Answer
passing variables through scripts 0 Answers