Skip to content

Commit

Permalink
fix(Highlighters): ensure custom outline arrays are never null
Browse files Browse the repository at this point in the history
The `customOutlineModels` and `customOutlineModelPaths` arrays could
be null if they were not set in the inspector and the scene changes
to a scene that uses a highlighter because Unity only seems to
auto initialise the array if the scene the array is being used in is
the one that is started.

This fix ensures to set the array if it's null.
  • Loading branch information
thestonefox committed Feb 23, 2017
1 parent 79a1972 commit 1fb9016
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ public override void Unhighlight(Color? color = null, float duration = 0f)
}
}

protected virtual void OnEnable()
{
if (customOutlineModels == null)
{
customOutlineModels = new GameObject[0];
}

if (customOutlineModelPaths == null)
{
customOutlineModelPaths = new string[0];
}
}

protected virtual void OnDestroy()
{
if (highlightModels != null)
Expand Down

0 comments on commit 1fb9016

Please sign in to comment.