Browse Source

Stage activates child canvas on startup #84

master
chrisgregan 10 years ago
parent
commit
80a68f4059
  1. 15
      Assets/Fungus/Portrait/Scripts/Stage.cs

15
Assets/Fungus/Portrait/Scripts/Stage.cs

@ -7,6 +7,8 @@ using System.Collections.Generic;
namespace Fungus
{
[ExecuteInEditMode]
public class Stage : MonoBehaviour
{
public Canvas portraitCanvas;
@ -23,7 +25,6 @@ namespace Fungus
[HideInInspector]
static public List<Stage> activeStages = new List<Stage>();
[ExecuteInEditMode]
protected virtual void OnEnable()
{
if (!activeStages.Contains(this))
@ -31,11 +32,21 @@ namespace Fungus
activeStages.Add(this);
}
}
[ExecuteInEditMode]
protected virtual void OnDisable()
{
activeStages.Remove(this);
}
protected virtual void Start()
{
if (Application.isPlaying &&
portraitCanvas != null)
{
// Ensure the stage canvas is active
portraitCanvas.gameObject.SetActive(true);
}
}
}
}

Loading…
Cancel
Save