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. 微信sdk分享,苹果手机分享到qq好友和qq空间没有反应

    最近线上程序苹果手机进行微信分享时,分享到qq好友和qq空间,无法调用分享程序,从微信跳转到qq后就没有反应了,但是安卓手机分享就没事? 解决:调用微信sdk分享时,分享的url(link)的参数不能 ...

  2. 非空二叉树的一个有趣的性质:n0 = n2 + 1

    对任何非空二叉树T,若n0 表示叶结点的个数.n2 表示度为2 的非叶结点的个数,那么两者满足关系n0 = n2 + 1. 这个性质很有意思,下面我们来证明它. 证明:首先,假设该二叉树有N 个节点, ...

  3. SQL注入POC

    mysql #encoding=utf-8 import httplib import time import string import sys import random import urlli ...

  4. this 的工作原理

    JavaScript 有一套完全不同于其它语言的对 this 的处理机制. 在五种不同的情况下 ,this 指向的各不相同. 全局范围内 this; 当在全部范围内使用 this,它将会指向全局对象. ...

  5. 列间距column-gap

    column-gap主要用来设置列与列之间的间距,其语法规则如下: column-gap: normal || <length> 取值说明 属性值 属性值说明 normal 默认值,默值为 ...

  6. js实现继承的五种方式

    function Parent(firstname) { this.fname=firstname; ; this.sayAge=function() { console.log(this.age); ...

  7. WDR7500 花生壳问题

    新进一WDR7500 居然不能解析花生壳. 百度一番, 发现别人有同样的问题. 找来找去从别人的只言片语中发现需要升级固件. 好不容易加入一个群, 把固件下下来. 升级固件, 重新设置, 解析成功. ...

  8. Linq To Sqlite 一一二二

    说在前头 之所以写下这些文字,主要是因为使用LINQ的同志们都觉它的美好(至于有多美好,各位心里知道,我就不在描述了,如果你是你还不了解LINQ,园子里有大把的文章),微软老哥只提供了自家的SQLSe ...

  9. mysql之各种命令总结

    1:使用SHOW语句找出在服务器上当前存在什么数据库:mysql> SHOW DATABASES;2:2.创建一个数据库MYSQLDATAmysql> CREATE DATABASE MY ...

  10. property attribute: assign, strong, weak, unsafe_unretain and copy

    assign:用于“纯量类型”(如CGFloat 或 NSInteger等): strong:用于“对象类型”,定义了一种“拥有关系”(owning relationship),为这种属性设置新值时, ...