コード例 #1
0
    // 把renderer上面的lightmap信息保存起来,以便存储到prefab上面
    public static void SaveLightmapInfo()
    {
        GameObject go = Selection.activeGameObject;

        if (go == null)
        {
            EditorUtility.DisplayDialog("Alert", "Please select a gameObject!", "Okey");
            return;
        }

        CLPrefabLightmapData data = go.GetComponent <CLPrefabLightmapData>();

        if (data == null)
        {
            data = go.AddComponent <CLPrefabLightmapData>();
        }

        data.SaveLightmap();
        EditorUtility.SetDirty(go);
    }
コード例 #2
0
    public static void ClearLightmapInfo()
    {
        GameObject go = Selection.activeGameObject;

        if (go == null)
        {
            EditorUtility.DisplayDialog("Alert", "Please select a gameObject!", "Okey");
            return;
        }

        CLPrefabLightmapData data = go.GetComponent <CLPrefabLightmapData>();

        if (data == null)
        {
            EditorUtility.DisplayDialog("Alert", "Can't find [CLPrefabLightmapData] component!", "Okey");
            return;
        }

        data.m_RendererInfo.Clear();
        data.m_Lightmaps = null;
        EditorUtility.SetDirty(go);
    }