void OnEnable()
{
if (Application.isPlaying)
{
CreateContainer();
if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
{
UIPackage.AddPackage(packagePath);
}
}
else
{
//不在播放状态时我们不在OnEnable创建,因为Prefab也会调用OnEnable,延迟到Update里创建(Prefab不调用Update)
//每次播放前都会disable/enable一次。。。
if (container != null) //如果不为null,可能是因为Prefab revert, 而不是因为Assembly reload,
{
OnDestroy();
}
EMRenderSupport.Add(this);
screenSizeVer = 0;
uiBounds.position = position;
uiBounds.size = cachedUISize;
if (uiBounds.size == Vector2.zero)
{
uiBounds.size = new Vector2(30, 30);
}
}
}