Unity Prefab Not Updating On Old Android Tablet - c#

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.

Related

URP - Weird visual artifacts in Unity 2020.1.15f1

I started up a new URP project with everything pretty much default.
When I first loaded in a scene I noticed some weird shading issues. There were two concentric circles that were shaded in a way that it seemed like a depth of field effect. I wasn't sure how to get rid of them, so I moved on.
I got a basic first person controller and discovered more strange artefacts as I started walking around weird line imperfections within the grids and such, and the weird depth of field of effect I found in the scene view carried over into the game.
I've tried to searching around to find out if anyone else has had this problem before me, but I couldn't find anything. I've also tried to change post processing settings as well as some basic lighting settings. Nothing seems to fix the issue.
This video shows the issue a little more closely: URP Artifacts
Ok, I fixed it by just creating a new project that did not derive from the URP template. Then I just manually converted it to URP.
I don't know why this happened when I was using the template. I don't know why this works. Probably it has something to do with the initial settings that come with the template, but that is just conjecture.

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.

Monogame SoundEffect Crash

I am trying to re-program some old Arcade games in C# with the Monogame engine. However, I have encountered a certain problem.
Since my code tends to be a bit messed up, I am often not taking the effort to reset everything when the player successfully completes the game. Instead, I am simply closing the current Game-instance and opening a new one, like this: (in Program.cs)
if (startgame)
{
do
{
using (var game = new Game1(level, points, soundOn))
game.Run();
} while (continueGame == true);
}
Now the problem. In Game1, I am declaring and playing various SoundEffects. The first run everything works fine, but in all following Game1-instances, my program will always throw an System.AccessViolationException related to SharpDX.XAudio2.dll at the moment I am calling the .Play()-Method of a SoundEffect.
I tried playing SoundEffectInstances instead of the actual SoundEffects. Now it doesn't crash anymore, but is being completely silent from level 2 on instead.
Do you know what could be the reason of this error? Is my game-restarting loop causing problems I did not know about?
Thank you in advance.
(I am using Win 7 64 Bit, VS Express 2015 and Monogame 3.6)
Do you know what could be the reason of this error? Is my game-restarting loop causing problems I did not know about?
Yes. Do not do it.
You are destroying the whole game object just to reset the game. This is a very bad style, because it destroys the whole instance and everything that is connected to it. If you use static variables within it, they will remain in memory which may be the problem you have.
If you want to reset your game, simply write a Reset-method for everything and call these instead. Cleanup and nice code is something you should use instead of terrible hacks.
Can you show more code, so it is possible to understand, what went wrong?
PS: Never write something like while (continueGame == true) always go for while (continueGame).
There is a chance that the issue is due to SharpDX's reaction to the media file itself. For instance, an MP3 file that would work perfectly fine under XNA 4.0 loaded as a SoundEffect (with associated SoundEffectInstance) may crash the game under MonoGame UWP. (This happened to me with one file, but I was already using SoundEffectInstance in the first place when the crashing started.)
As such, have you tried re-encoding your relevant audio files, such as through a utility like Audacity? Although it may not solve the internal issue per se (some element of the audio file breaking SharpDX), if a re-encoded file doesn't have the problem element in the first place, that should be a valid solution for you.

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.

Where is my error occuring Unity

When I can run my game perfectly fine, however when it stops I get this error
!CompareApproximately (det, 1.0F, .005f)
UnityEditor.DockArea:OnGUI()
From what I've been able to find I think I would be able to fix it, however I can't find where the error is occuring. I would include code, but I'm not sure what would be relevant. Any ideas would be appreciated.
This error is unrelated to your game code. This is just a small bug within the Unity Editor's internal GUI coding. Although, I thought they had patched this particular one up with the lastest hotfix release. Ensure that you are running the latest version of Unity.
Looks like you're due for a Unity Update.

Categories