mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Check if parent actually exists
This commit is contained in:
parent
49ba76af11
commit
3cdefbfd53
@ -119,7 +119,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
nomaiWallTextObj.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
nomaiWallTextObj.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nomaiWallTextObj.transform.position = planetGO.transform.TransformPoint(info.position);
|
nomaiWallTextObj.transform.position = planetGO.transform.TransformPoint(info.position);
|
||||||
@ -182,7 +186,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
customScroll.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
customScroll.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customScroll.transform.position = planetGO.transform.TransformPoint(info.position ?? Vector3.zero);
|
customScroll.transform.position = planetGO.transform.TransformPoint(info.position ?? Vector3.zero);
|
||||||
@ -223,7 +231,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
computerObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
computerObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
computerObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
computerObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
@ -260,7 +272,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
computerObject.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
computerObject.transform.SetParent(newParent, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var up = computerObject.transform.position - planetGO.transform.position;
|
var up = computerObject.transform.position - planetGO.transform.position;
|
||||||
@ -307,7 +323,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
cairnObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
cairnObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairnObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
cairnObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
@ -365,7 +385,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
recorderObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
recorderObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|||||||
@ -68,7 +68,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
slideReelObj.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
slideReelObj.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
slideReelObj.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
|
slideReelObj.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
|
||||||
@ -165,7 +169,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
autoProjector.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
autoProjector.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoProjector.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
|
autoProjector.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
|
||||||
@ -210,7 +218,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
g.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
g.transform.SetParent(newParent, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g == null)
|
if (g == null)
|
||||||
@ -265,7 +277,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
standingTorch.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
standingTorch.transform.SetParent(newParent, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (standingTorch == null)
|
if (standingTorch == null)
|
||||||
|
|||||||
@ -139,7 +139,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
{
|
{
|
||||||
signalGO.transform.parent = planetGO.transform.Find(info.parentPath);
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
signalGO.transform.parent = newParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signalGO.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
signalGO.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user