Creating Materials at runtime
http://forum.unity3d.com/threads/create-materials-at-runtime.72952/

//通过Shader.Find()创建材质
floor.renderer.material = new Material (Shader.Find(" Diffuse"));
//设置材质参数
floor.renderer.material.SetTextureScale("Tiling", new Vector2(,));
floor.renderer.material.mainTexture = Resources.Load("Floor") as Texture2D;

Shader.Find()
http://docs.unity3d.com/ScriptReference/Shader.Find.html

Shader.Find()

需要注意的问题是,如果Shader是自己写的,则必须放置在Resources下面,否则在Android/iOS环境下,则会出现找不到Shader的问题。

When building a player, a shader will only be included if it is assigned to a material that is used in any scene or if the shader is placed in a "Resources" folder.

We should put the custom shaders into the 'Resources/Shaders/' folder, otherwise, when we built an android apk, shit happens.

Creating Materials at runtime And Issue of Shader.Find()的更多相关文章

  1. creating normals from alpha/heightmap inside a shader

    http://www.polycount.com/forum/showthread.php?t=117185 I am making some custom terrain shaders with ...

  2. Libgdx New 3D API 教程之 -- Libgdx中使用Materials

    This blog is a chinese version of xoppa's Libgdx new 3D api tutorial. For English version, please re ...

  3. 关于Unity中顶点片元Shader实例

    补充 float4 fixed4 _Time 1: float4是内置向量 (x, y, z, w); float4 a; 访问单独成员a.x, a.y, a.z, a.w;2: fixed4 是内置 ...

  4. AssetBundleMaster_ReadMe_EN

    Before we start use it, you'd better import it to an empty project, following the ReadMe to learn th ...

  5. Deploying JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite Release 12 (文档 ID 393931.1)

    In This Document Section 1: Overview Section 2: Pre-Upgrade Steps Section 3: Upgrade and Configurati ...

  6. selenium2自动化测试学习笔记(二)

    chromedriver报错问题解决了,真是无语 是因为chromedriver与浏览器版本不一致 http://chromedriver.storage.googleapis.com/index.h ...

  7. chromedriver与chrome最新版本对应表

    如果需要看到最新版的chromedriver和chrome版本对应问题,点击http://npm.taobao.org/mirrors/chromedriver/,点击最新版本的chromedrive ...

  8. centos 无界面安装selenium+chrome+chromedirver的设置

    配了一中午的,好不容易正好记录下. 1.我的centos的位数 输入rpm -q centos-release 结果:centos-release-7-4.1708.el7.centos.x86_64 ...

  9. 使用CEF(二)— 基于VS2019编写一个简单CEF样例

    使用CEF(二)- 基于VS2019编写一个简单CEF样例 在这一节中,本人将会在Windows下使用VS2019创建一个空白的C++Windows Desktop Application项目,逐步进 ...

随机推荐

  1. Python开发【第二章】:Python深浅拷贝剖析

    Python深浅拷贝剖析 Python中,对象的赋值,拷贝(深/浅拷贝)之间是有差异的,如果使用的时候不注意,就可能产生意外的结果. 下面本文就通过简单的例子介绍一下这些概念之间的差别. 一.对象赋值 ...

  2. grabcut

    http://blog.csdn.net/zouxy09/article/details/8535087

  3. paramiko模块,线程,进程

    关于paramiko模块 paramiko是基于Python实现的ssh2远程安全连接,支持认证及密钥方式远程执行命令.文件传输,中间ssh代理等 paramiko的安装: 安装好之后,用parami ...

  4. LUA实现单词替换功能

    背景描述 编程或者文档处理过程, 经常遇到需要将一个单词修改为另外一个单词的情况, 例如 命名为 shall 修改 为 should. 使用工具实现, 则比较方便,不容易出错, 解放双手. 需求规格 ...

  5. 写在开始编写Java之前(1)——Java的跨平台性

    Java语言之所以比C语言更加实用 是有原因的 Java的一个重要的特点——跨平台性 无论是哪个平台,如Windows.Linus还是Mac系统 Java的语法都是一样的 这个要比C语言用处要广 因为 ...

  6. Control Flow

    1.重写折半查找,使得在循环内部只执行一次测试 传统的非递归式的折半查找的例子中,while循环语句内部共执行了两次测试,其实只要一次就足够(代价是将更多的测试在循环外执行).重写该函数,使得在循环内 ...

  7. 自动化环境robot framework安装中问题解决

    在搭建自动化环境的时候需要安装以下程序:

  8. mongodb版本特性

    2.x index,writeConcern, readPreference 3.0 wiredtiger,  pluggable staorage engine, improved mmapv1 3 ...

  9. storyboard

    一,代码动态改写 1,一般程序启动就自动执行 main.storyboard 也可以在AppDelegate改写 - (BOOL)application:(UIApplication *)applic ...

  10. RobotFrameWork http/https oauth接口测试 (一)

    感觉自己最近销声匿迹快一个月了,应该总结下自己这个月学习的东西了~~~折腾完公司私有协议的接口测试(c++接口),开始折腾公司的http/https接口和webservice接口的测试,想着把所有的这 ...