Firstly I had some problems with Unity Advertisement the ad did not want to get displayed on mobile but it did get displayed in editor.
To fix this issue I tried a lot of things, like messing up with settings and similar.
The game worked completely fine, but I probably changed something in settings so my game started having some errors in build only.
Now I cannot open my Shop for some reason, the button is interactable, and the click animation plays.
Even when I enable the shop parent, and I try to press some buttons inside(even though the scroll rect works), I only get those on click button animations without any response.
Other buttons in game work without a problem.
Also I deal no damage to the enemies on build, and the only error I am getting in Android Logcat is this:
These are other errors I am getting in Android Logcat.
I get no errors in editor.
Things I tried doing:
I tried updating my Api and changing it.
I tried resolving using Mobile dependency resolver.
I tried changing scripting backend to mono (even though it was on IL2CPP the whole time)
I tried changing Api compatibility level.
while it works in the editor, you need to add some logging to find out whats null, its clearly something in your enemy area, so, add some logging to the things that need to be found, identified, etc that if done in a different order, so you can find out what fails
I do not think it is the same answer, why would I be getting this error out of nowhere even though it worked perfectly fine before?
I never even changed a single script, nor did I modify my hierarchy.
The only thing I messed with are Api’s and settings.
Either way I added the null checks, I am not getting any errors now, but still the game on build does not work the same as in Editor.
This is not a script issue since everything worked perfectly fine on build a few days ago.
The Shop could open, now it can not. The buttons inside shop are interactable but they do not do anything. Even though they did work perfectly fine before.
Every other button works fine.
The game works perfectly fine in Editor, the shop can open and the ads can also play.
Thank you in advance!
I’m not getting any errors anymore on Android Logcat, but still the game is not the same in Editor and on Build.
Most buttons still do not work on build, they do get clicked, they are interactable, but they do not do anything.
These buttons are related to only one script, that script has no errors,
It is completely the same hierarchy, it is the same script as it was a few days ago when it worked on build.
And i do not have any of these problems in Editor.
It is so weird, and I do now know what could be the reason for this?
As eluded to earlier - a build may run differently than in the editor, things may not happen in the same order.
If you add some debug messages, and check what is in your fixed update that maybe null, and concentrate there, although frankly as thats not the first error… always start with the first.
if you arent getting more messages and you added some, you clearly needed more
That’s called papering over the problem. This is generally only useful when you expect something to be null, such as an object coming in over the network or some other external source.
It’s like going to the coffee shop to buy coffee and forgetting to bring money. If you order coffee and they make it and you don’t have money, that’s a null reference.
If instead you tell them in advance “I have no money” then that is your null check and now they don’t make the coffee for you, that’s called papering over the problem.
Either way you don’t get coffee if you don’t have money.
If the data comes from in your program and you expect and rely on it (sounds like you do from your description) then you need to find the problem.