场景中 克隆生成的物体 ,为 在PoolManager 的 池子中的物体的子物体。
编辑器中退出Player模式后,报错。
目前没有什么办法解决这个报错。
Can't destroy Transform component of ''. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
在退出应用之前 destory克隆物体,但是还是报错。
...
#region 退出 应用
/// <summary>
/// 当 退出应用的时候
/// </summary>
void OnApplicationQuit()
{
Debug.Log("Application ending after " + Time.time + " seconds");
destoryAllChild(trans001);
}//
private void destoryAllChild(Transform trans)
{
print("destoryAllChild");
if (trans != null
&& trans.childCount > 0)
{
print(trans.name + "///"+ trans.childCount);
for (int i=0;i < trans.childCount; i++)
{
GameOb

这篇博客探讨了在Unity中遇到的一个问题,即在PoolManager的池子中,作为子物体的克隆对象在退出Player模式后导致错误。尽管尝试在应用程序退出前销毁克隆物体,但仍然会收到错误提示。文章讨论了MonoBehaviour.OnApplicationQuit()方法在处理这个问题时的局限性。
最低0.47元/天 解锁文章
7339

被折叠的 条评论
为什么被折叠?



