Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] add an option to generate atoms in whatever namespace i'd like (or none) #379

Open
tycobbb opened this issue Dec 10, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@tycobbb
Copy link

tycobbb commented Dec 10, 2022

is your feature request related to a problem? please describe.

i think of the atoms i generate from types in my own project to be conceptually part of my project (and its namespace), rather that part of unity atoms. and i prefer to leave any types in my game's namespace as internal (i.e. omitted, the default access control modifier for types).

when generating atoms, afaict the only option is to generate them in a namespace under UnityAtoms which means that any types i create atoms for have to be made public. this proliferates, as then any types in the now-public-type's public interface must also be made public.

describe the solution you'd like

it'd be nice to specify any namespace for the atoms to be generated (including no namespace), and to be able to specify a similar namespace for the editor files (in case that's different).

describe alternatives you've considered

i could manually edit all the atom files, but that seems to make the generator less practical. also sorry if this is already possible and i'm just missing something obvious.

additional context

this also would solve the type-ambiguity problem when other namespaces contain a conflicting type to the one you're generating atoms for:

using UnityEditor;
using MyGame.Ui;

namespace UnityAtoms.Editor {
    [CustomEditor(typeof(MenuEvent))]                // `Menu` here is ambiguous
    public sealed class MenuEventEditor: AtomEventEditor<Menu, MenuEvent> { }
}

vs.

using UnityEditor;

namespace MyGame.Ui {
    [CustomEditor(typeof(MenuEvent))]                // `Menu` here is `MyGame.Ui.Menu`
    public sealed class MenuEventEditor: AtomEventEditor<Menu, MenuEvent> { }
}
@tycobbb tycobbb added the enhancement New feature or request label Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant