【Unity 编辑器扩展】Multi-object editing not supported报错解决

错误信息

解决方法

 

在你的Editor类声明前添加属性 [CanEditMultipleObjects]

没有该属性的编辑器在选中多个物体时,就会提示“Multi-object editing not supported”,出现其他绘制均不显示的错误情况。

注:CustomEditor的脚本文件必须放置在工程中Assets/Editor文件夹中,脚本头文件引用处必须添加using UnityEditor;

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(TestLightmapsHolder))]
[CanEditMultipleObjects]//add this
public class TestLightmapsHolderEditor : Editor
{
    public override void OnInspectorGUI()
    {
        TestLightmapsHolder holder = target as TestLightmapsHolder;
        base.OnInspectorGUI();
        if (GUILayout.Button("保存光照贴图"))
            holder.SaveLightmaps();
    }
}

 

你可能感兴趣的:(Unity,Unity,编辑器扩展,Editor,Error)