feat: add SoftReference support for CustomRoom in DungeonManager#473
Merged
MSchmoecker merged 1 commit intoApr 26, 2026
Merged
Conversation
- New CustomRoom(SoftReference<GameObject>, bool, RoomConfig) ctor defers prefab loading until DungeonGenerator requests the room, mirroring the SoftReference flow already used by CustomLocation. - DungeonManager skips Prefab parenting, activation, and FixReferences for SoftReference rooms since the prefab is not yet loaded at registration. - GenerateHashes now hashes room.Name instead of room.Prefab.name so SoftReference rooms (no loaded Prefab) still register. - Available-room filtering uses RoomData.m_enabled instead of Room.m_enabled to avoid touching the lazy-loaded Room component. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
69fa20e to
4581549
Compare
MSchmoecker
approved these changes
Apr 26, 2026
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.
Summary
Adds a new
CustomRoom(SoftReference<GameObject>, bool, RoomConfig)constructor so mods can register custom dungeon rooms that live in soft-reference bundles, mirroring the existing soft-ref flow forCustomLocation.Changes
JotunnLib/Entities/CustomRoom.csCustomRoom(SoftReference<GameObject>, bool, RoomConfig).softReferencePrefab.IsValid; logs and bails if invalid.ResolveMocksOnLoadcallback parented toDungeonManager.DungeonRoomContainer.transform.RoomDatawithm_prefab = softReferencePrefab,m_loadedRoom = null,m_enabled = roomConfig.Enabled ?? true,m_theme = GetRoomTheme(ThemeName).SoftReferenceflag on the custom room so downstream code can branch on it.JotunnLib/Managers/DungeonManager.csDungeonRoomContainerpromoted fromprivatetointernalso the new ctor can parent the resolved asset.AddCustomRoomskipsPrefab.SetParent/SetActive(true)for soft-ref rooms (no prefab yet).OnDungeonDBStartedskipsPrefab.FixReferences(true)for soft-ref rooms — mocks are resolved later byMockResolutionContext.InstantiateAndResolveAssetwhen the asset actually loads.GenerateHasheshashesroom.Nameinstead ofroom.Prefab.nameso soft-ref rooms (Prefab still null) still register.OnDungeonGeneratorSetupAvailableRoomsfilter switched fromr.Room.m_enabledtor.RoomData.m_enabledto avoid touching the lazy-loadedRoomcomponent.