Skip to content

New ways of creating RelicData objects #15

@TacoConKvass

Description

@TacoConKvass

What is the addition?

New ways of creating RelicData objects.

Why?

Due to RelicData inheriting from UnityEngine.ScriptableObject, calling its constructor is impossible.

RelicData CustomData = new RelicData( /* parameters here... */ ); // Errors, impossible to compile

// User needs to do this:
RelicData CustomData = ScriptableObject.CreateInstance<RelicData>();
CustomData.Name = "...";
CustomData.Rarity = ...;
CustomData.MaxStack = ...;
// and so on...

Example of the usage

RelicData CustomData;
CustomData = new Relics.Data() {
    Name = "...",
    Rarity = ...,
    MaxStack = ...,
    // and so on...
};

CustomData = new Relics.Data("Name", rarity, maxStack, ...);

CustomData = Relics.DataFromJson(jsonString);
CustomData = Relics.DataFromJson(pathToJson);

int ID = Relics.Register(CustomData, textureSmall, textureBig);

Metadata

Metadata

Assignees

Labels

additionAddition suggestion

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions