Last active
April 4, 2023 09:43
-
-
Save nicoplv/67978adc270cbe34d142b55c821c838e to your computer and use it in GitHub Desktop.
A fix to curvy spline, to be able to use spline inside prefab without having a curvyglobal in the opened scene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_EDITOR | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using FluffyUnderware.Curvy; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
namespace Utils | |
{ | |
public class CurvyFix | |
{ | |
#region Unity Methods | |
[InitializeOnLoadMethod] | |
protected static void InitializeOnLoadMethod() | |
{ | |
EditorSceneManager.sceneOpened += SceneOpened; | |
EditorSceneManager.newSceneCreated += NewSceneCreated; | |
EditorSceneManager.sceneSaving += SceneSaving; | |
CurvyGlobalManager.HideManager = true; | |
CurvyGlobalManager curvyGlobalManager = CurvyGlobalManager.Instance; | |
} | |
private static void SceneSaving(Scene scene, string path) | |
{ | |
CurvyGlobalManager curvyGlobalManager = CurvyGlobalManager.Instance; | |
curvyGlobalManager.gameObject.hideFlags = HideFlags.HideAndDontSave; | |
} | |
private static void NewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode) | |
{ | |
CurvyGlobalManager.HideManager = true; | |
CurvyGlobalManager curvyGlobalManager = CurvyGlobalManager.Instance; | |
} | |
private static void SceneOpened(Scene scene, OpenSceneMode mode) | |
{ | |
CurvyGlobalManager.HideManager = true; | |
CurvyGlobalManager curvyGlobalManager = CurvyGlobalManager.Instance; | |
} | |
#endregion | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment