- Home /
Game Crash When Changing Scene
Hello :D,
I have a game that contains two scenes. One scene is the menu scene and the other one is the gameplay scene. When I press play on the menu scene, it transfers me to the gameplay. Everything works fine in Unity when I click play.
However, when I build both scene, the application (i have a mac) crashes when I click play. However, when I build it AS A DEVELOPMENT BUILD, everything works fine. Why is it behaving in such a way?
Thanks for the help!
Muhasaresa :) ---||---
You're obviously not getting errors, or it wouldn't run. But are you getting any WARNINGS? Check the log.
You are right. I got a Warning that was complaining about scripts that I didn't even write or use! These were located in the Standard Assets folder that caused the issues: "ActivateTrigger", "$$anonymous$$eshCombineUtility" and some mobile Joystick script. I just commented out the affected areas and now it works.
There is just one more detail that doesn't work. I made myself a custom cursor, and it shows in Unity, but when I built the scene it doesn't. Is there some tick box I am missing?
Thanks a lot for your help!
$$anonymous$$uhasaresa
Are you using Unity 4.0 Custom HARDWARE cursor, or just a custom cursor script? If just a script, I can share $$anonymous$$e with you.
I will post my comment as an answer along with a custom cursor script if you don't $$anonymous$$d accepting the answer, that is, if it all works for you. You can also vote up (thumbs up icon) the answer if you wish, Accpet answer is Check$$anonymous$$ark. Of course don't accept or vote up if it doesn't work :) I will go ahead and vote up your question to give you some karma points regardless.
Answer by clunk47 · Dec 16, 2012 at 03:50 PM
So we have establised you are getting no warnings, since you are able to run the standalone. If you are getting WARNINGS, however, take a look at the console or log and find what scripts are causing the Warnings. As far as the custom cursor question, I have posted a C# script to allow you to use your own in game cursor, which will also work in the Standalone build :)
using UnityEngine;
using System.Collections;
public class CustomCursor : MonoBehaviour
{
public Texture2D cursor;
Vector2 mouse;
public float width = 64;
public float height = 64;
Rect cursorPosition;
void Update()
{
mouse = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
if(Screen.showCursor)
Screen.showCursor = false;
}
void OnGUI()
{
cursorPosition = new Rect(mouse.x, mouse.y, width, height);
GUI.DrawTexture(cursorPosition, cursor, ScaleMode.ScaleToFit);
}
}
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Apps crash in development build 0 Answers
SetCursor WebGL doesn't work 1 Answer
Unity app crashes after splashscreen when testing with TestFlight 3 Answers
Editor Crash: Where is Scene Data kept? 3 Answers