zoukankan      html  css  js  c++  java
  • unity自定义工具

    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;
    }
    }
    }

  • 相关阅读:
    拼图
    事件处理和手势
    分栏控制器2
    分栏控制器
    数据保存
    常用小控件
    导航
    人人界面按钮,页面跳转,传值
    TextField
    image
  • 原文地址:https://www.cnblogs.com/943711466qq/p/6246598.html
Copyright © 2011-2022 走看看