Extending a built-in component
Hi!
I am building a game that makes extensive use of joints, and I'm setting a large majority of them up procedurally.
Some (but only some) of my joints require to have their anchor set so it matches the connectedBody's position. I am aware that configuring this through a script after instantiation works, but it completely violates inversion-of-control in my project: Controller inspector knows WHAT to create but nothing about HOW to create it or how it initializes. Component knows EVERYTHING about its own self and configuration but nothing about its environment.
Ideally, I'd create a "ChainAnchoredConfigurableJoint" class inheriting from ConfigurableJoint, and have it simply set its own anchor.
Seems this is not possible as I cannot instantiate non-monobehaviour components.
Is there any suggestion about how to go about this?
For now it seems I'm gonna have to have the controller inspector set up the anchors after instantiating them... it's just that violating IOC for this is oh so horribly spaghetti
Edit: I know I can't alter internal c++ unity classes, but there could be a way to actually extend the wrapper. Merely creating a totally empty class inheriting from ConfigurableJoint and being able to instantiate it would let me extend the behaviour how I want through extension methods.