- Home /
App crash after LoadLevel from a specific scene
Hello everyone,
I have 4 scenes in my project (0,1,2,3) and a HUD menu to switch between them.
I'm using Application.loadLevel for this. When deployed to Android device, the app crashes when I execute Application.LoadLevel but only from scene 3 to any other scene. It works like a charm from every other scene.
I have tried catching the error using Logcat but without success.
I have an error in the Unity console whenever I stop the gameview or make a build, I'm not sure it's related to the crash but here it is :
Can't destroy Transform component of 'pivot'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
UnityEditor.HostView:OnGUI()
I checked my code but never found any Destroy function with a Transform arg.
Thank you
Can you run the scene from the editor?
Did you add your scene into your scenes in build?
Try to correct any other errors first.
Answer by Mohamed Reda · Nov 27, 2014 at 10:04 AM
Thank you for your response.
Yes everything works like a charm from every scene in the editor. All my scenes are added to the build. I have tried to empty my scene of all gameobjects except a simple scripts responsible of switching scenes and I've found that the crash persists.
The solution I found is to make a new scene and to copy all gameobjects to it. It has resolved the error.
I think there was something wrong with the old scene, I guess it had remaining references of objects that have been deleted and not displayed in the scene hierarchy...