unity自定义工具
2017-01-03 21:51
190 查看
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System.Collections.Generic;
public class SetTools
{
[MenuItem("Custom/SetMaterrial")]
public static void SetMaterrial()
{
foreach (GameObject volumeGo in Selection.gameObjects)
{
string volumeName = volumeGo.name;
foreach (Transform t in volumeGo.transform)
{
t.gameObject.SetActive(false);
string timeName = t.name;
char[] c = timeName.ToCharArray();
foreach (Transform t2 in t)
{
t2.gameObject.AddComponent<MeshCollider>();
string path = "Assets/water/" + volumeName + "/Animation000" + c[1] + ".jpg";
Texture texture = AssetDatabase.LoadAssetAtPath(path, typeof(Texture)) as Texture;
t2.GetComponent<MeshRenderer>().sharedMaterial.mainTexture = texture;
}
}
}
using UnityEditor;
using System.Collections;
using System.IO;
using System.Collections.Generic;
public class SetTools
{
[MenuItem("Custom/SetMaterrial")]
public static void SetMaterrial()
{
foreach (GameObject volumeGo in Selection.gameObjects)
{
string volumeName = volumeGo.name;
foreach (Transform t in volumeGo.transform)
{
t.gameObject.SetActive(false);
string timeName = t.name;
char[] c = timeName.ToCharArray();
foreach (Transform t2 in t)
{
t2.gameObject.AddComponent<MeshCollider>();
string path = "Assets/water/" + volumeName + "/Animation000" + c[1] + ".jpg";
Texture texture = AssetDatabase.LoadAssetAtPath(path, typeof(Texture)) as Texture;
t2.GetComponent<MeshRenderer>().sharedMaterial.mainTexture = texture;
}
}
}
相关文章推荐
- Unity自定义UI组件(七)渐变工具、渐变色图片、渐变遮罩
- Unity自定义UI组件(七)渐变工具、渐变色图片、渐变遮罩
- Unity自定义窗体插件工具
- Unity自定义UI组件(七)渐变工具、渐变色图片、渐变遮罩
- Vuroria增强现实平台,Unity工具开发——ImageTargetPackage 在识别不同图像的同时,自定义功能
- ArcGIS Server 开发初步 -- 自定义工具
- ArcGIS Server 开发系列(五)--自定义 Toolbar 工具 (转载于Flyingis)
- (十) 创建自定义工具
- ArcGIS Server 开发系列(五)--自定义 Toolbar 工具 (转载于Flyingis)
- web下自定义看全图工具(不与地图交互)
- ABAP--如何建立通过sap表维护工具来维护自定义表TCODE
- ArcGIS Server 开发系列(五)--自定义 Toolbar 工具2 (转载于Flyingis)
- Asp.Net 网站管理工具-使用自定义的配置源
- ABAP--如何建立通过sap表维护工具来维护自定义表TCODE
- ABAP--如何建立通过sap表维护工具来维护自定义表TCODE
- 自定义表单的设计工具及运行期实现
- ABAP--如何建立通过sap表维护工具来维护自定义表TCODE
- 【已测试通过】::自定义工具按钮进行矩选查询,高亮显示所选择的地图要素
- 自定义 WebSphere Studio 以将 Struts 脚本工具与 Jython 中的 ActionClass 一起使用
- 制作MapX自定义工具--测距工具