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. SQL练习题

    create table Student( Sno varchar(20) primary key, Sname varchar(20) not null, Ssex varchar(20) not ...

  2. LaTeX插入图片方法 Inserting Images

    Inserting Images Images are essential elements in most of the scientific documents. LATEX provides s ...

  3. sdutoj 2623 The number of steps

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2623 The number of steps ...

  4. VS 解决方案管理器和 编辑窗口同步 联动

    对于题目的解释就是   当我点击一下解决方案管理器中的 某一个文档时, 编辑窗口会联动的   同步到对应的窗口。之前好像被我无意中关掉了,今天重新建立一个项目无意中发现怎么设置了 如果想点击右边的文档 ...

  5. 【003:ubuntu 基本开发环境设置】

    1.基础开发环境 sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install Oracl ...

  6. POJ - 1107 W's Cipher

    POJ - 1107 W's Cipher Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u De ...

  7. HtmlHelper的扩展

    HtmlHelper的扩展: 注意点:扩展方法必须是静态方法,所在的类必须是静态类,所在的命名空间改成System.Web.MVC则能省略页面中必须添加命名空间的约束. //主要就是输出分页的超级链接 ...

  8. 混合使用 ForkJoin, Akka, Future 实现一千万个不重复整数的排序

    定位  本文适合于想要了解新语言 Scala 以及异步并发编程框架 Akka, Future 的筒鞋. 读完本文后,将了解如何使用 ForkJoin 框架.如何使用 Akka 构建并发程序.如何使用 ...

  9. MAC: Homebrew(代替yum)安装

    安装    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"    最新方式请 ...

  10. CI框架区分前后台

    基于官网 CodeIgniter-3.1.2版本修改 1.复制根目录下的 index.php 文件,重名为  admin.php .index.php用作前台入口:admin.php用作后台入口. 打 ...