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