Esempio n. 1
0
    private void Awake()
    {
        tr = transform;

        if (GetComponentInChildren <MeshRenderer>() != null)
        {
            meshRend = GetComponentInChildren <MeshRenderer>();
        }
        else if (GetComponentInChildren <SkinnedMeshRenderer>() != null)
        {
            meshRend = GetComponentInChildren <SkinnedMeshRenderer>();
        }

        if (GetComponentInChildren <NavMeshObstacle>() != null)
        {
            hasNavObstacle = true;
            navObstacle    = GetComponentInChildren <NavMeshObstacle>();
        }

        if (GetComponentInChildren <SwapMaterial>() != null)
        {
            hasSwapMaterial = true;
            swapMaterial    = GetComponentInChildren <SwapMaterial>();
        }
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        SwapMaterial swapMaterial = (SwapMaterial)target;

        if (GUILayout.Button("Swap for : " + swapMaterial.matSelected.ToString()))
        {
            swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
        }
    }