当前位置:网站首页>Different objects use the same material and have different performances
Different objects use the same material and have different performances
2022-06-23 23:48:00 【Sunshine in front of heart】
Knowledge point
Material property block MaterialPropertyBlock
Set material block color attributes MaterialPropertyBlock.SetColor
Copy a material's attribute block Renderer.GetPropertyBlock
Set material attribute blocks Renderer.SetPropertyBlock
Realization
- Through the model Render Get material block ;
- Set the color attribute of the material block ;
- Set up Render Material block for .
using UnityEngine;
public class NotSameDisplay : MonoBehaviour
{
Renderer render;
void Start()
{
render = GetComponent<Renderer>();
ChangeMaterilaColor();
}
void ChangeMaterilaColor()
{
MaterialPropertyBlock newBlock = new MaterialPropertyBlock();
//render The material values of are copied to newBlock in
render.GetPropertyBlock(newBlock);
// Parameter one :shader Corresponding property name in
// Select material Click on the gear in the upper right corner choice Edit Shader stay Properties Block to view
// Parameter two : The value of the property
newBlock.SetColor("_Color",Color.red);
// Copy the new value into the attribute
render.SetPropertyBlock(newBlock);
}
}
边栏推荐
- Idea automatically generates unit tests, doubling efficiency!
- 再来一个高仿开眼的短视频APP
- Solve the problem that slf4j logs are not printed
- AUTOCAD——总结CAD画圆角的三种方式
- 微信小程序 图片验证码展示
- How to ensure reliable power supply of Expressway
- Kotlin set list, set, map operation summary
- What is the same origin policy?
- 接私活必备的 6 个开源项目
- Several guesses about the design of Tencent conference number
猜你喜欢

解决Slf4j日志不打印问题

Acrel-3000WEB电能管理系统在都巴高速的应用

STM32-------外部中断

Multi store drug inventory system source code large chain drugstore management system source code

Sorry, your USB cable may be wrong!

smart-doc + Torna 兼容版本

Autofac details

CVPR2019/图像翻译:TransGaGa: Geometry-Aware Unsupervised Image-to-Image Translation几何感知的无监督图像到图像的翻译

7、STM32——LCD

多门店药品进销存系统源码 大型连锁药店管理系统源码
随机推荐
2022 point de connaissance de l'examen des ingénieurs en sécurité de l'information: contrôle d'accès
入参参数为Object,但传递过去却成了[object object] 是因为需要转为JSON格式
Some explanations of Tim timer of embedded interface and STM32 template library function of NVIC
3D打印和激光切割流程的初步了解
1004. 最大连续1的个数 III ●●
完整开源项目之诗词吧 APP
2022 Shandong Health Expo, Jinan International Health Industry Expo, China Nutrition and Health Exhibition
IDEA 自动生成单元测试,效率倍增!
1004. number of maximum consecutive 1 III ●●
数字物业管理成趋势,传统物业公司如何通过转型实现数字化蝶变?
不同物体使用同一材质,有不同的表现
Loop caused by add of sublist in list
How to ensure reliable power supply of Expressway
One person even broke up a Netease cloud music Cloud Village
7、STM32——LCD
Multi store drug inventory system source code large chain drugstore management system source code
ORB_ Slam3 environment setup and demo demonstration
这个高仿小米商城项目太惊艳了
Acrel-3000WEB电能管理系统在都巴高速的应用
STM32-------定时器