Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Discussion Is scriptable objects the right solution for me?

Discussion in 'Scripting' started by pheekle, Nov 21, 2022.

  1. pheekle

    pheekle

    Joined:
    Aug 10, 2013
    Posts:
    12
    Hello everyone. I guess this counts as both a discussion and question.

    Currently my game consists of one singular scriptable object for attribute stat affixes (Prefix & Suffix) that has multiple arrays of classes with multiple variables. So for example I have a Body armor prefix AND body armor suffix public class with multiple variables like attribute name, minimum stat, maximum stat, item level requirement etc..


    My concern is when I want to add additional stats, I need to expand each individual "item type" array that I want to add to. Many of the stats are shared across all the item types, however some stats are for specific item types. For me, I feel like I am over complicating this and making it a chore to add additional stats when I need to.

    As it stands right now, everything works fine. I also have many systems that integrate with it like random item generation, and weighted stats but if there is another solution that could make my life easier I wouldn't mind rewriting a lot of my code to support that solution. I'm open for discussion and curious to see what everyone has to say.

    Thanks!
     
    Last edited: Nov 21, 2022
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    3,461
    Well you have one big scriptable object. Why not break it down into many smaller ones?

    That's half their purpose; to let you author data in serialised, easily replicable manner.

    And if you want to have some form of randomised table of suffixs/prefixes, then you use another scriptable objects to make random loot tables of them.