Rocky Lai 的技术博客

学习、思考、分享


  • 首页

  • 归档

  • 分类

  • 标签

  • 关于

关于 Untiy 一些需要知道的技巧

发表于 2016-02-16   |   分类于 UnityKB

Unity Tips

  • List<T> 或者数组序列化的时候默认生成的名字为 Element n,如果要改变这个,只需要把 T
    的第一个序列化的字段的数据类型设置为 string
  • 保存 Play 模式下调试出的数据:在组件的右上角点击右键,选择 Copy Component,然后关闭 Play
    模式之在对应的组件右上角点击右键,选择 Copy Component as Values。 更多小技巧请看 这个链接。
阅读全文 »

Hello 2016

发表于 2015-12-31   |   分类于 一点一滴

Hello 2016~~~

Bye 2015

ShaderlabVS 的一些常见问题

发表于 2015-12-27   |   分类于 Shader

谢谢朋友们这一年多来对 ShaderlabVS 插件的支持。这里整理出一些朋友给我的留言或者邮件中提到的常见问题,希望对大家有帮助。

常见问题

黑色背景下文字看不清楚,如何改变字体颜色

  1. 打开 VS -> 工具 -> 选项 -> 环境 -> 字体和颜色,
  2. 显示其设置 下拉列表中选择 文本编辑器 (如果没改过,这就是默认的)。
  3. 在 显示项(D) 文字下面的列表框中选择以 “Shaderlab-” 开头的项,然后改变前景色
  4. 改完后确定就可以了

插件安装碰到错误: `扩展“ShaderlabVS”需要的 .NET Framework 版本没有安装。

尝试安装已移除 .Net Framework 依赖版本的 0.6.1 或以上版本。

下载地址:http://blog.shuiguzi.com/2014/10/28/Release/

阅读全文 »

Unity 5:使用 Asset Bundle 和 Asset Bundle Manager (3)

发表于 2015-11-12   |   分类于 UnityKB

这篇是 Unity 官方教程 AssetBundles and the AssetBundle Manager 的翻译, 分三部分,这是第三部分。翻译不到之处请不吝指出。非常谢谢!

译者注:英文太啰嗦了,但是还是坚持的把它翻译完了。因为啰嗦的好处是起码能让概念多复习几遍,更容易记得住。如果读者觉得啰嗦,可以自行执行 跳读技能 来阅读译文。

本文的项目连接:http://u3d.as/jyk



###EXAMPLE 1: LOADING ASSETS

Enable Simulation Mode using the menu item “Assets/AssetBundles/Simulation Mode”. Open the scene “AssetBundleSample/Scenes/AssetLoader”.
Note that the scene is essentially empty and only contains a Main Camera, Directional
Light and “Loader” GameObject.
Enter Playmode.
* Note that a cube has been loaded into the scene from an AssetBundle.

This scene is driven by the script “LoadAssets.cs”.

示例 1:加载资源

  • 使用 “Asset/AssetBundles/Simulation Mode” 菜单打开模拟模式
  • 打开 “AssetBundleSample/Scenes/AssetLoader” 场景
  • 注意场景是个空的只有一个主摄像机,方向光和游戏对象 “Loader”
  • 进入 PlayMode
  • 然后会注意到一个 cube 已经从 AssetBundle 加载到场景里面了

这个场景是被 “LoadAssts.cs” 脚本驱动的。


Open “AssetBundleSample/Scripts/LoadAssets.cs” in a script editor.

在脚本编辑器里面打开脚本 “AssetBundleSample/Scripts/LoadAssets.cs”


There are two public variables: public string assetBundleName; and public string assetName;

脚本里有两个公共变量: public string assetBundleName; 和 public string assetName;


public string assetBundleName; holds the name of the AssetBundle to be loaded. public string assetName; holds the name of the Asset to be loaded from the loaded AssetBundle.
  • public string assetBundleName; 保存了要被加载的 AssetBundle 的名字
  • public string assetName; 保存了要已加载的 AssetBundle 中加载的资源的名字

The script comprises of a Start() function and two Coroutines, called from Start(). In Initialize(), DontDestroyOnLoad() is called, the path to the AssetBundles is set and the AssetBundle Manifest is initialized. In InstantiateGameObjectAsync() the Asset and AssetBundle name are requested using AssetBundleManager.LoadAssetAsync() and if the Asset requested is not null, it is instantiated.
阅读全文 »

Unity 5:使用 Asset Bundle 和 Asset Bundle Manager (2)

发表于 2015-11-11   |   分类于 UnityKB

这篇是 Unity 官方教程 AssetBundles and the AssetBundle Manager 的翻译, 分三部分,这是第二部分。翻译不到之处请不吝指出。非常谢谢!



##WORKING WITH ASSETBUNDLES AND THE ASSETBUNDLE MANAGER
###INTRODUCTION

介绍


One of the key areas of effort in working with AssetBundles is the building and testing of bundles. Often, during development, the Assets themselves are changing regularly. Normally this would require regularly building AssetBundles, uploading them to a host and testing these remotely hosted AssetBundles through a network connection with the working project.

使用 AssetBundle 中一个关键的地方是编译和测试 bundles。一般情况下,资源在开发过程中是会变的。正常地,可能需要要求有规律的编译 AssetBundle, 上传到服务器和然后通过网络连接在当前项目中测试远程的 AssetBundle.


This section focuses on using the AssetBundle Manager when working with AssetBundles. The AssetBundle Manager provides a High-level API for a massively improved workflow compared to manipulating AssetBundles directly with the foundation Low-level API.

这节主要关注 AssetBundle Manager 使用 AssetBundle。相对利用基础的低层 API 来操作 AssetBundle, AssetBundle Manager 为太幅改进的流程提供了高层的 API。


###WORKING WITH ASSETBUNDLES

The steps of working with AssetBundles in the editor fall roughly into these steps: - Organizing & Setting-up AssetBundles in the editor. - Building AssetBundles. - Uploading AssetBundles to external storage. - Downloading AssetBundles at run-time. - Loading objects from AssetBundles.

使用 AssetBundle

在编辑器中使用 AssetBundle 的大体步骤:- 在编辑器中组织 & 设置 AssetBundle。 - 编译 AssetBundle。 - 上传 AssetBundle 到外部存储 - 运行期下载 AssetBundle - 从 AssetBundle 加载对象。


It is worth noting that some AssetBundles can be stored locally for immediate loading as a default setup. This is useful to protect against an install where the application cannot reach remote external storage to download desired AssetBundles. For example, the application would load default language and localization data from a local AssetBundle when the application has no access to downloadable content.

值得注意的一点,有些 AssetBundle 可以存储在本地作为即时加载的默认设置。这样对不能访问远程存储下载期望的资源的安装特别有用。比如,当不能访问可下载内容的时候,程序可以从本地的 AssetBundle 中加载默认的语言和本地化数据。


It is also worth noting that an AssetBundle contains platform ready Assets. The contents of an AssetBundle have been compiled and optimized for the current target platform according to the Import Settings and the Target Platform set in the Build Settings. Because of this, AssetBundles should be built for each target platform.

值得注意的是一个 AssetBundle 包括平台准备资源。AssetBundle 的内容会根据 Import Settings 里设置的当前平台和 Build Settings 里面的目标平台做编译和优化。因为这样,需要为每个平台编译 AssetBundle。


In the following simple scene, one legitimate way of organizing the scene into AssetBundles for the greatest versatility would be to have a base scene, which would include the ground, dunes, rock columns, tree and cactus. This scene could be allowed to include the dependent Materials, as these are fairly simple and would not likely need to be changed depending upon resolution or device. The tank model would be in an AssetBundle of it’s own, which would allow changes or updates to the player Asset. Two additional AssetBundles would be used to complete the tank GameObject. These would be the dependent Materials in one, and the dependent Texture in another. This would allow for changes and updates to the texture and material as needed with the least amount of trouble. This particular organization will also allow for alternative versions, or variants, of these Assets to be loaded from a choice of AssetBundle Variants on demand depending upon need, such as platform, location or resolution of the target device.

在接下来的简单的场景中, 为了AssetBundle 最大的用途,有个合理的组织 AssetBundle 场景内容的方式就是把草地,沙丘,岩石柱,树和仙人掌都打包到一个基础场景里面。这个基础场景可能包含依赖的材质,因为他们很简单,以后不太可能会基于分辨率或者设备而改变。坦克模型将需要一个自己的 AssetBundle, 这样允许改变或者更新玩家资源。为了实现坦克游戏对象,还需要两个额外的 AssetBundle. 一个是独立的材质资源,另外是独立的纹理资源。这将会给需要给纹理和材质的更改和更新时带来最小的麻烦。这个特别的组织方式也允许有其他版本或者基于平台、位置或者目标设备分辨率选择 AssetBundle 的变体。

阅读全文 »

Unity 5: Asset Bundle 和 Asset Bundle Manager (1)

发表于 2015-11-10   |   分类于 UnityKB

这篇是 Unity 官方教程 AssetBundles and the AssetBundle Manager 的翻译, 分三部分,这是第一部分。翻译不到之处请不吝指出。非常谢谢!



#~###INTRODUCTION

AssetBundles allow on demand streaming and loading of Assets from a local or remote location. With AssetBundles, Assets can be stored remotely and accessed as needed, increasing the flexibility of the project and reducing the initial application size.

介绍

AssetBundle 允许按需地从本地或者远程服务器上加载资源(Asset)。通过 AssetBundle 的方式,资源可以远程存储,有需要的时候访问,这样提升了项目的灵活性和降低初始程序的大小。


This lesson will introduce AssetBundles and discuss how to work with them, the steps and stages of the AssetBundle workflow, how to assign Assets to an AssetBundle, how and when to use AssetBundle Variants, how to build and test AssetBundles and Variants - all in the context of using the AssetBundle Manager to simplify creating, testing and deploying AssetBundles. The final section of the lesson will cover specific examples of loading and using AssetBundles and AssetBundle Variants with simple use-cases and simple example scripts.

这篇教程将会介绍 AssetBundle 和及其应用,AssetBundle 流程的步骤和各阶段和怎么样编译和测试 AssetBundle 及其变体 - 所有的一切可以用 AssetBundle Manager 来简化创建,测试和部署 AssetBundle。教程的最后一部分将使用一些加载和使用 AssetBundle 变体的简单用例和脚本示例。


###SAMPLE PROJECT

演示项目


Before starting this Tutorial Article, it would be best to download the AssetBundle Manager with the AssetBundle Sample project here.

在开始教程之前,最后先下载好 AssetBundle 和 AssetBundle Manager 的示例程序。


###WHAT IS AN ASSETBUNDLE?

AssetBundles are files created in the Unity editor during edit-time, which can be used later by a build of a project at run-time. AssetBundles can contain asset files such as models, materials, textures and scenes. AssetBundles cannot contain scripts.

什么是 AssetBundle

AssetBundle 是由 Unity 编辑器在编辑时期创建的,可以被编译出来的程序在运行期使用的文件。AssetBundle 可以包含模型,材质,纹理和场景文件等资源。但是 AssetBundle 不能包含脚本。


Specifically, an AssetBundle is a collection of assets and/or scenes from a project saved in a compact file with the purpose of being loaded separately to the built executable application. AssetBundles can be loaded on demand by a game or application built in Unity. This allows streaming and asynchronous loading of content such as models, textures, audio clips, or even entire scenes. AssetBundles can be “pre-cached” and stored locally for immediate loading when first running an application. The primary purpose of AssetBundles, however, is to stream content on demand from a remote location, to be loaded into the application as necessary. AssetBundles can contain any kind of asset type recognized by Unity, including custom binary data. The only exception is that script assets are not allowed.

明确一点说,一个 AssetBundle 就是存储项目资源和 / 或场景集合的文件,目的是为了之后在游戏或者程序中加载。
AssetBundle 可以被在 Unity 中编译出来的游戏或者程序按需加载。它允许传送和异步加载像模型,材质,声音剪辑,
甚至是整个场景。当在程序中初次运行时, AssetBundle 会被存储到本地 “预缓存” 以备以后被立即加载。Assetbundle 的主要目是为了需要的时候能从远程传送内容并加载进程序。AssetBundle 可以包含可以被 Unity 识别的任何资源类型,包括二进制文件。唯一的另外就是不允许是脚本资源。


There are many use-cases for AssetBundles. New content can be dynamically loaded and unloaded from an application. Post-release DLC can easily be implemented. An application’s disk footprint or size can be reduced when first deployed, with assets being loaded after installation of the application and only as the assets are needed. Platform and device specific assets can be loaded without having to download or store redundant assets for other platforms or resolutions. Localization of applications becomes easy by downloading and installing only the assets needed based on the user’s location, language or preferences. Applications can be fixed, changed or updated with new content without having to resubmit the application for approval.

AssetsBundle 有很多用处。比如新的内容可以动态地在程序中加载和释放。可以很简单实现发布后的可下载内容(DLC, Downloadable Content)。
程序第一次安装的的时候的大小或者磁盘占用空间会减少,资源只有安装的程序需要的时候才会被加载。平台或者设备相关的资源加载时可以不必要下载或冗余存储其他平台和方案中的资源。本地化的程序可以更容易来下载和安装基于用户位置,语言和偏好的资源。新的内容可以下修复,改变或更新,而不需要重新发布程序。


The detailed organization of any project’s assets into AssetBundles will be heavily dependent upon the needs of that particular project. There are, however, some basic tenets to understand about AssetBundles.

AssetBundle 内项目资源的组织严重依赖于项目的需求。但是,也有一些可以更好的理解 AssetBundle 的原则。

阅读全文 »
1234…8
Rocky Lai

Rocky Lai

48 日志
4 分类
14 标签
GitHub 邮件
© 2014 - 2017 Rocky Lai
由 Hexo 强力驱动
主题 - NexT.Mist