Just finished a small game project and have uploaded the complete project via WebGL, however currently the game loads the first scene and crashes trying to load the main scene, there are no errors in the compiler and it works perfectly in the editor.
I'm not sure if this is just for me, so could someone try the game, it freezes(audio still playing) when you click play in the main menu.
http://www.willcardoso.co.uk/UnityGameBuilds/Mario/Completed/index.html
I believe that maybe it could be because the file size may be too big for google? Maximum Used Total Memory = 190mb. If this is the issue, any help on slimming down the file?
Related
Good evening,
Recently I was trying to create an app in Unity where with a button I could open an image or a pdf while the app remains open and running. I tried to do it with Unity, and I didn't see any problem. However, when I used the HoloLens emulator, every time I did it the app opens the file but then closes.
I thought that maybe if I defined several 2D Empty Objects (as Images, Raw Images...) the app would still run while doing this. To do this, I used the WWW class and the example of the Unity Scripting API.
https://docs.unity3d.com/ScriptReference/WWW.html
However, I don't know why when I run the app the Image doesn't change... I also tried the SetTexture() method it still doesn't work. So I was wondering if you have encountered the same problem, and if you could help me to solve it out.
Thanks a lot for your help!
Best Regards
I'd suggest looking up the following post: change texture
It comes down to defining a gameobject, making a prefab out of the Image and setting the material of the prefab. You can easily make new materials by importing an image or making one using projects tab>Create>Material. You could try making 2 Materials with different colors to test it.
It could also be code that needs to be run using UWP outside of the editor, if that's the case, you could use
#if !UNITY_EDITOR
//Put your code here.
#endif
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.
I am creating a 3D game in Unity.
I want to have an image slowly fill up to make the cooldown of a skill visible for the player. Fortunately the UI image can do exactly that.
Unfortunately the UI image causes the engine to crash when I click play. The generic message "Unity stopped working" shows up too.
I created it by going to GameObject>UI>Image. Then I filled in the Sprite and the main camera. I did nothing else.
Removing the Canvas, Image and EventSystem (Which spawn when creating a UI image) fixes the crash.
Am I doing something wrong? I am very new to Unity.
EDIT: It turns out something in my code IS doing something to the image. However, I never in my code specify anything towards the image. I am using GUI elements though. Could that be the problem?
EDIT2: When running the Unity Debugger it gives me the error Couldn't set project path to: C:\Users\[MYNAME]\Documents\CellGame\Assets
I don't know what this means, as everything else is able to load from my assets
EDIT3: That doesn't seem to be the problem at all. What really is the problem is a line I'm calling. I'm going to try to figure out what in that line is causing trouble.
EDIT4: It turned out that there is a problem in my code. When I start my game, for some reason it detects that my player has no health, and goes to the Game Over UI. I had set this to just be the main menu UI, and when it toggles the main menu UI it also reloads the scene. Reloading the scene caused the crash, presumably.
The problem was that my script had a bug, where it would reload the scene as soon as I pressed play. With the UI image in my scene it caused Unity to crash.
I'm not sure why it crashed.
The app runs fine in the editor, but when I run it on a device I get two errors:
java.io.FileNotFoundException : assets/build_info.txt
and then a error from my loading method that says the scene main_menu could not be loaded because its not in the build settings(it is);
What is this build_info.txt that I have never heard of before and why did it suddenly go missing after I imported the google OBB downloader plugin?
UPDATE : The problem seems to be connected to the split application binary option, since without it the app builds fine. Problem is I have to use it since its bigger than 50 mb.
UPDATE 2 : The problem magically fixes itslef after the device is restarted. This happens on multiple devices, even if the game is downloaded from the google play store.
For some reason removing the maxSdkVersion attribute from the <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> tag in the manifest solved the issue.
this might help
maybe you didn't add the scene into the build settings . thats why current scene is running on the editor but the build game is not running !
goto file-> buildSettings -> add the scene on the top box
or click the add current button.
the scene at 0 position will be loaded first !
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.