-
Couldn't load subscription status.
- Fork 207
Open
Description
If you add outline after start, it doesn't work.
Steps
- Setup the camera with Outline Effect
- Add a cube to the scene
- Press play
- Add Outline component to the cube
- Verify that the outline is not visible
Cause
IsVisible = false although actually is visible. OnBecameVisible event is the event used to change the value of that flag. Because this event was already triggered, when you add the Outline component, the value visible doesn't change because the event was fired before
Fix
Possibly, do some checks at OnEnable and decide if this object is visible or not
Workarround
Forcing the mesh to disable/enable triggers again OnBecameVisible event
public void AddOutline(GameObject go)
{
var outline = go.AddComponent<Outline>();
bool isRendererEnabled = outline.Renderer.enabled;
if (isRendererEnabled)
{
outline.Renderer.enabled = false;
outline.Renderer.enabled = true;
}
}XM-8JD2
Metadata
Metadata
Assignees
Labels
No labels