summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XEditor/XCharacterMaterial.cs
blob: 4e43dda22b533df577150f28c26c23823af1d5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using XEditor;
using XUtliPoolLib;
using System.Collections.Generic;

public enum EEquipType
{
    Archer,
    Cleric,
    Sorcer,
    Warrior,
    Academic,
    Spirit,
    Tail,
    Wing,
    Char,
    SelectChar,
    Creator
}
public class XCharacterMaterial : MonoBehaviour 
{
    //private string characterType = "Archer";
    public Material mat = null;
    private SkinnedMeshRenderer skin = null;
    public void OnAttached()
    {
        skin = gameObject.GetComponentInChildren<SkinnedMeshRenderer>();

    }

    void Update()
    {
        if(mat!=null&&mat!= skin.sharedMaterial)
        {

            mat.CopyPropertiesFromMaterial(skin.sharedMaterial);
            skin.sharedMaterial = mat;

        }
    }

}
#endif