UI invalidation after Unity3D packaging (FindGameObjectsWithTag)

       I am starting a new project. I feel uncomfortable because there are too many public variables declared in the script, so I use GameObject.FindGameObjectsWithTag("")

The way to obtain instance resources, Wanwan did not expect to get burned. At first on the PC side, the code runs normally, but after packaging, under the Android mobile platform

But it couldn't run normally. After making a lot of guesses, it finally located the evil GameObject.FindGameObjectsWithTag("").


      It turns out that I used this function to obtain the main UI resources when obtaining the key UI buttons, but this method may cause the configuration environment of the execution label to be lost.

Furthermore, the UI resource of the specified Tag cannot be obtained on the mobile terminal, and when Android may be packaged, configuration is required here so that the Tags can be accurately referenced.

     In addition, because the method of obtaining specified activity resources under GameObject consumes performance, it is also a reason why many people are unwilling to use it.

    I hope that those who have the same problem as me can solve the problem as soon as possible!

Guess you like

Origin blog.csdn.net/u011047958/article/details/77938656