Unity动态加载resource(纹理,材质...) & 资源包 & 热更新

1.Unity Resources dynamic Loading

  -创建一个叫"Resources"的文件夹一个字母都不许错,之后就可以调用resource.load()

  -//Resources load(path) path不允许添加file extention

 

 

2. // 跨场景查找获取物体

https://blog.csdn.net/qq_39108767/article/details/85113473

 

3.//相机组件

 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class ExampleScript : MonoBehaviour {
 5     public Camera firstPersonCamera;
 6     public Camera overheadCamera;
 7 
 8     public void ShowOverheadView() {
 9         firstPersonCamera.enabled = false;
10         overheadCamera.enabled = true;
11     }
12     
13     public void ShowFirstPersonView() {
14         firstPersonCamera.enabled = true;
15         overheadCamera.enabled = false;
16     }
17 } 

4.Unity 中obj.ToString() 后每个obj后面都带有(Unity.Engine). 不能用endWith操作.

5. https://www.arena-sayajigunj.com/difference-between-materials-and-textures/  材质与纹理不同的比较

6. https://blog.csdn.net/JianShengShuaiest/article/details/104552948  //获得Scene 场景的相机坐标

 

Asset Bundle

// 绝对路径 

Load from local ---> AssetBundle ab = AssetBundle.LoadFromFile("D:/AssetBundles/ab");  

//获得当前路径

C# https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getcurrentdirectory?view=net-6.0 

https://stackoverflow.com/questions/703281/getting-path-relative-to-the-current-working-directory     

//打包

 

// Editor 专用文件夹 与 Reference文件夹有异曲同工之妙

Directory.CreatDirectory -> BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.None, BuildTarget.[platform])

//Load & Use AssetBundle

AssetBundle ab = AssetBundle.LoadFromFile("[Path]")

ab.LoadAsset<GameObject>("object name") 

// Load From internet

https://blog.csdn.net/u014361280/article/details/112365983

 

posted on 2022-07-25 14:42  ReadyLoveMiku  阅读(814)  评论(0编辑  收藏  举报