Game restarts after lose focus Unity iOS - c#

I have such problem:
After lose focus, my application restarts, I'm trying to play with custom behaviours, but it isn't work.
Platform: iOS
Unity: 2020.3.26f1

I had the exact same problem but in Android. I searched for hours and tried many different things.
The problem was that I had a piece of code well hidden invoking Unity method OnApplicationPause(). That method was the one responsible for closing the window. Double check if that's not ur case or something like it!

Related

Unity Prefab Not Updating On Old Android Tablet

I have a Samsung Galaxy Tab Active 1, on the latest version of android it can handle, and just recently, after adding accessibility features that shouldn’t affect anything, the balls in my game stopped updating. I instantiate a ball, and change a few properties on it, and then for some reason I think it’s not calling the update method. There are no errors.
I’ve heard using PrefabUtility to instantiate might help, but I haven’t done that just yet. I will update if PrefabUtility works.
Any advice?
Whoops, this was due to me being a bit stupid. The main reason it was happening was because of a parsing error in some of the accesibility settings, as they were not saved correctly due to weirdness I can't wrap my head around with files in Android. TLDR: file did not save correctly, and so did not load correctly, and so data messed up, and so it errored before it could do anything.

Xamarin Cross Platform Splash Screen on App boot

Yo. Some of you might already know but Xamarin Apps are booting pretty slow and the delay occurs before any line of code is executed - at least i figured that out with some breakpoints.
So i want to cover that up using a Splashscreen. But since Xamarin is for multiple platforms i'd like to... welll... use cross platform code.
The most important part is: i do NOT want to cover my code delay. I want to App to NOT open with a white blank screen like it currently does, but e.g. with an image or some animation or such stuff.
and yes i already googled a little but everything i found seemed to be android specific or iphone stuff, or it just takes affect after the system boots.
There is no cross-platform way to do that yet. (Answering in 2017/Dec)
You'll need to make it for each platform.
Android: https://developer.xamarin.com/guides/android/user_interface/splash-screen/
iOS: https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/

SceneManager.LoadScene is crashing for Android Devices

Ok, I've been testing a game with several scenes. In Unity and iOS devices, everything works perfect. In Android, always crash (or freeze if you prefer).
I'm using Unity 2017.2.0f3. and the line of code that crash is the next one (nextScene is a string with the value of the next scene):
SceneManager.LoadScene (nextScene);
I've been trying other options like:
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
But this is not working neither. The last one I tried was:
SceneManager.UnloadSceneAsync(UIManager.Instance.currentScene);
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
Again without success. Please I really need help with this. I've dealing with this problem for 24 hours. It's driving me crazy.
After more than 24 hours I solve the problem. I hope that my solution help other people because there isn't enough references on the web.
When I created the APK file it was splitter with a second one of type OBB. This kind of files is required when the Android App is too big. In my case was set by default.
The solution was to force the creation of the APK without the OBB. To do that you must get to Player Settings in Android, go to Publishing Settings and uncheck Split Application Binary (located at the bottom).
Everything's working now and life is good again.

C# Custom Launcher?

I've created a Launcher for my game and at the moment I'm very happy with it. Though it looks like a standard windows form, I've heard you can but through Google Searches found nothing. But is it possible to completely customize the windows form? E.g. like a WoW/Diablo Launcher?
If so are there any places to check out some tutorials or get started?
If you're using visual studio, there are many options regarding window styles and customizability. For example for my game launcher I simply turned off all of the windows boarders. I followed a video similar to https://www.youtube.com/watch?v=PiTnIc50tAA to get the basic game launcher then I customised it by turning off the property "Control Box" and setting minimize and maximize properties to false. I was able to achieve a custom game window. I hope this helps !

Why is Unity crashing when I press play in the editor?

My game is crashing whenever I switch scenes and then press play in the editor. I am using this code to switch scenes:
...
I have tried disabling most of the scripts in my game to debug the problem but it freezes every time. I've also tried loading the levels without the co-routines but that doesn't help. I can continue playing the game as long as I don't use the editor controls, however things get pretty choppy and performance becomes terrible.
First, look at the editor logs, quite possible that the reason of the crash will be there. If unsure, post them here (post on gist and link here).
Also, if you have unity pro (or a trial version of pro), try looking at the profiler's readings. On free you can also try looking at the Stats button from the Game window. Using too much memory (RAM or VRAM) can cause crashes.
i was also having same problem. if your program is correct then just change the editor path to anything in unity hub and save, close unity hub, open again and set the path to previous one.

Categories