- Home /
I figured it out I think
Self contained function override in scriptable object?
So I'm working on a quest system and have made "Quest" scriptable objects that I can create and edit via the create asset menu. Currently I only have quests for collecting items. The object just holds a public class Item, and an amount.
The quest class has a generic "OnQuestComplete()" that I'd like to be able to override, but I'd like to do it in a way that is contained in the Quest asset I created. Basicaly it looks like I have 2 options, create a separate script file for each Quest asset and pair it up. This seems like a pain. Or I could attach the same large script to each Quest asset and maybe use another variable to choose which function in a loooong list of "OnComplete" functions. This seems pretty bad too.
What I'd really like to be able to do is have a text box in the inspector for my Quest asset, where I can specify the code for "OnQuestComplete()" and override it from there. Or
This probably would have issues in itself, but does anyone have a better solution? Or know how to do it the way I described?
Edit: I just found that I can probably use a dictionary with functions as the value. I think that should work just fine.
Follow this Question
Related Questions
Wrong serialization when using ScriptableObject + [System.Serializable] + inheritance 2 Answers
Is there a way to drag a Subclass onto a Field of the Super Type? 1 Answer
Custom editor window for properties with object fields; how do you save? 0 Answers
How to access a variable in ScriptableObject from another script? 0 Answers
MonoBehavior, ScriptableObject and Object memory usage & performance 0 Answers