Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ways of creating RelicData objects #15

Open
TacoConKvass opened this issue Feb 24, 2025 · 0 comments
Open

New ways of creating RelicData objects #15

TacoConKvass opened this issue Feb 24, 2025 · 0 comments
Assignees
Labels
addition Addition suggestion
Milestone

Comments

@TacoConKvass
Copy link
Collaborator

TacoConKvass commented Feb 24, 2025

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);
@TacoConKvass TacoConKvass added the addition Addition suggestion label Feb 24, 2025
@TacoConKvass TacoConKvass self-assigned this Feb 24, 2025
@TacoConKvass TacoConKvass changed the title New way of creating RelicData objects New ways of creating RelicData objects Feb 24, 2025
@TacoConKvass TacoConKvass added this to the 1.2.0 milestone Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition Addition suggestion
Projects
None yet
Development

No branches or pull requests

1 participant