Skip to content

Commit

Permalink
Fix #101: failing to find a transform for JSILabel is no longer fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed May 22, 2023
1 parent 4ba533b commit fd14b83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion RasterPropMonitor/Auxiliary modules/JSILabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,14 @@ public override void OnLoad(ConfigNode node)
batchInfo.OnLoad(node);

Transform textObjTransform = JUtil.FindPropTransform(internalProp, transformName);

if (textObjTransform == null)
{
JUtil.LogErrorMessage(this, "Transform named {0} not found in prop {1}", transformName, internalProp.propName);
return;
}

Vector3 localScale = internalProp.transform.localScale;

Transform offsetTransform = new GameObject().transform;
offsetTransform.gameObject.name = "JSILabel-" + this.internalProp.propID + "-" + this.GetHashCode().ToString();
offsetTransform.gameObject.layer = textObjTransform.gameObject.layer;
Expand Down

0 comments on commit fd14b83

Please sign in to comment.