随笔 - 25  文章 - 0  评论 - 0  阅读 - 6312

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   ReadyLoveMiku  阅读(967)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示