@modoki/engine / index / collectResourceRefsFromEntities
Function: collectResourceRefsFromEntities()
collectResourceRefsFromEntities(
entities):SceneResourceRef[]
Walk entities and extract every resource ref they reference. Mirrors the editor's collectResourceRefs in scene/serialize.ts but lives here so the runtime loader doesn't depend on the editor module. Sorted + deduped. path in the returned refs may be a GUID or a path; downstream loaders accept both.
The SCALAR ref fields are data-driven from REF_FIELDS_BY_TRAIT (via SCALAR_RESOURCE_TYPE_BY_FIELD); the non-scalar / dynamic / payload-bearing refs (AnimationLibrary.animSets, SkinnedMeshRenderer.materials, Renderable3DPrimitive.material, ModelSource.glbPath, UIElement.fontFamily, structural entry.prefab) stay explicit.
Parameters
entities
readonly object[]