private void Start() { if (!player) { player = FirstPersonCamera.player; } zoomIn = GetComponent <PlayableDirector>(); if (!padParent || !player || !zoomIn) // 에러 방지. 뭐라도 하나라도 없으면... { tag = "Untagged"; Destroy(GetComponent <Collider>()); Destroy(GetComponent <QuickOutline>()); Destroy(this, 1f); return; } // 타임라인에 MainCamera 직접 바인딩. Why? > 에디터에서 드래그앤드랍 해도 다른 Scene이라서 로딩시에 missing. UnityEngine.Timeline.TimelineAsset timeline = zoomIn.playableAsset as UnityEngine.Timeline.TimelineAsset; zoomIn.SetGenericBinding(timeline.GetOutputTrack(3), Camera.main.gameObject); timelineDuration = timeline.duration; cam = GameObject.FindWithTag("MainCamera").GetComponent <Camera>(); rigid = GetComponent <Rigidbody>(); beforePoint = Vector3.zero; midPoint = cam.pixelRect.max / 2f; // 화면의 중앙 픽셀 위치. Handle.enabled = false; }
static int GetOutputTrack(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Timeline.TimelineAsset obj = (UnityEngine.Timeline.TimelineAsset)ToLua.CheckObject <UnityEngine.Timeline.TimelineAsset>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Timeline.TrackAsset o = obj.GetOutputTrack(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }