Skip to content

Restyle settings and offer to fix asmdef references (1.2.1) - #13

Merged
Severnbli merged 6 commits into
mainfrom
feature/settings-ui-asmdef-prompt
Oct 24, 2026
Merged

Severnbli merged 6 commits into
mainfrom
feature/settings-ui-asmdef-prompt

Conversation

@Severnbli

Copy link
Copy Markdown
Owner

Summary

This restyles the settings UI and adds a prompt for the case where the output folder sits inside another assembly definition. Version bumped to 1.2.1.

Owning-assembly prompt

If the output folder is below a folder owned by an .asmdef (directly, or joined through an .asmref), the generated code compiles into that assembly. That assembly only sees what it references, so the code didn't compile until the user added com.severnbli.localization-codegen.Runtime and Unity.Localization by hand (plus the UniTask assemblies when UniTask members are on).

Now, choosing such a folder (typed, Browse…, or in the setup wizard) asks what to do:

  • Add References: the missing references are written into that .asmdef. Its formatting, line endings and BOM are kept, and references are written as GUIDs if the asmdef already uses GUIDs.
  • Use Separate .asmdef: turns on Generate .asmdef.
  • Not Now

An asmdef inside a read-only package only gets the separate-.asmdef option. The Output section keeps showing which assembly the code compiles into, with both fixes, and generation warns while references are missing.

Settings styling

  • Collapsible Output · Tables · Generated Members · Naming · Advanced sections, each remembering whether it's open.
  • One label width, so long labels aren't cut off.
  • Options that don't apply are greyed out: Smart Parameter Types while Smart Strings is Off, and Reference Members when MethodsAndRefs forces it on.
  • The window and the Project Settings page share a toolbar (Regenerate · Verify · Open Output Folder · Setup Wizard) and a last-run summary with expandable warnings.
  • The Settings page has proper margins, and every setting is findable through Project Settings search.

Fixes

  • A folder picked with Browse was never saved: ExitGUI throws before the change check runs.
  • The AssemblyBuilder obsolete warning (CS0618) in the compile test on Unity 6.5.

Commits

4d81a2c restyle · c86519f owning-assembly prompt · ec5d6a2 tests · 01e8731 CS0618 · f019f17 docs · b3c41fd 1.2.1

Test plan

  • Unity 2022.3.62f3: EditMode 122/122 (16 new owning-assembly tests), PlayMode 14/14, Installer 13/13
  • Unity 6000.5.9f1: EditMode 122 passed, 1 skipped (UniTask compile check; UniTask isn't installed in that project)
  • commands/check-package.sh passes (versions, synced READMEs/changelogs, .meta files)
  • The UI and the dialogs haven't been checked visually; batch-mode tests can't render the editor UI
  • Unity 6000.3.1f1: CI

🤖 Generated with Claude Code

Severnbli and others added 6 commits October 24, 2026 20:38
- Group the settings into collapsible Output, Tables, Generated Members,
  Naming and Advanced sections; each remembers whether it is open.
- Use one label width so long labels are no longer truncated, and grey
  out options that do not apply: Smart Parameter Types while Smart
  Strings is Off, and Reference Members while MethodsAndRefs forces it.
- Warn when both table kinds are off; show folder errors as errors.
- Window and Project Settings page share a toolbar (Regenerate, Verify,
  Open Output Folder, Setup Wizard) and a last-run summary whose
  warnings fold out; the page gets proper margins, and every setting
  label is a search keyword.
- Fix: a folder picked with Browse was not saved, because ExitGUI throws
  before the change check runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the output folder lies below a folder owned by an .asmdef (or one
joined to an assembly through an .asmref), the generated code compiles
into that assembly. Unlike Assembly-CSharp it only sees the assemblies
it references explicitly, so the code failed to compile until the user
added com.severnbli.localization-codegen.Runtime and Unity.Localization
(and the UniTask assemblies when UniTask members are on) by hand.

- AssemblyOwnership walks up from the output folder to Assets, resolves
  .asmref files and GUID: references, and lists the missing references.
- Changing the output folder (typed, Browse or setup wizard) asks to
  Add References, Use Separate .asmdef or decide later. Read-only package
  asmdefs only offer the separate .asmdef.
- The Output section keeps showing which assembly the code compiles
  into, with the same two fixes while references are missing.
- References are added by text insertion, so the asmdef keeps its
  formatting, line endings and BOM, and GUID-style references are
  written as GUIDs.
- Generation warns about missing references, without failing on a
  broken asmdef.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Text edits: multi-line, empty, missing and single-line references
  arrays, CRLF with tabs, and other arrays such as versionDefines left
  untouched.
- Lookup: nearest asmdef wins, folders that do not exist yet, the
  generator's own asmdef skipped, GUID references, .asmref by name and
  by GUID, and an .asmref to an unknown assembly.
- Writing: names vs GUIDs following the asmdef's style, BOM kept, no
  write when nothing is missing.

The fixtures live in a folder ending with '~', which Unity never
imports, so the tests do not trigger a recompile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AssemblyBuilder is marked obsolete from Unity 6.5 (CS0618) but is still
the only in-editor way to compile with Unity's compiler and references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Severnbli
Severnbli merged commit c428ba0 into main Oct 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant