Exemplo n.º 1
0
    private void OnGUI()
    {
        mMat       = EditorGUILayout.ObjectField("Material", mMat, typeof(Material), false) as Material;
        mTargetMat = EditorGUILayout.ObjectField("Target", mTargetMat, typeof(Material), false) as Material;

        if (GUILayout.Button("Change"))
        {
            foreach (var s in Selection.gameObjects)
            {
                EditorUtility.ChangeMaterial(s, mMat, mTargetMat);
            }
        }
    }
Exemplo n.º 2
0
    void ChangeMaterial()
    {
        mLightMaterialDown.SetColor("_EmissionColor", mLightColorDown * mLightColorPowerDown);
        mLightMaterialUp.SetColor("_EmissionColor", mLightColorUp * mLightColorPowerUp);

        if (mDirection == CDirection.cUp)
        {
            EditorUtility.ChangeMaterial(mFloorModel, mLightMaterialUp, mLightMaterialDown);
        }
        else
        {
            EditorUtility.ChangeMaterial(mFloorModel, mLightMaterialDown, mLightMaterialUp);
        }

        UnityEditor.EditorUtility.SetDirty(mLightMaterialDown);
        UnityEditor.EditorUtility.SetDirty(mLightMaterialUp);
    }