Commit Graph

7 Commits

Author SHA1 Message Date
Lorenz Junglas
5731171257 Prefab editor optimizations (#4523)
* Don't UpdatePrefabInstances if the edited PrefabScene is the only one open in editor

* Avoid some allocations when processing prefab guid mappings

* Json Diff use 64bit hash isntead of paths for presence tracking, which avoids a ton of string allocations

* Less LINQ in prefab GUID tracking code
2026-04-13 15:30:36 +01:00
Lorenz Junglas
73eb8b7dba Fix issues when referencing deleted prefabs (#4487)
* Log warning isntead of asserting when a prefab file is missing

* Prefab Instances with missing prefab files now show up as broken in the hierarchy

Their data is retained similar to missing components so if the file gets restored the instance will recreate properly

https://files.facepunch.com/lolleko/2026/April/07_15-50-CarelessIraniangroundjay.png
2026-04-08 09:48:06 +01:00
Carson Kompon
738a749873 Mount Prefabs (#4085)
- Added `PrefabBuilder` which can be used in a ResourceLoader to include custom prefabs along with a mount
- Changed StartupLoadProject so that it will register custom asset types BEFORE mounting, so that any assets within mounts (like .prefab files) can be resolved by the asset system
- Added `PrefabFile.Load` which lazy-loads PrefabFiles (just like `Model.Load` or `Texture.Load`)
- ResourceLibrary.Load<>() has been updated to call PrefabFile.Load when handling a PrefabFile (just like Models, Textures, ect)
- Added some basic tests for the PrefabBuilder
2026-03-25 09:40:10 -04:00
Lorenz Junglas
5517a11f95 Minor prefab improvements (#4155)
* Use ToArray to avoid collection modified while iterated exception

Not sure this ever actually happened but better to be save.

* Remove ValidatePrefabLookup from SerializePrefabInstance

ValidatePrefabLookup may have modified GUIDs incorrectly on undo/redo.
Also Serialize should be read-only op.
ValidatePrefabLookup  is still called at enough other places.
2026-02-27 09:59:21 +01:00
Lorenz Junglas
5a18042ef6 Improve error handling for nested prefabs when prefab is missing (#3980)
Before InitMappingsForNestedInstance would fail when encountering a missing prefab in the hierarchy and crash serialization.
Now Serialization will continue ad a descriptive warning will be logged.
2026-02-03 11:13:15 +01:00
Lorenz Junglas
9551e9844e Cache (De)SerializeOptions in hot paths (#3547)
They are essentially compile time constants, so we shouldn't allocate them
2025-12-03 19:36:51 +00:00
s&box team
71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00