Taking it from Unity would be useful in the editor to have a way to automatically add a component/script when another script requires it:
https://docs.unity3d.com/ScriptReference/RequireComponent.html
Taking it from Unity would be useful in the editor to have a way to automatically add a component/script when another script requires it:
https://docs.unity3d.com/ScriptReference/RequireComponent.html
Just a small tip, but if you have engine-related feature requests (non-Editor), it’s probably best to add them to the Engine project on GitHub.
But I tough was an editor related feature. As the auto adding of a component should be in the editor.
Well, the Editor would have to respect it. But it’s an Engine-level feature, really, since this would have to work without the Editor too.
Yes, I see what you mean. But at runtime, the only thing the engine could do is to raise an exception in case a component is missing. This could be done already by a check in the initialize.
Or should the engine silently add anyway the required script or component with default settings? I don’t think would be good.
Looking only from the perspective of a pure engine coding (without the editor), it doesn’t seem to be a useful feature. Or I’m missing something?
If Script A requires Script B, when adding Script A at runtime, Script B should be added as well automatically and prevent removal of Script B from the entity, I wouldn’t see the engine allowing the scenario where Script B would be missing.
Yes, also this could be a use case that I didn’t think about.
I’ll post this feature request on Github then
Coming from Unity I have to wrap my head to a new way to think about the engine.
Source code first!