Coming soon - Get a detailed view of why an account is flagged as spam!
view details
2
Creating an instance of a class
Post Body

Sorry. Haven't coded for over a year. So some super stupid questions are inbound.

I have a class. It defines the attributes of a character. And looks like this:

public class CombatantDefinition : MonoBehaviour
{
    public string fightersName;
    public Vector2Int damageRange;
    public int health;
    public int dexterity;
    public int baseAttackSpeed;
    public int currentAttackSpeedValue;
    public bool isAlive = true;
    public Weapon equippedWeapon;

    public void EquipWeapon(Weapon weapon) {
        equippedWeapon = weapon;
    }

}

I'd like to press a button and create a several instances of the class and save it. So that I can call an instance of this character later.

How do I do that? (I know that I knew how to do this once, so I know enough to know it's an embarassing question to ask)

Thanks for any help

Author
Account Strength
100%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
12,245
Link Karma
7,043
Comment Karma
5,012
Profile updated: 1 day ago
Posts updated: 1 month ago
Tester

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago