B
B
Baaha2021-11-11 13:56:38
Unity
Baaha, 2021-11-11 13:56:38

For some reason, it opens, then there is no picture when you click on the button in the UNITY C# application?

I am writing the simplest informational application in UNITY, the C# programming language. I am getting into this science, so to speak.
The structure is as follows: there is a main menu of a couple of buttons, from which you can get to a menu with a list of many buttons. Clicking on one of the buttons opens the image.
How it works: all buttons are written through SetActive(true\false). By clicking on the button, the current page (a branch of canvas+image+buttons, for example) gets the inactive status and is not visible, the page specified in the button gets the active status and is shown, respectively.
The problem is only when running on a smartphone. There are no problems when running inside UNITY. When you click on the buttons in the list menu, a script is fired (the current page is inactive, specified in the asset), but sometimes instead of an image, just a white canvas. The image is an image file with a specified sprite inside.
The most interesting thing is that it works when and how. That is a bug, then it is not there and everything works fine. Only a few buttons don't work. Most of them usually display images correctly. If you launched the application and there is a bug, then it can disappear only after a restart. And until that moment, the image that did not seem so will not be visible.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Davilkus Games, 2021-11-22
@Davilkus

Try checking the canvas binding

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question