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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

If Statements(or something similar) in Scriptable Objects

Discussion in 'Scripting' started by justhere456, Apr 10, 2020.

  1. justhere456

    justhere456

    Joined:
    Jun 21, 2018
    Posts:
    4
    For the action rpg I'm working on I'm using scriptable objects for items. Instead of having multiple different scriptable objects for all the item types(ex: weapons, ranged weapons, consumables) I want to just have one. So pretty much what I would like is a enum containing all the item types and if say ranged weapons is selected I want ammo type to appear. If this is too little info ask me for more Thank you!:)
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    justhere456 and Kurt-Dekker like this.
  3. LatchGameDev

    LatchGameDev

    Joined:
    Nov 24, 2014
    Posts:
    61
  4. justhere456

    justhere456

    Joined:
    Jun 21, 2018
    Posts:
    4
    Thank you for the reply I have decided to use custom unity editor windows. I just have one question maybe I missed something but how do you go about saving the editor input into a scriptable object type format? Thank you!:)
     
  5. LatchGameDev

    LatchGameDev

    Joined:
    Nov 24, 2014
    Posts:
    61
    Off the top of my head I don't know. I usually use scriptable objects for database and runtime stuff but as for saving I usually convert it to JSON and save it that way for longer term stuff like settings or save files. There is a way, so do some googling on it. Now if you just want to save it for use in the editor if you reference it then any changes you make will stick. It's just when you build the application by default it will always have the initial values the build had on release. Actually saving it to a new file / .asset I think gets around that limitation but not sure.

    Quick google pulled this up.
    https://forum.unity.com/threads/saving-scriptable-objects-solved.551866/