//! //! Use this for initialization //! void Awake() { //cache reference to main Controller mainController = GameObject.Find("MainController").GetComponent <MainController>(); //cache reference to animation timeline timeLineObject = GameObject.Find("GUI/Canvas/UI/TimeLine"); if (timeLineObject == null) { Debug.LogError(string.Format("{0}: Cant Find TimeLine (GUI/Canvas/UI/TimeLine).", this.GetType())); } timeLine = timeLineObject.GetComponent <TimeLineWidget>(); if (timeLine == null) { Debug.LogError(string.Format("{0}: No TimeLine script attached.", this.GetType())); } // assign callback for frame changes on timeline (on user drag) timeLine.Callback = this.setTime; //cache reference to keyframe Sphere container frameSphereContainer = GameObject.Find("FrameSphereContainer"); // cache key prefab keySpherePrefab = Resources.Load <GameObject>("VPET/Prefabs/KeySphere"); if (keySpherePrefab == null) { Debug.LogError(string.Format("{0}: Cant find Resources: KeySphere.", this.GetType())); } //cache reference to dragArea and deactivate it //dragArea = timeline.transform.GetChild(7).gameObject; //dragArea.SetActive(false); //cache Reference to animation data animData = AnimationData.Data; //initalize keyframe list keyframeSpheres = new List <GameObject>(); //initalize animated scene objects list if (animatedObjects == null) { animatedObjects = new List <SceneObject>(); } //initialize animation layers for (int i = 0; i < animationLayers.Length; ++i) { animationLayers[i] = new AnimationLayer(); } //initalize lineRenderer lineRenderer = gameObject.AddComponent <LineRenderer>(); lineRenderer.material = Resources.Load <Material>("VPET/Materials/LineRendererMaterial"); lineRenderer.SetColors(lineColor, lineColor); lineRenderer.SetWidth(0.02f, 0.02f); lineRenderer.useWorldSpace = true; lineRenderer.SetVertexCount(0); }