diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index d17da642..1c2f667d 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -20,6 +20,7 @@ namespace NewHorizons.Builder.Props { private static readonly Dictionary _detailInfoToCorrespondingSpawnedGameObject = new(); private static readonly Dictionary<(Sector, string), (GameObject prefab, bool isItem)> _fixedPrefabCache = new(); + private static GameObject _emptyPrefab; static DetailBuilder() { @@ -69,14 +70,20 @@ namespace NewHorizons.Builder.Props /// public static GameObject Make(GameObject planetGO, Sector sector, DetailInfo info) { - var prefab = SearchUtilities.Find(info.path); + _emptyPrefab ??= new GameObject("Empty"); + + // Allow for empty game objects so you can set up conditional activation on them and parent other props to them + var prefab = string.IsNullOrEmpty(info.path) ? _emptyPrefab : SearchUtilities.Find(info.path); + if (prefab == null) { NHLogger.LogError($"Couldn't find detail {info.path}"); return null; } else + { return Make(planetGO, sector, prefab, info); + } } /// diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 6c8e1cf3..a6cb6592 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -21,7 +21,8 @@ namespace NewHorizons.External.Modules.Props public string assetBundle; /// - /// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle + /// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle. + /// If empty, will make an empty game object. This can be useful for adding other props to it as its children. /// public string path; diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index b8c835e9..e56043fd 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1278,7 +1278,7 @@ }, "path": { "type": "string", - "description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle" + "description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle. \nIf empty, will make an empty game object. This can be useful for adding other props to it as its children." }, "removeChildren": { "type": "array",