In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the example analysis packaged in Unity3D, which is very detailed and has certain reference value. Friends who are interested must finish it!
When packaged in Unity3D, events can be monitored during the process. For example, the beginning of packaging, and the end of packaging, compiling shader and so on.
Start packing.
Implement the IPreprocessBuild interface in the editor. The following is an official example:
Using UnityEditor;using UnityEditor.Build;using UnityEngine
Class MyCustomBuildProcessor: IPreprocessBuild {public int callbackOrder {get {return 0;}} public void OnPreprocessBuild (BuildTarget target, string path) {Debug.Log ("MyCustomBuildProcessor.OnPreprocessBuild for target" + target + "at path" + path);} end of packing
Add a listening PostProcessBuildAttribute to the editor
Using UnityEngine;using UnityEditor;using UnityEditor.Callbacks
Public class MyBuildPostprocessor {[PostProcessBuildAttribute (1)] public static void OnPostprocessBuild (BuildTarget target, string pathToBuiltProject) {Debug.Log (pathToBuiltProject);}
} before compiling shader
Implement IPreprocessShaders interface in editor
Using System.Collections.Generic;using UnityEditor.Build;using UnityEditor.Rendering;using UnityEngine;using UnityEngine.Rendering
Class MyCustomBuildProcessor: IPreprocessShaders {ShaderKeyword m_Blue
Public MyCustomBuildProcessor () {m_Blue = new ShaderKeyword ("_ BLUE");}
Public int callbackOrder {get {return 0;}}
Public void OnProcessShader (Shader shader, ShaderSnippetData snippet, IList data) {for (int I = data.Count-1; I > = 0;-- I) {if (! data [I] .shaderKeywordSet.IsEnabled (m_Blue)) continue
Data.RemoveAt (I);} Packaging scenario
Implement IProcessScene interface in editor
Using UnityEditor;using UnityEditor.Build;using UnityEngine
Class MyCustomBuildProcessor: IProcessScene {public int callbackOrder {get {return 0;}} public void OnProcessScene (UnityEngine.SceneManagement.Scene scene) {Debug.Log ("MyCustomBuildProcessor.OnProcessScene" + scene.name);}}
Switching platform
Implement IActiveBuildTargetChanged interface in editor
Using UnityEngine;using UnityEditor;using UnityEditor.Build
Public class ActiveBuildTargetListener: IActiveBuildTargetChanged {public int callbackOrder {get {return 0;}} public void OnActiveBuildTargetChanged (BuildTarget previousTarget, BuildTarget newTarget) {Debug.Log ("Switched build target to" + newTarget);}}
With these events, you can easily add your own personalized needs before and after packaging.
For example, delete some test scenarios and test resources contained in the AB package before packaging.
The above is all the content of the article "sample Analysis packaged in Unity3D". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.