轨迹插件引入

This commit is contained in:
lishuo committed 2022-09-06 13:47:45 +08:00
1 parent 89b5275efd
commit 195893a1b0
1023 files changed
+378944 -18404

No files matched your search

@@ -0,0 +1,58 @@
// =====================================================================
// Copyright 2013-2017 Fluffy Underware
// All rights reserved
//
// http://www.fluffyunderware.com
// =====================================================================
using UnityEngine;
using System.Collections;
namespace FluffyUnderware.DevTools
{
/// <summary>
/// Add this script to a GameObject with a MeshFilter to ensure it will be properly duplicated in the editor!
/// </summary>
/// <remarks>On Duplicating, Awake() checks if the sharedMesh is already used in the scene. If yes, a new mesh will be created to ensure that each sharedMesh is unique</remarks>
[ExecuteAlways]
[RequireComponent(typeof(MeshFilter))]
public abstract class DuplicateEditorMesh : DTVersionedMonoBehaviour
{
MeshFilter mFilter;
public MeshFilter Filter
{
get {
if (mFilter == null)
mFilter = GetComponent<MeshFilter>();
return mFilter;
}
}
protected virtual void Awake()
{
if (!Application.isPlaying)
{
MeshFilter meshFilter = Filter;
if (meshFilter && meshFilter.sharedMesh != null)
{
DuplicateEditorMesh[] otherWatchdogs = GameObject.FindObjectsOfType<DuplicateEditorMesh>();
foreach (DuplicateEditorMesh dog in otherWatchdogs)
{
if (dog != this)
{
MeshFilter otherMF = dog.Filter;
if (otherMF && otherMF.sharedMesh == meshFilter.sharedMesh)
{
Mesh m = new Mesh();
m.name = otherMF.sharedMesh.name;
meshFilter.mesh = m;
}
}
}
}
}
}
}
}