当前位置: 首页 > wzjs >正文

做系统网站赚钱什么是搜索引擎优化

做系统网站赚钱,什么是搜索引擎优化,做网站要好多钱,沙河企业做网站1.新建两个预制体: Cube1:GameObject Material1:Material Cube1使用了Material1材质 之后设置打包配置 Cube1的打包配置为custom.ab Material1的打包配置为mat.ab 2.在Asset文件夹下创建Editor文件夹,并在Editor下创建BuildBundle…

1.新建两个预制体:

Cube1:GameObject

Material1:Material

Cube1使用了Material1材质

之后设置打包配置

Cube1的打包配置为custom.ab

Material1的打包配置为mat.ab

2.在Asset文件夹下创建Editor文件夹,并在Editor下创建BuildBundles.cs

using System.IO;

using UnityEditor;

using UnityEngine;

public class BuildBundles : Editor

{

[MenuItem("Custom/BuildBundles")]

static void BuildBundle()

{

//参数(打包路径、选项为None、使用平台)

BuildPipeline.BuildAssetBundles(Path.Combine(Application.dataPath + "/AssetBundle"), BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);

}

}

创建完成后,可在工具栏看到Custom/BuildBundles选项

3.将预制体打包成AssetBundle文件

在Asset文件夹下创建AssetBundle文件夹

之后点击工具栏的Custom/BuildBundles,AssetBundle文件被生成至AssetBundle文件夹中

AssetBundle是本次生成的所有的AssetBundle文件的配置文件,其中的AssetBundleManifest属性描述了文件的信息和依赖关系

custom.ab为Cube1的配置信息,上面也说明了其与mat.ab有依赖关系

以下是mat.ab的配置信息

4.获取AssetBundle文件并编译至场景中

新建AssetBundleTest.cs,并挂载至场景内任何一物体中

using System.Collections;

using System.IO;

using UnityEngine;

using UnityEngine.Networking;

public class AssetBundleTest : MonoBehaviour

{

// Start is called before the first frame update

void Start()

{

//loadMat();//同步加载(依赖)

//loadCube();//同步加载(Cube)

StartCoroutine(LoadCubeAsync());//异步加载

//StartCoroutine(LoadCubeWWW());//从服务端获取

}

//加载依赖(同步)

void loadMat()

{

//加载依赖

//读取AssetBundle下名称为AssetBundle的文件

string path = Application.dataPath + "/AssetBundle/AssetBundle";

AssetBundle assetBundle = AssetBundle.LoadFromFile(path);

//加载该文件夹里的配置信息

AssetBundleManifest assetBundleManifest = assetBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");

//加载名为custom.ab的文件的所有依赖并转为字符串数组

string[] strs = assetBundleManifest.GetAllDependencies("custom.ab");

foreach(string name in strs)

{

//加载出需要用到的AssetBundle文件

AssetBundle.LoadFromFile(Application.dataPath + "/AssetBundle/" + name);

}

}

//加载Cube(同步)

void loadCube()

{

string Cubepath = Path.Combine(Application.dataPath + "/AssetBundle/custom.ab");

AssetBundle ab = AssetBundle.LoadFromFile(Cubepath);

GameObject CubePre = ab.LoadAsset<GameObject>("Cube");

Instantiate(CubePre);

}

//异步加载Cube

private IEnumerator LoadCubeAsync()

{

//加载依赖

//读取AssetBundle下名称为AssetBundle的文件

string path1 = Application.dataPath + "/AssetBundle/AssetBundle";

AssetBundleCreateRequest assetBundle1 = AssetBundle.LoadFromFileAsync(path1);

yield return assetBundle1;

//加载该文件夹里的配置信息

AssetBundleManifest assetBundleManifest = assetBundle1.assetBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");

//加载名为custom.ab的文件的所有依赖并转为字符串数组

string[] strs = assetBundleManifest.GetAllDependencies("custom.ab");

foreach (string name in strs)

{

//加载出需要用到的AssetBundle文件

AssetBundle.LoadFromFile(Application.dataPath + "/AssetBundle/" + name);

}

//加载Cube

//读取custom.ab文件

string path = Application.dataPath + "/AssetBundle/custom.ab";

//string path4 = Path.Combine(Application.dataPath, "AssetBundle", "custom.ab");//使用Path.Combine拼接路径

AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(path);

//异步等待加载完成

yield return assetBundleCreateRequest;

//加载完成,之后在场景中生成出来

AssetBundle assetBundle = assetBundleCreateRequest.assetBundle;

GameObject CubePre = assetBundle.LoadAsset<GameObject>("Cube1");

Instantiate(CubePre);

}

private IEnumerator LoadCubeWWW()

{

//从服务端获取AssetBundle文件

//获取路径并通过UnityWebRequest获取指定文件

string path1 = Path.Combine("http://192.168.0.102/web/custom.ab");

UnityWebRequest unityWebRequest = UnityWebRequest.Get(path1);

//等待文件获取完成

yield return unityWebRequest.SendWebRequest();

//加载完成

AssetBundle assetBundle = DownloadHandlerAssetBundle.GetContent(unityWebRequest);

GameObject CubePre = assetBundle.LoadAsset<GameObject>("Cube");

Instantiate(CubePre);

}

}

http://www.dtcms.com/wzjs/189004.html

相关文章:

  • 做的网站百度排名没有图片显示长沙seo推广公司
  • 重庆设计网站济宁百度推广公司有几家
  • 网站开发公用头部湖南专业seo推广
  • aspnet动态网站开发技术百度运营平台
  • 做兼职设计去哪个网站怎么自己创建一个网页
  • 广州网站建设解决方案关键词seo排名怎么做的
  • 网站进行规划与设计比百度强大的搜索引擎
  • 万网域名注册网站长沙seo优化排名
  • 珠海澳门网站建设公司免费优化网站
  • 网站正在建设代码网络推广一般都干啥
  • 南宁网站建设公司西安seo服务公司排名
  • 漳浦县网站建设长沙网络推广软件
  • wordpress做导航站竞价推广和seo的区别
  • 电商网站开发设计文档轻松seo优化排名 快排
  • 萍乡做网站的公司百度seo推广方案
  • 静态网站教程qianhu微建站
  • 威县网站建设如何在百度上做推广
  • 网站上线有什么线上活动可以做关键词是什么
  • 宜昌网站建设网盘搜索引擎
  • 网站建设卖给别人可以吗网络服务器图片
  • 上海网站开发培训网站建设与营销经验
  • 送给做网站的锦旗语网站排名分析
  • 公众号网站怎么做的企业网站的主要类型有
  • 辽宁省住建厅建设网站营销方案模板
  • 搬瓦工服务器用来做网站建站平台如何隐藏技术支持
  • 如何配置 网站二级域名短视频营销策划方案
  • 重庆企业的网站建设宁波seo快速优化课程
  • crm软件系统的构成包括seo搜索引擎优化费用
  • 做虾网站该起啥名好网站优化推广平台
  • 西安外贸网站开发如何推广app赚钱