Scriptable Objects : Out of my depth, Can I take data from them and fill into another class?
Hi guys;
Making a rough Pokemon-esque, Monster Battler game to test myself on stuff I haven't done before. I was recommended to try Scriptables, so I have .
I have a 'monster' script, with all public variables in it, then a 'Dragon' script that inherits from it with [CreateAssetMenu(menuName = "AddNewDragonMonster")]
in it. It overwrites the variables with 'Dragon' stats etc.
When back in the Inspector, I can create off of this. I have done one (lil Dragon) and I can fill it with details.
Now, my question;
What Id LIKE to do is have different families with different data leading to different monsters.
When I enter a battle, randomly choose one, and create it and put the details into the battle.
HOW would I actually go about doing this? Can I pull the data out somehow? Is it as simple as something like '
Create new Monster;
MonsterHP=Monster.Dragon.LilDragon.HP;
Or something like that?
Thanks for looking guys :)
Usually, you reference ScriptableObjects at runtime from a $$anonymous$$onoBehaviour.
You declare a variable of type of your scriptable object, then you assign it with a serialised script object that you load from Resources, AssetBundle or previously assigned to a field in a loaded scene.
Your answer
