private void RemoveAllPrefabInstances()
        {
            foreach (GameObject prefab in prefabPainter.splineSettings.prefabInstances)
            {
                PrefabPainter.DestroyImmediate(prefab);
            }

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

            PrefabPainter.DestroyImmediate(previewPrefab.prefabInstance);

            previewPrefab.prefabInstance = null;
            previewPrefab.prefabSettings = null;
            previewPrefab = null;
        }
Esempio n. 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;
        }
        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);
            }
        }