3) Android View becomes part of Unity interface 4) Unity upgrade leads to project startup time too long 5) Cascaded Shadows in Unity are set on the mobile terminal
This is the 258th post of UWA technical knowledge sharing. Today, we continue to select a number of issues related to development and optimization for you. It is recommended that you read for 10 minutes.
UWA Q&A Community: Answer.uwa4d.com UWA QQ Group 2:793972859 (The group is full)
Lua
Q: Do you want to use String.format in Lua and then pass it to C#, or do you want to use String.format in Lua and then pass it to C#?
In Lua, the format is used to load a text table and then pass it to C# for display. In C#, the format is used to read a text table and Lua passes the parameters to C# and then use it.
The second option is better, because the simpler the parameter is, the better. Parameter can be packaged.
Thanks to the Tao@UWA Q&A community for the answers
A2: Please refer to this article:
Using Lua+Unity to Get Performance Flying — Lua and C# InteractionsLua passes arguments to C#, preferring types such as int, float, and double, followed by types such as bool, string, and object, while minimizing the number of interactions.
Thanks to the @uwa Q&A community for providing the answer
iOS
Q: Unity’s iOS release had a screen issue after iOS 11: half the screen was compressed and the other half was black.
A: Set these parameters directly in the editor, don’t set them in the code, 7p will not have this problem:
Screen.autorotateToLandscapeLeft = true; Screen.autorotateToLandscapeRight = true; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; Screen.orientation = ScreenOrientation.AutoRotation;
Thanks to the @uwa Q&A community for providing the answer
Unity
Q: When an Android Activity is loaded, it will block the Unity interface. How to make the Android View part of the Unity interface? Part of the Unity interface is implemented using the Android native SDK interface.
A: The interface for Android and Unity is complete.
https://blog.csdn.net/Yzw_92_…
Thanks to Humphrey @UWA for providing the answer
Editor
Q: I checked Unity’s editor.log and found it:
RefreshInfo: InitialScriptRefreshV2 (NoUpdateAssetOptions) RefreshProfiler: Total: 0.000 ms InvokeBeforeRefreshCallbacks: 1115393.587 ms…
OnSourceAssetsModified: 340.325 ms…
ImportAndPostprocessOutOfDateAssets: 1032441.185 ms (82533.117 ms without children) ImportManagerImport: 82501.381ms (0.000ms without children)……
Does anyone know what this is dealing with? Science online also did not check the relevant information, here to see the time is very long 1115393.587ms.
A: Refer to the following points:
- Check to see if the project is on a mechanical hard drive. It is recommended to put it on the solid state of NVME. Because the higher version of the data structure is more complex, it is too late to serialize without solid state.
- Check to see if the PlasticSCM is on.
Thanks to Xiao Xiaojun @uwa Answers Community for providing the answer
Rendering
Q: Does Unity’s Shadow Cascade feature work on mobile platforms?
In the scene, we use the real time shadow that Unity has. The parameters are as follows:
Use Frame Debug to observe the shadow drawing process:
The Shadowmap is 1024 * 1024. There will be black shadow overlay in the distance of the scene.
When Cascade is 2, distance shadow disappears:
Use Frame Debug to observe the shadow drawing process:
Shadowmap is still 1024 * 1024, but it is split in two, 1024 * 512 each.
This was done on a PC, proving that Cascade does work. However, when you switch to Android in BuildSettings in Unity editor, no matter how you change the Cascade value, there will be shadows in the distance of the scene. Use Frame Debug to observe the shadows drawn as follows:
It seems that this parameter does not work on Android, and a look at the Unity documentation does not indicate that Shadow Cascade does not support mobile platforms.
Do you have the same problem?
A: Graphics Settings need to enable Cascaded Shadows at the corresponding Tier.
Thanks to the x21@UWA Q&A community for providing the answer
20210712 more wonderful questions waiting for you to answer ~
1. How to implement incremental update of AAB package 2. Problems about Unity’s AAB package 3. Technical difficulties in RTS mobile game
Cover image from the network
That’s all for today’s sharing. Life, of course, is long and knowledge is long. The questions you may see are just the tip of the iceberg in the long development cycle, and we have already prepared more technical topics for you to explore and share on the UWA Q&A website. Welcome you who love progress to join us. Maybe your method can solve others’ urgent need. And the “stone” of another mountain can attack your “jade”.
Website: www.uwa4d.com Official Technology Blog: blog.uwa4d.com Official Q&A Community: Answer.uwa4d.com Official Technology QQ Group: 793972859 (The original group is full)