Unity application development based on UIWidgets (two)

        The first is the configuration of the UIWidgets environment. Go to UIWdigets in PackageManager and download the latest version. My current version is preview12 1.5.4. If you don't find it, you can check the show previewpackages on Advanced.

Look at the picture above,

The first one says that the plug-in downloaded now lacks some resources. These resources are basically some icons, fonts, emoji and other image resources, which need to be downloaded from the official website github;

 The second one is that if you want to package to other platforms, you also need some plugins to be placed in the corresponding folder before they can be packaged normally, which also needs to be downloaded on github;

The third is a demo of redux on an official website. Redux is a responsive framework of flutter. If imported into the project, mount the main class to the empty planel of UGUI and you can see it, which is a demo of counting;

The fourth is the simple use of UIWigets demo, you can briefly understand the syntax of UIWidgets

After putting all the necessary things in the project, even if it is preliminary preparations.

The above picture shows that I put an input box of the demo on a panel component that removes the Image. You can see that the game perspective is black, but there is something in the preview in the lower right corner. Switching to the Scene perspective can also see the UI interface. Yes, this is because the dynamically created UI has no background color. The default is black. If you add another camera and set it to skybox, you can see it. But UIWidget does not need a camera. Basically, it uses UGUI's screen overlay. The recommended approach is to add a container to the component and set the background color to white

        You can see that Unity is not running but the components are fully loaded. This is also a more powerful part of UIWidgets. When developing later, it was found that as long as the logic is correct, the data can be loaded to the web background server without running.

        If it can run to this step, it proves that the configuration is correct. Now that it is packaged into a real device, there is basically no error. If the real device that cannot be packaged or packaged shows a blank screen, it means that some resources are missing or the unity is not configured. I won't go into details here, I also came to this conclusion after pitting myself a lot.

        During the development process, I found that when setting the resolution of the game window, if you directly set the resolution to 1080x1920, the game viewing angle will appear very large, but the actual packaged size is normal again, as shown in the figure below

 Later, I discovered that it was because the scale of the game was not 1, which is actually normal. But after setting it to 1, the complete UI interface cannot be seen. In order to make the development effect consistent with the actual effect, it is recommended to change the window to a proportional form such as 9:16, so that it will display normally.

        If you need to debug, you can add the UIWidgets_DEBUG field in Scription Define Symbols, so that it is more convenient to see UIWidgets layout-related information in the UIElement Debug window of Analysis.

        The above are some of the pitfalls you will encounter initially when using UIWidgets, remember!

Guess you like

Origin blog.csdn.net/ssssssilver/article/details/107289121