void OnEnable()
 {
     if (!Application.isPlaying)
     {
         SoxLtnRecycle soxLthRecycle = (SoxLtnRecycle)target;
         GameObject.DestroyImmediate(soxLthRecycle.gameObject);
     }
 }
Exemplo n.º 2
0
    private void CreateRecycle()
    {
        if (soxLtnRecycle != null)
            return;

        GameObject recycle = new GameObject(transform.name + "_recycle");
        soxLtnRecycle = recycle.AddComponent<SoxLtnRecycle>();
        soxLtnRecycle.soxLtn = this;
        soxLtnRecycle.onEffects = new List<GameObject>();
        soxLtnRecycle.offEffects = new List<GameObject>();
        soxLtnRecycle.autoTerminateType = autoTerminateType;
        soxLtnRecycle.gameObject.hideFlags = HideFlags.HideInHierarchy; // 원래 HideAndDontSave를 하려고 했으나 HideAndDontSave에서는 Play 종료시 Destroy 관련 알 수 없는 에러가 발생하여 단순히 Hide만 함

#if (UNITY_EDITOR && UNITY_2018_3_OR_NEWER) // 프리팹스테이지는 2018.3 이후에 적용된 기능
        if (prefabStage)
        {
            SceneManager.MoveGameObjectToScene(soxLtnRecycle.gameObject, previewScene);
        }
#endif
    }