I have created 2 gameobjects along with its properties in the Unity Inspector. I have attached a screenshot below.
For prototyping, I like the Inspector very much, but for runtime I prefer doing everything by scripts. This way nothing can go wrong: I don't have to carry so many files around, and I find it easier to understand everything.
I would now like to change this so that these 2 components are created at runtime by script.
Is there perhaps a way to automatically create the script that would create these game objects?
I would appreciate it very much if I could save some time with such an automatic script creation.
Thank you for any input.
UnityEditor.SerializedObject
to iterate over the inspectable fields of the object and its components. Where it gets hairy is assigning a value to each of these fields requires writing code to translate each possible value type into its corresponding literal/constructor, with some gotchas where the fields the editor sees aren't the same ones exposed to C# (eg. m_LinearDrag vs drag), and references are a nightmare. \$\endgroup\$