This is the 15th day of my participation in the August Text Challenge.More challenges in August
👉 About the author
As we all know, life is a long process of constantly overcoming difficulties and reflecting on progress. In this process, there will be a lot of questions and thoughts about life, so I decided to share my thoughts, experiences and stories to find resonance!! Focus on Android/Unity and various game development tips, as well as various resource sharing (websites, tools, materials, source code, games, etc.)
👉 about to learn
Learn about the problems Unity may encounter when launching WebGL and how to solve them.
👉 background
Today small zhi 🙎 and small empty 🙈 eat dumplings together today (dumpling stuffing is 3 weeks ago frozen), too poor!
👉 Practice
Er… I just finished an Android project a couple of days ago, and suddenly I got a message to start a unity thing, the browser webGL WTF??
I haven’t touched it; When the project design was approved, I hurriedly made up the unity, and I could check the information in the development process. At last it was done as planned; Make a note of any problems you encounter, and if you are a Unity god, ignore them.
Development environment: Unity 2018.x (64bit) — Active
Browser: Google Chrome 70.0.3538.67 Mozilla Firefox 63.0.1.6877
Firefox can open up HTML and run it, but Google can’t; But you can build it with Build&Run under File and of course Google is the default browser, so Google opens it directly;
Problem a
When importing an image and converting it to Sprite, P appears: why convert to Sprite? What is the elf system? What is the Sprite principle?
OnlyPOT texture can be compressed if mip-maps are enabled
Onlytextuers with width/height being multiple of 4 can be compressed to DXT
Reason: Images must be a power of 2 to use this format. Many times Mip Maps are not selected because they take up too much content. Just check out GenerateMip Mpas
Question 2
Very simple problem, be sure to add all the scenes in the build; File–build setting
Question 3
Movie Importing requires quick time to be installed
This question is more, see: blog.csdn.net/qq\_2748900…
Problem four
When publishing WebGL, the font is not displayed in Chinese by default; So you need to modify the font style the vera.ttf font package download address: download.csdn.net/download/qq…
Problem five
When creating a UI, there is a Canvas parent class by default, which cannot be resized by default. As shown in figure
The solution is to change the Render Mode of Canvas to World Space.
Question 6
Get object’s children, all objects, etc
Gets level 1 child nodes
foreach (Transform child in this.transform)
{
Debug.Log(child.name);
}
Copy the code
The bg Main Loading is obtained
Gets all child nodes
foreach (Transform child in gameObject.GetComponentsInChildren<Transform>())
{
Debug.Log(child.name);
}
Copy the code
// This will include all child nodes with the transform attribute
In the example above, you get all the controls;
Question 7
Unity is associated with VS (see figure), but when it opens, Unity’s default Mono is still used
Solution: Set Unity and VS to run as administrators by default; However, it seems that this prevents you from dropping external resources directly into Unity in the form of direct drag and drop without affecting the overall situation
Question 8
Sometimes when we realize the hidden display of the object, it may be to modify the coordinates of the object to realize the illusion of the object disappearing. At this time, we should pay attention to the error of judgment caused by the coordinate system problem
Child. The transform. The position. Z is the world coordinate system
Child. The transform. LocalPosition. Z is the parent node as the center coordinate system
👉 other
📢 author: Xiaokong and Xiaoshi nakoko 📢 Reprint: be sure to indicate the source: Zhimen’s personal homepage (juejin. Cn). 📢 welcome to like 👍 collect 🌟 message 📝