1 (edited by Meractus 2016-10-13 15:40:43)

Topic: (Solved) UFE play mode error on focus change

Hello, I am having an issue in UFE 1.8 (fresh project) and unity 5.4.1f1 that while I'm playing, either versus or training mode, and I press Alt+Tab, for example, and then come back to the game, it crashes.

Error logs:

NullReferenceException: Object reference not set to an instance of an object
CameraScript.DoFixedUpdate () (at Assets/UFE/Scripts/CameraScript.cs:70)
UFE.FixedUpdate () (at Assets/UFE/Scripts/UFE.cs:2008)
NullReferenceException: Object reference not set to an instance of an object
DefaultBattleGUI.DoFixedUpdate () (at Assets/UFE/Scripts/UI/Templates/DefaultBattleGUI.cs:123)
UFE.FixedUpdate () (at Assets/UFE/Scripts/UFE.cs:2016)

EDIT:
"It has never happened to me before in 1.6, and since I believe it is more "unity related" than just c#, I'm having a little bit of trouble finding out where the problem begins."
After some tests it does happens in 1.6, an since it is still a problem in 1.8, it is in 1.7 and 1.7.1 as well.

Any help is appreciated.

Share

Thumbs up Thumbs down

Re: (Solved) UFE play mode error on focus change

I was able to correct this after debugging the code. To solve this problem go to GlobalEditorWindow.cs and look for:

if (!globalInfo.debugOptions.startGameImmediately)

Change it so it looks like this:

if (!globalInfo.debugOptions.startGameImmediately && !EditorApplication.isPlayingOrWillChangePlaymode)

The problem was that the editor was setting valuable ingame variables to null, like this:

globalInfo.selectedStage = null;
globalInfo.player1Character = null;
globalInfo.player2Character = null;

This was cause both CameraScript.cs and DefaultBattleGUI.cs to have problems when doing ther Update/FixedUpdate.

That's it, hope it helps someone.

Share

Thumbs up +1 Thumbs down