- Home /
Class as parameters storage
Hi. I want to have some sort of struct:
class BaseType
{
public float value;
public string str;
};
All parameters should be seted to default values through Inspector. And derived one:
class FirstType : BaseType {}
should have opportunity to set values through inspector too. After that I want to use these classes as parameters for different GameObject to get access to that values. For example:
class MaterialType
{
public float durability;
};
class WoodMaterial : MaterialType
{
};
Now I create prefab which represents Gameobject WoodDoor. It have mesh and all parameters + public MaterialType. And I set it to WoodMaterial in inspector. And instantly getting access to seted durability for that class. I've tried to work with classes not derived from Monobehavior and some kind of stuck.
Can you kick me in right direction? Thank you.
Your answer
Follow this Question
Related Questions
Not sure why my function isn't working right. 0 Answers
Struct for holding Class Parameters 0 Answers
c# passing classes through functions 2 Answers
SendMessage with multiple parameters 3 Answers