Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

AssetBundle packaged Resources

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Open unity and create a new project. Create a new Editor folder under Assets.

Create a script AssetsBundles under this folder

Here is the complete code in the script

Generate AssetBundle package

/ / Code part

Using UnityEditor;// reference assembly

Using System.IO

Public class AssteBundles / / do not inherit MonoBehaviour

{

/ / add the attribute to the Assets menu to generate Build AssteBundles option

[MenuItem ("Assets/Build AssteBundles")]

Static void BuildAssetBundles ()

{

/ / generate file name, which is used to store AssteBundle files

String dir = "AssteBundles"

If (Directory.Exists (dir) = = false) / / determine whether the folder exists

{

Directory.CreateDirectory (dir); / / create this folder if it does not exist

}

/ / package marked AssetBundle files if grouping and packaging should load the dependent package first, otherwise the material will be lost BuildPipeline.BuildAssetBundles (dir,BuildAssetBundleOptions.None,BuildTarget.StandaloneWindows64)

}}

After the above code has been executed and compiled, the Build AssteBundles option appears under the Assets menu in unity.

Errors will be reported in the above pictures, which will not affect the program, but will only be errors when searching in the store.

Create a cube and drag the downloaded shader onto Cube to get the effect of the above image

Give the above AssetBundle file a name with a suffix, and I get the name wall with the suffix ab

Go to the Unity page and click the Build AssteBundles option under the Assets menu to package successfully.

Open the AssetBundles folder and you will see the packaged AssetBundle file

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report