예제 #1
0
        private void RemoveAllPrefabInstances()
        {
            foreach (GameObject prefab in prefabPainter.splineSettings.prefabInstances)
            {
                PrefabPainter.DestroyImmediate(prefab);
            }

            prefabPainter.splineSettings.prefabInstances.Clear();
        }
예제 #2
0
        public void DestroyPreviewPrefab()
        {
            if (previewPrefab == null)
            {
                return;
            }

            PrefabPainter.DestroyImmediate(previewPrefab.prefabInstance);

            previewPrefab.prefabInstance = null;
            previewPrefab.prefabSettings = null;
            previewPrefab = null;
        }
예제 #3
0
        private void ClearSpline(bool removePrefabInstances)
        {
            editorTarget.splineSettings.controlPoints.Clear();

            if (removePrefabInstances)
            {
                foreach (GameObject go in editorTarget.splineSettings.prefabInstances)
                {
                    PrefabPainter.DestroyImmediate(go);
                }
            }

            editorTarget.splineSettings.prefabInstances.Clear();

            editorTarget.splineSettings.controlPoints.Clear();

            editorTarget.splineSettings.dirty = true;
        }
예제 #4
0
        private void RemovePrefabInstances(int startIndex)
        {
            // startIndex might be -1 if there are no prefabs; prefabInstanceIndex would be -1
            // also needed if you delete control points and only 1 is left
            if (startIndex < 0)
            {
                RemoveAllPrefabInstances();
                return;
            }

            // clear existing prefabs
            for (int i = prefabPainter.splineSettings.prefabInstances.Count - 1; i >= startIndex; i--)
            {
                GameObject prefab = prefabPainter.splineSettings.prefabInstances[i];

                PrefabPainter.DestroyImmediate(prefab);

                prefabPainter.splineSettings.prefabInstances.RemoveAt(i);
            }
        }