I'm developing an android-app that is supposed to open a Unity scene on a button click in android.
Let me explain it further:
I have developed a 4 scenes Unity project. Each scene has a model to be shown in AR. I have performed all the work I need to. I exported this project to android-studio. Integrated unity project with my android app. Now on different button clicks in android, I want to open different scenes in unity. I am not getting how to do it. I have 4 scenes, but when the unity opens, it opens scene 1.How can I open other scenes? I have written C# script to open different scenes but I don't understand where to attach it.
Can anyone please help me?
The buttons should call:
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
to load a scene.
This does not work in the editor, only in the build itself.
To get it to work you also need to add all the scenes to the build.
You do that by opening a scene, then go to "File->Build Settings->Add open Scenes". Then you should see the scene and scene index in "Scenes in Build"
Related
This is my first time to make a Unity project. Everything works well on the Game view in Unity Editor. However, after I built the project and played it on Google Chrome, I found that the position of some gameobjects had been changed.
Here is a more detailed explanation. The left is what I saw on the game view, which was perfect. The right side is what I saw after built the project. The position of the grey picture had been changed.
Does anyone know how to fix this?
ps.I am using Unity 2020.3.18 with WebGL platform
Try exporting again but with the same resolution as the game view. In this case you would want to export in a 400x600 resolution (You can also edit the "index.html" file to change and experiment with the resolution). The problem has to do with the fact that changing the resolution of the game can affect where certain objects are and how much you can see.
I was following a tutorial on how to make snake. https://www.youtube.com/watch?v=N0QbmNZlxhw&list=PL1bPKmY0c-wnka3TTQhX7mfn9UoVXNP3H&index=1 When Unity crashed and I had not saved it once, however I still have the scripts for it. I tried to make it again but the map won't show up. I looked at the alpha but it was just fine. I need help finding out how to make the game again with the scripts.
You are out of luck, save your scene frequently and before testing/building. If Unity crashes your scene/inspector changes will not recover. Your scripts, however, as they are separate files retain their changes.
For avoiding this in the future I recommend you to use a Version Control System
And within the options of VCS I recommend to you Git
Good day everyone. I have a problem with my game since I'm using the openvr when building my game. The problem is whenever I build my game as a .exe, the position of my camera from my start menu is a little bit off, what I mean is that it is not placed like in the unity editor. And the second one is that even if i disable my track rotation under my head gameobject it still detects the trackrotation (When built).
So far what i had tried are:
1.) setting the trackrotation in the script into trackrotation = false; (still didn't work)
2.) Removing the GvrHead Script from the head(Still effin rotates).
Why is that it still rotate even if I already remove the script from the head and set the trackrotation = false in the script.
or should i disable the gyroscope from my project?
I need to disable it because of the animation I have on my game. It needs to disable the trackrotation.
Someone help.
I'm using my 3rd party software so i did go to vridge app on my phone and disable the tracking rotation of the 3rd party software . So that solves my problem .
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?
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 !