Hello,
I’ve tried my best to google for this, I apologize if I used the wrong terms so it didn’t turn anything up. If this has been answered, I’d appreciate being pointed in the right direction.
I’m making my first Unity game, where the player manages a factory full of machines. A simulation game.
Machines all behave similarly. Right now I have a generic machine Prefab which is a little cube sporting a few scripts. It works just great! But… I want to have dozens of machines!
Machines will all be identical with the exception of some metadata and which model is being rendered. If I was coding, I’d have a GenericMachine class, with a property called “Model” which I would assign at runtime based on game definition files.
So, I have a GenericMachine prefab. I also have machine models my Assets folder (go Blender!). What I’d like to do from code is, right after I create an instance of GenericMachine, I assign it a different model (a non-cube) from my Assets folder. This confuses me because it’s not just an assignment, it requires some kind of reference to a whole little hierarchy worth of stuff in the asset folder.
I want to avoid having to define all the machines in Unity’s integrated editor in favour of a quick zip through an XML file.
I’m using C#, in case that makes a difference.
Thanks for your time.
Cheers,
Fletch