08-28-2019, 08:08 AM
(This post was last modified: 08-28-2019, 08:38 AM by UsernameHed.)
Nice, ok. I have a similare little issue with that script:
When I am editing a prefabs, who contain a generator (a generator who doesn't have a spline reference by itself),
I get this error in the console when I am editing the prefabs:
InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed.
It's not a big deal, I have solve that problem by adding that:
And the static function:
When I am editing a prefabs, who contain a generator (a generator who doesn't have a spline reference by itself),
I get this error in the console when I am editing the prefabs:
InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed.
It's not a big deal, I have solve that problem by adding that:
Code:
if (!Application.isPlaying)
{
if (!ComponentPool.IsInPrefabStage())
{
DestroyImmediate(item.gameObject);
}
}
And the static function:
Code:
private static bool IsInPrefabStage()
{
#if UNITY_2018_3_OR_NEWER
var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
return (stage != null);
#else
return false;
#endif
}