Rename JSON importer to .oae extension; spawner + collider polish#6
Merged
Conversation
The Wave 2 task A brief and ADR-0002 chose to register a ScriptedImporter for the .json extension. Unity rejects that at runtime - the built-in TextAsset importer owns .json and scripted importers cannot claim it. This PR switches to a dedicated .oae (OpenApparatus Environment) extension, documented in new ADR-0008 (supersedes ADR-0002 on the .json point only). Alongside the rename, several spawner and inspector improvements landed: Importer / inspector - JsonEnvironmentImporter now claims ".oae" and exposes ColliderMode + Substitution as serialized fields persisted in the .meta file. - JsonEnvironmentImporterEditor (new) hosts the spawn options + button in the editable top "Import Settings" section. Unity 6 locks the bottom "Imported Object" section, where they previously lived. - Inspector now lists each environment's Object Types so researchers see exactly what strings to put in PrefabSubstitutionTable entries. - MultiRoomEnvironmentAssetEditor reduced to a passive summary. Spawner - Each Room now gets explicit Floor and Ceiling child GameObjects in addition to per-Wall children. Each carries its own MeshFilter + MeshRenderer + per-part material via MaterialResolver. - JsonGeometryBuilder splits BuildRoomMesh into BuildFloorMesh, BuildCeilingMesh, and BuildWallMesh; the X-mirror that walls already applied is now applied to floor / ceiling tile coordinates too. - Spawner removes the primitive collider on placeholder objects when ColliderMode.Objects is not set. Collider builder - ColliderMode is now a [Flags] enum: None / Walls / Floors / Ceilings / Objects / All. Multi-select in the inspector. - FloorCollider lives under each Room's Floor child; CeilingCollider under Ceiling - symmetric with WallCollider under each Wall. - BoxCollider sizing accounts for the X-mirror correction. Prefab substitution - The new instance carries a RoomObjectInstance marker component (slot + room id + rotation) so downstream code can identify research objects after substitution. Reverses the original design from task J - the marker carry-over is the right call now that we have collider passes that need to enumerate object instances. Tests + docs - Fixture Tests/Fixtures/single_room.json renamed to .oae; .meta moved with it so the GUID stays stable. - Test path constants updated in three test files. - Sample renamed; Samples~/ImportedEnvironment/README.md updated. - ADR-0008 added; ADR-0002 marked superseded with cross-reference. - format-contracts.md and conventions.md updated for the new extension and the [Flags] ColliderMode. - Task briefs A, D, I, L updated to reference .oae fixtures. Plus several smaller cleanups: AssemblyInfo.cs grants the test assembly InternalsVisibleTo on the editor assembly so JsonEnvironmentDiscriminator can stay internal; the importer no longer emits unused per-room Mesh sub-assets (geometry is built at spawn time from RoomData). Follow-ups not in this PR: - openapparatus-core JsonExporter should write .oae files; PR pending. - openapparatus-studio file-save dialogs should default to .oae; PR pending. - Wall-mesh winding may still extrude inward on some wall orientations; to be revisited if production geometry continues to come from this builder rather than Studio's GltfExporter via task B.
The workflow was wired up for Unity Personal (UNITY_LICENSE = full .ulf contents). Switch to the Pro flow: UNITY_SERIAL holds the serial code, combined with UNITY_EMAIL and UNITY_PASSWORD for authentication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ADR-0002 chose to register a ScriptedImporter for
.json. Unity rejectsthat at runtime —
.jsonis owned by the built-in TextAsset importer.This PR switches to a dedicated
.oae(OpenApparatus Environment)extension, documented in new ADR-0008.
Several spawner/inspector improvements landed alongside the rename
because they were already in the working tree from local testing.
What changed
Extension rename (the headline):
[ScriptedImporter]now claims.oae. Unity accepts the registration.Tests/Fixtures/single_room.json→single_room.oae(.metarenamedto preserve GUID).
Samples~/ImportedEnvironment/single_room.json→single_room.oae.format-contracts.md+conventions.mdupdated.Spawner: per-part child GameObjects.
Each
Room_Xnow has explicitFloorandCeilingchildren (eachwith its own mesh + material), plus per-wall children with their own
meshes.
JsonGeometryBuildersplit into per-surface builders. Tilecoordinates now apply the X-mirror that
OpenApparatusSpaceappliesto wall endpoints — floors/ceilings used to sit at +X while walls sat
at −X.
ColliderMode is now
[Flags]:None / Walls / Floors / Ceilings / Objects / All. Multi-select inthe inspector.
FloorCollidernow lives under each room'sFloorchild;
CeilingColliderunderCeiling. Symmetric withWallColliderunder eachWall.The
Objectsflag controls whether placeholder primitives keeptheir default collider (
GameObject.CreatePrimitiveadds one).Substituted prefabs are never touched — collider is the prefab
author's choice.
Inspector: editable spawn options in the right place.
Unity 6 locks the "Imported Object" section read-only. Spawn options
JsonEnvironmentImporterEditorthatshows in the editable "Import Settings" section. Bonus: the summary
now lists each environment's Object Types so researchers know exactly
what strings to type into
PrefabSubstitutionTableentries.Prefab substitution preserves the marker.
The substituted instance gets a
RoomObjectInstancecomponent(slot + room id + rotation) so downstream code can find research
objects after substitution. Reverses one note in task J's brief;
the marker carry-over is the right call.
Follow-ups not in this PR
openapparatus-core: bumpJsonExporterto write.oaefiles.openapparatus-studio: file-save dialogs default to.oae.orientations. To be revisited if production geometry continues to
come from
JsonGeometryBuilderrather than Studio'sGltfExportervia task B.