If there's an active object in the scene with an enabled Outline, it may not be registered with the OutlineEffect if AutoEnableOutlines is false. The outcome depends on script execution order.
If OnEnable() gets called on Outline first, it will not find an OutlineEffect instance and will not register itself. When OnEnable() is later called on OutlineEffect it also won't register the object because AutoEnableOutlines is false so it completely ignores it.
The fix would be rewriting the OnEnable() in OutlineEffect like this:
private void OnEnable()
{
Outline[] o = FindObjectsOfType<Outline>();
if (autoEnableOutlines)
{
foreach (Outline oL in o)
{
oL.enabled = false;
oL.enabled = true;
}
}
else
{
foreach (Outline oL in o)
{
if (!outlines.Contains(oL))
outlines.Add(oL);
}
}
}
If there's an active object in the scene with an enabled Outline, it may not be registered with the OutlineEffect if AutoEnableOutlines is false. The outcome depends on script execution order.
If OnEnable() gets called on Outline first, it will not find an OutlineEffect instance and will not register itself. When OnEnable() is later called on OutlineEffect it also won't register the object because AutoEnableOutlines is false so it completely ignores it.
The fix would be rewriting the OnEnable() in OutlineEffect like this: