Let’s say I have a component called Platform within the namespace Hardware. Then let’s say I have another component Platform within the namespace GameEntity. Both inherit from monobehaviour.
So when I go to add a component to a gameobject from the add component menu I’ll see two items named ‘Platform’. Is there a way to tell which is which without adding them and checking the file.
Ideally the component list would read Hardware.Platform and GameEntity.Platform. And for the sake of this question, let’s pretend that I can’t just rename my scripts.
The best I can find right now is → AddComponentMenu(“Hardware.Platform”)] ← at the top of each class but that doesn’t actually remove the original ‘Platform’ from the component menu and I’d rather unity just use the namespaces automatically rather than having to do it manually each time.
DO NOT give the same name to types in
namespaces within a single application
model.
The main purpose of namespaces is to group things together which belong together. Namespaces are not meant to distinguish between different implementations of the same thing. Namespaces do help when you use third-party frameworks to avoid naming conflicts. Do not create nameconflicts on purpose within the same application. So use proper classnames which actually describe what that component does and what’s the difference between your two classes.