My project works fine when played on editor with connected smartphone however when I compile it and install to my device, it’s completely different. I would appreaciate a help in any of the below issues:
Projectors are not working at all. I use decal projector for selection circles. No idea how to even debug it to see what is causing that issue
After battle scene, it loads world map with the character panel UI open while it defaults to closed when played in editor. Something sets it to active but there is only one function that does it in my project and is triggered only when pressing the inventory button
The colors are way off. Game looks dark and unsaturated.
When opening inventory, the UI is not refreshed properly. Have to click on each element to refresh its visuals… Works fine on remote play or editor.
Because of so many issues, maybe I did not compile it properly? Scenes are in correct order etc… Old builds worked fine (around 6 months ago on the 2020 Unity version). Currently using 2022.1.5f1 version.
Also note, if I select Developer Build, the compiled project crashes on startup. After googling this issue it seem to be the case that Unity projects crash with ticked Developer Build field so whats the point?
This is why it’s always best to test early and test often.
make a blank scene and test just the projector and some geometry. Study the device logs to see if there are shader errors or warnings
again, Debug.Log()
gamma and color ramps are always different on device. Place a test image (get one online) in a blank scene with an unlit shader and test, see what that test image looks like. That gives you a baseline.
again, Debug.Log()
Unity projects crash with ticked Developer Build field
If you are close to running out of memory, developer builds take a LOT more memory to run and will likely crash. You would need to strip down the test scene and put only the parts you are having difficulty with under debugger testing.
NOTE: You will not solve all of your problems at once, so focus on ONE, do all the testing, get to the bottom of the issue.
You must find a way to get the information you need in order to reason about what the problem is.
What is often happening in these cases is one of the following:
the code you think is executing is not actually executing at all
the code is executing far EARLIER or LATER than you think
the code is executing far LESS OFTEN than you think
the code is executing far MORE OFTEN than you think
the code is executing on another GameObject than you think it is
you’re getting an error or warning and you haven’t noticed it in the console window
To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
is this code even running? which parts are running? how often does it run? what order does it run in?
what are the values of the variables involved? Are they initialized? Are the values reasonable?
are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)
Knowing this information will help you reason about the behavior you are seeing.
You can also supply a second argument to Debug.Log() and when you click the message, it will highlight the object in scene, such as Debug.Log("Problem!",this);
If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.
You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.
You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.
You could also just display various important quantities in UI Text elements to watch them change as you play the game.
Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.
Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:
Thanks, didn’t know I can debug the build version. Now I will be able to get to the bottom of the issues. It’s a shame Unity Remote preview doesn’t reflect the build version.