mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Empty game object (#654)
<!-- A new module or something else important --> ## Major features - <!-- A new parameter added to a module, or API feature --> ## Minor features - <!-- Some improvement that requires no action on the part of add-on creators i.e., improved star graphics --> ## Improvements - <!-- Be sure to reference the existing issue if it exists --> ## Bug fixes -
This commit is contained in:
commit
65b0010d3f
@ -20,6 +20,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
private static readonly Dictionary<DetailInfo, GameObject> _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
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -21,7 +21,8 @@ namespace NewHorizons.External.Modules.Props
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user