Is it possible to have multiple classes inside a script that contain a load of variables. Then in the inspector choose only one of these classes to modify variables?
For example i create a script with two classes. Each class holds some variables. In the inspector there is a checkbox or dropdown menu so that you can choose which class of variables to modify. This hides one set and shows the other.
The reason I want to do this or something similar is that I have a scriptable object that stores a load of values for a template shop item. (name, cost, sprite etc) however the shop items do different things depending on what the item is so some change object colours whereas others add an object to the scene. So different items require different variables.
Thanks Fluzing. I’ve had a look at that link and a few more tutorials but not really sure how to get this to work with a scriptable object for my above issue.
It is hard to grasp at first, but the unity tutorial explains it pretty good. Took me a few times to get the hang of it as well. Best way to learn it is just to make a new project and goof around with it.
If you want an object to be of the same class, but be able to perform different things, then this is really the way to go.
I think I get it. So the top class would have all variables that are shared then the inherited classes would have extra variables specific to that class.
Then I would just need to modify my Scriptable object creator script to create an inherited class rather than the top class?
Exactly. And it is not only variables, but also functions.
public class TopClass
{
public variable common variable
}
public class Inhertited class : TopClass
{
public variable classSpecificVariable
}
public class AnotherInhertited class : TopClass
{
public variable anotherclassSpecificVariable
}
Then say i wanted to create a scriptable object for InheritedClass
public class NewItem : ScriptableObject
{
public List<InhertitedClass> inheritedClass;
}
Ah ok so now I just need to figure out how to create an option in the inspector for which inherited class to choose when making a scriptable object
Make sure that you declare each class in its own script and your declaration is not completely correct right now.
What is the reason for declaring each class in its own script?
Organisation/Avoiding scope errors/easier to understand code
Thanks. learnt a lot today. 
Oh man this works so good. Thanks again