蓝色星空 1 year ago
commit
221f4adfc1
100 changed files with 4269 additions and 0 deletions
  1. 6 0
      .vsconfig
  2. 26 0
      Assembly-CSharp-Editor-firstpass.csproj
  3. 26 0
      Assembly-CSharp-Editor.csproj
  4. 26 0
      Assembly-CSharp-firstpass.csproj
  5. 26 0
      Assembly-CSharp.csproj
  6. 8 0
      Assets/ColorPicker.meta
  7. 8 0
      Assets/ColorPicker/Scripts.meta
  8. 14 0
      Assets/ColorPicker/Scripts/ColorHuePicker.cs
  9. 11 0
      Assets/ColorPicker/Scripts/ColorHuePicker.cs.meta
  10. 29 0
      Assets/ColorPicker/Scripts/ColorIndicator.cs
  11. 11 0
      Assets/ColorPicker/Scripts/ColorIndicator.cs.meta
  12. 21 0
      Assets/ColorPicker/Scripts/ColorSaturationBrightnessPicker.cs
  13. 11 0
      Assets/ColorPicker/Scripts/ColorSaturationBrightnessPicker.cs.meta
  14. 39 0
      Assets/ColorPicker/Scripts/Draggable.cs
  15. 11 0
      Assets/ColorPicker/Scripts/Draggable.cs.meta
  16. 23 0
      Assets/ColorPicker/Scripts/ExampleColorReceiver.cs
  17. 11 0
      Assets/ColorPicker/Scripts/ExampleColorReceiver.cs.meta
  18. 218 0
      Assets/ColorPicker/Scripts/HSBColor.cs
  19. 11 0
      Assets/ColorPicker/Scripts/HSBColor.cs.meta
  20. 9 0
      Assets/DefaultPlayables.meta
  21. 9 0
      Assets/DefaultPlayables/Editor.meta
  22. 1901 0
      Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs
  23. 12 0
      Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs.meta
  24. 9 0
      Assets/DefaultPlayables/LightControl.meta
  25. 9 0
      Assets/DefaultPlayables/LightControl/Editor.meta
  26. 33 0
      Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs
  27. 12 0
      Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs.meta
  28. 13 0
      Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs
  29. 12 0
      Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs.meta
  30. 20 0
      Assets/DefaultPlayables/LightControl/LightControlClip.cs
  31. 12 0
      Assets/DefaultPlayables/LightControl/LightControlClip.cs.meta
  32. 81 0
      Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs
  33. 12 0
      Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs.meta
  34. 29 0
      Assets/DefaultPlayables/LightControl/LightControlTrack.cs
  35. 12 0
      Assets/DefaultPlayables/LightControl/LightControlTrack.cs.meta
  36. 9 0
      Assets/DefaultPlayables/NavMeshAgentControl.meta
  37. 16 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs
  38. 12 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs.meta
  39. 25 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs
  40. 12 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs.meta
  41. 34 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs
  42. 12 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs.meta
  43. 15 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs
  44. 12 0
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs.meta
  45. 9 0
      Assets/DefaultPlayables/ScreenFader.meta
  46. 9 0
      Assets/DefaultPlayables/ScreenFader/Editor.meta
  47. 22 0
      Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs
  48. 12 0
      Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs.meta
  49. 11 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs
  50. 12 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs.meta
  51. 20 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs
  52. 12 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs.meta
  53. 64 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs
  54. 12 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs.meta
  55. 36 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs
  56. 12 0
      Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs.meta
  57. 9 0
      Assets/DefaultPlayables/TextSwitcher.meta
  58. 9 0
      Assets/DefaultPlayables/TextSwitcher/Editor.meta
  59. 30 0
      Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs
  60. 12 0
      Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs.meta
  61. 13 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs
  62. 12 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs.meta
  63. 20 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs
  64. 12 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs.meta
  65. 78 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs
  66. 12 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs.meta
  67. 36 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs
  68. 12 0
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs.meta
  69. 9 0
      Assets/DefaultPlayables/TimeDilation.meta
  70. 9 0
      Assets/DefaultPlayables/TimeDilation/Editor.meta
  71. 20 0
      Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs
  72. 12 0
      Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs.meta
  73. 10 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs
  74. 12 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs.meta
  75. 21 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs
  76. 12 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs.meta
  77. 41 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs
  78. 12 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs.meta
  79. 13 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs
  80. 12 0
      Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs.meta
  81. 9 0
      Assets/DefaultPlayables/TransformTween.meta
  82. 9 0
      Assets/DefaultPlayables/TransformTween/Editor.meta
  83. 44 0
      Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs
  84. 12 0
      Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs.meta
  85. 81 0
      Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs
  86. 12 0
      Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs.meta
  87. 26 0
      Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs
  88. 12 0
      Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs.meta
  89. 119 0
      Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs
  90. 12 0
      Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs.meta
  91. 32 0
      Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs
  92. 12 0
      Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs.meta
  93. 9 0
      Assets/DefaultPlayables/Video.meta
  94. 176 0
      Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs
  95. 12 0
      Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs.meta
  96. 52 0
      Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs
  97. 12 0
      Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs.meta
  98. 45 0
      Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs
  99. 12 0
      Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs.meta
  100. 34 0
      Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs

+ 6 - 0
.vsconfig

@@ -0,0 +1,6 @@
+{
+  "version": "1.0",
+  "components": [ 
+    "Microsoft.VisualStudio.Workload.ManagedGame"
+  ]
+} 

File diff suppressed because it is too large
+ 26 - 0
Assembly-CSharp-Editor-firstpass.csproj


File diff suppressed because it is too large
+ 26 - 0
Assembly-CSharp-Editor.csproj


File diff suppressed because it is too large
+ 26 - 0
Assembly-CSharp-firstpass.csproj


File diff suppressed because it is too large
+ 26 - 0
Assembly-CSharp.csproj


+ 8 - 0
Assets/ColorPicker.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 32a109c49b3a3fa43b4a6248c346b50c
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/ColorPicker/Scripts.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 65364bda5bd9a3f4594fbf8267d0d044
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 14 - 0
Assets/ColorPicker/Scripts/ColorHuePicker.cs

@@ -0,0 +1,14 @@
+using UnityEngine;
+
+public class ColorHuePicker : MonoBehaviour
+{
+	void SetColor(HSBColor color)
+	{
+		SendMessage("SetDragPoint", new Vector3(color.h, 0, 0));
+	}	
+
+    void OnDrag(Vector3 point)
+    {
+		transform.parent.BroadcastMessage("SetHue", point.x);
+    }
+}

+ 11 - 0
Assets/ColorPicker/Scripts/ColorHuePicker.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 484c31f7164344e25ac2758e1fd18bb8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 29 - 0
Assets/ColorPicker/Scripts/ColorIndicator.cs

@@ -0,0 +1,29 @@
+using UnityEngine;
+
+public class ColorIndicator : MonoBehaviour {
+
+	HSBColor color;
+
+	void Start() {
+		color = HSBColor.FromColor(GetComponent<Renderer>().sharedMaterial.GetColor("_Color"));
+		transform.parent.BroadcastMessage("SetColor", color);
+	}
+
+	void ApplyColor ()
+	{
+		GetComponent<Renderer>().sharedMaterial.SetColor ("_Color", color.ToColor());
+		transform.parent.BroadcastMessage("OnColorChange", color, SendMessageOptions.DontRequireReceiver);
+	}
+
+	void SetHue(float hue)
+	{
+		color.h = hue;
+		ApplyColor();
+    }	
+
+	void SetSaturationBrightness(Vector2 sb) {
+		color.s = sb.x;
+		color.b = sb.y;
+		ApplyColor();
+	}
+}

+ 11 - 0
Assets/ColorPicker/Scripts/ColorIndicator.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ba3a77568665644dabfcbf0832fc5bad
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 21 - 0
Assets/ColorPicker/Scripts/ColorSaturationBrightnessPicker.cs

@@ -0,0 +1,21 @@
+using UnityEngine;
+
+public class ColorSaturationBrightnessPicker : MonoBehaviour {
+	public Material backgroundMaterial;
+
+	void SetColor(HSBColor color)
+	{
+		backgroundMaterial.SetColor("_Color", new HSBColor(color.h, 1, 1).ToColor());
+		SendMessage("SetDragPoint", new Vector3(color.s, color.b, 0));
+	}
+
+    void OnDrag(Vector3 point)
+    {
+		transform.parent.BroadcastMessage("SetSaturationBrightness", new Vector2(point.x, point.y));
+    }
+
+    void SetHue(float hue)
+    {
+		backgroundMaterial.SetColor("_Color", new HSBColor(hue, 1, 1).ToColor());
+    }	
+}

+ 11 - 0
Assets/ColorPicker/Scripts/ColorSaturationBrightnessPicker.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 44261d035887f4f7689bf99cebee69cc
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 39 - 0
Assets/ColorPicker/Scripts/Draggable.cs

@@ -0,0 +1,39 @@
+using UnityEngine;
+
+public class Draggable : MonoBehaviour
+{
+	public bool fixX;
+	public bool fixY;
+	public Transform thumb;	
+	bool dragging;
+
+	void FixedUpdate()
+	{
+		if (Input.GetMouseButtonDown(0)) {
+			dragging = false;
+			var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
+			RaycastHit hit;
+			if (GetComponent<Collider>().Raycast(ray, out hit, 100)) {
+				dragging = true;
+			}
+		}
+		if (Input.GetMouseButtonUp(0)) dragging = false;
+		if (dragging && Input.GetMouseButton(0)) {
+			var point = Camera.main.ScreenToWorldPoint(Input.mousePosition);
+			point = GetComponent<Collider>().ClosestPointOnBounds(point);
+			SetThumbPosition(point);
+			SendMessage("OnDrag", Vector3.one - (thumb.position - GetComponent<Collider>().bounds.min) / GetComponent<Collider>().bounds.size.x);
+		}
+	}
+
+	void SetDragPoint(Vector3 point)
+	{
+		point = (Vector3.one - point) * GetComponent<Collider>().bounds.size.x + GetComponent<Collider>().bounds.min;
+		SetThumbPosition(point);
+	}
+
+	void SetThumbPosition(Vector3 point)
+	{
+		thumb.position = new Vector3(fixX ? thumb.position.x : point.x, fixY ? thumb.position.y : point.y, thumb.position.z);
+	}
+}

+ 11 - 0
Assets/ColorPicker/Scripts/Draggable.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fc0b483af689044d7afe98cea1bd80d1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 23 - 0
Assets/ColorPicker/Scripts/ExampleColorReceiver.cs

@@ -0,0 +1,23 @@
+using UnityEngine;
+
+public class ExampleColorReceiver : MonoBehaviour {
+	
+    Color color;
+
+	void OnColorChange(HSBColor color) 
+	{
+        this.color = color.ToColor();
+	}
+
+    void OnGUI()
+    {
+		var r = Camera.main.pixelRect;
+		var rect = new Rect(r.center.x + r.height / 6 + 50, r.center.y, 100, 100);
+		GUI.Label (rect, "#" + ToHex(color.r) + ToHex(color.g) + ToHex(color.b));	
+    }
+
+	string ToHex(float n)
+	{
+		return ((int)(n * 255)).ToString("X").PadLeft(2, '0');
+	}
+}

+ 11 - 0
Assets/ColorPicker/Scripts/ExampleColorReceiver.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: af3a4c20663a14299b4d511d1dee41ea
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 218 - 0
Assets/ColorPicker/Scripts/HSBColor.cs

@@ -0,0 +1,218 @@
+/*
+ * http://wiki.unity3d.com/index.php?title=HSBColor
+ */
+
+using UnityEngine;
+ 
+[System.Serializable]
+public struct HSBColor
+{
+    public float h;
+    public float s;
+    public float b;
+    public float a;
+ 
+    public HSBColor(float h, float s, float b, float a)
+    {
+        this.h = h;
+        this.s = s;
+        this.b = b;
+        this.a = a;
+    }
+ 
+    public HSBColor(float h, float s, float b)
+    {
+        this.h = h;
+        this.s = s;
+        this.b = b;
+        this.a = 1f;
+    }
+ 
+    public HSBColor(Color col)
+    {
+        HSBColor temp = FromColor(col);
+        h = temp.h;
+        s = temp.s;
+        b = temp.b;
+        a = temp.a;
+    }
+ 
+    public static HSBColor FromColor(Color color)
+    {
+        HSBColor ret = new HSBColor(0f, 0f, 0f, color.a);
+ 
+        float r = color.r;
+        float g = color.g;
+        float b = color.b;
+ 
+        float max = Mathf.Max(r, Mathf.Max(g, b));
+ 
+        if (max <= 0)
+        {
+            return ret;
+        }
+ 
+        float min = Mathf.Min(r, Mathf.Min(g, b));
+        float dif = max - min;
+ 
+        if (max > min)
+        {
+            if (g == max)
+            {
+                ret.h = (b - r) / dif * 60f + 120f;
+            }
+            else if (b == max)
+            {
+                ret.h = (r - g) / dif * 60f + 240f;
+            }
+            else if (b > g)
+            {
+                ret.h = (g - b) / dif * 60f + 360f;
+            }
+            else
+            {
+                ret.h = (g - b) / dif * 60f;
+            }
+            if (ret.h < 0)
+            {
+                ret.h = ret.h + 360f;
+            }
+        }
+        else
+        {
+            ret.h = 0;
+        }
+ 
+        ret.h *= 1f / 360f;
+        ret.s = (dif / max) * 1f;
+        ret.b = max;
+ 
+        return ret;
+    }
+ 
+    public static Color ToColor(HSBColor hsbColor)
+    {
+        float r = hsbColor.b;
+        float g = hsbColor.b;
+        float b = hsbColor.b;
+        if (hsbColor.s != 0)
+        {
+            float max = hsbColor.b;
+            float dif = hsbColor.b * hsbColor.s;
+            float min = hsbColor.b - dif;
+ 
+            float h = hsbColor.h * 360f;
+ 
+            if (h < 60f)
+            {
+                r = max;
+                g = h * dif / 60f + min;
+                b = min;
+            }
+            else if (h < 120f)
+            {
+                r = -(h - 120f) * dif / 60f + min;
+                g = max;
+                b = min;
+            }
+            else if (h < 180f)
+            {
+                r = min;
+                g = max;
+                b = (h - 120f) * dif / 60f + min;
+            }
+            else if (h < 240f)
+            {
+                r = min;
+                g = -(h - 240f) * dif / 60f + min;
+                b = max;
+            }
+            else if (h < 300f)
+            {
+                r = (h - 240f) * dif / 60f + min;
+                g = min;
+                b = max;
+            }
+            else if (h <= 360f)
+            {
+                r = max;
+                g = min;
+                b = -(h - 360f) * dif / 60 + min;
+            }
+            else
+            {
+                r = 0;
+                g = 0;
+                b = 0;
+            }
+        }
+ 
+        return new Color(Mathf.Clamp01(r),Mathf.Clamp01(g),Mathf.Clamp01(b),hsbColor.a);
+    }
+ 
+    public Color ToColor()
+    {
+        return ToColor(this);
+    }
+ 
+    public override string ToString()
+    {
+        return "H:" + h + " S:" + s + " B:" + b;
+    }
+ 
+    public static HSBColor Lerp(HSBColor a, HSBColor b, float t)
+    {
+        float h,s;
+ 
+        //check special case black (color.b==0): interpolate neither hue nor saturation!
+        //check special case grey (color.s==0): don't interpolate hue!
+        if(a.b==0){
+            h=b.h;
+            s=b.s;
+        }else if(b.b==0){
+            h=a.h;
+            s=a.s;
+        }else{
+            if(a.s==0){
+                h=b.h;
+            }else if(b.s==0){
+                h=a.h;
+            }else{
+                // works around bug with LerpAngle
+                float angle = Mathf.LerpAngle(a.h * 360f, b.h * 360f, t);
+                while (angle < 0f)
+                    angle += 360f;
+                while (angle > 360f)
+                    angle -= 360f;
+                h=angle/360f;
+            }
+            s=Mathf.Lerp(a.s,b.s,t);
+        }
+        return new HSBColor(h, s, Mathf.Lerp(a.b, b.b, t), Mathf.Lerp(a.a, b.a, t));
+    }
+ 
+    public static void Test()
+    {
+        HSBColor color;
+
+        color = new HSBColor(Color.red);
+        Debug.Log("red: " + color);
+
+        color = new HSBColor(Color.green);
+        Debug.Log("green: " + color);
+
+        color = new HSBColor(Color.blue);
+        Debug.Log("blue: " + color);
+
+        color = new HSBColor(Color.grey);
+        Debug.Log("grey: " + color);
+
+        color = new HSBColor(Color.white);
+        Debug.Log("white: " + color);
+
+        color = new HSBColor(new Color(0.4f, 1f, 0.84f, 1f));
+        Debug.Log("0.4, 1f, 0.84: " + color);
+
+        Debug.Log("164,82,84   .... 0.643137f, 0.321568f, 0.329411f  :" + ToColor(new HSBColor(new Color(0.643137f, 0.321568f, 0.329411f))));
+    }
+}

+ 11 - 0
Assets/ColorPicker/Scripts/HSBColor.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5d08915765b13422b8d3f3e2a5b216f1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6c3e3d86d51c7ec44b10953420b8da2b
+folderAsset: yes
+timeCreated: 1489400781
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 89ec3eb5642c0f84d9f5090b2ca93a14
+folderAsset: yes
+timeCreated: 1490191884
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1901 - 0
Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs

@@ -0,0 +1,1901 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.CodeDom.Compiler;
+using System.Reflection;
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Timeline;
+
+public class TimelinePlayableWizard : EditorWindow
+{
+    public class Variable : IComparable
+    {
+        public string name;
+        public UsableType usableType;
+
+        int m_TypeIndex;
+        
+        public Variable (string name, UsableType usableType)
+        {
+            this.name = name;
+            this.usableType = usableType;
+        }
+
+        public bool GUI (UsableType[] usableTypes)
+        {
+            bool removeThis = false;
+            EditorGUILayout.BeginHorizontal();
+            name = EditorGUILayout.TextField(name);
+            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, UsableType.GetNamewithSortingArray (usableTypes));
+            usableType = usableTypes[m_TypeIndex];
+            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
+            {
+                removeThis = true;
+            }
+            EditorGUILayout.EndHorizontal();
+
+            return removeThis;
+        }
+
+        public int CompareTo (object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            UsableType other = (UsableType)obj;
+
+            if (other == null)
+                throw new ArgumentException("This object is not a Variable.");
+
+            return name.ToLower().CompareTo(other.name.ToLower());
+        }
+
+        public static UsableType[] GetUsableTypesFromVariableArray (Variable[] variables)
+        {
+            UsableType[] usableTypes = new UsableType[variables.Length];
+            for (int i = 0; i < usableTypes.Length; i++)
+            {
+                usableTypes[i] = variables[i].usableType;
+            }
+            return usableTypes;
+        }
+    }
+
+
+    public class UsableType : IComparable
+    {
+        public readonly string name;
+        public readonly string nameWithSorting;
+        public readonly string additionalNamespace;
+        public readonly GUIContent guiContentWithSorting;
+        public readonly Type type;
+
+        public readonly string[] unrequiredNamespaces =
+        {
+            "UnityEngine",
+            "UnityEngine.Timeline",
+            "UnityEngine.Playables"
+        };
+        public const string blankAdditionalNamespace = "";
+
+        const string k_NameForNullType = "None";
+
+        public UsableType (Type usableType)
+        {
+            type = usableType;
+
+            if (type != null)
+            {
+                name = usableType.Name;
+                nameWithSorting = name.ToUpper ()[0] + "/" + name;
+                additionalNamespace = unrequiredNamespaces.All (t => usableType.Namespace != t) ? usableType.Namespace : blankAdditionalNamespace;
+            }
+            else
+            {
+                name = k_NameForNullType;
+                nameWithSorting = k_NameForNullType;
+                additionalNamespace = blankAdditionalNamespace;
+            }
+
+            guiContentWithSorting = new GUIContent(nameWithSorting);
+        }
+
+        public UsableType (string name)
+        {
+            this.name = name;
+            nameWithSorting = name.ToUpper()[0] + "/" + name;
+            additionalNamespace = blankAdditionalNamespace;
+            guiContentWithSorting = new GUIContent(nameWithSorting);
+        }
+
+        public int CompareTo (object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            UsableType other = (UsableType)obj;
+            
+            if(other == null)
+                throw new ArgumentException("This object is not a UsableType.");
+
+            return name.ToLower().CompareTo (other.name.ToLower());
+        }
+
+        public static UsableType[] GetUsableTypeArray (Type[] types, params UsableType[] additionalUsableTypes)
+        {
+            List<UsableType> usableTypeList = new List<UsableType> ();
+            for (int i = 0; i < types.Length; i++)
+            {
+                usableTypeList.Add (new UsableType (types[i]));
+            }
+            usableTypeList.AddRange (additionalUsableTypes);
+            return usableTypeList.ToArray ();
+        }
+
+        public static UsableType[] AmalgamateUsableTypes (UsableType[] usableTypeArray, params UsableType[] usableTypes)
+        {
+            List<UsableType> usableTypeList = new List<UsableType> ();
+            for (int i = 0; i < usableTypes.Length; i++)
+            {
+                usableTypeList.Add (usableTypes[i]);
+            }
+            usableTypeList.AddRange(usableTypeArray);
+            return usableTypeList.ToArray();
+        }
+
+        public static string[] GetNamewithSortingArray(UsableType[] usableTypes)
+        {
+            if (usableTypes == null || usableTypes.Length == 0)
+                return new string[0];
+
+            string[] displayNames = new string[usableTypes.Length];
+            for (int i = 0; i < displayNames.Length; i++)
+            {
+                displayNames[i] = usableTypes[i].nameWithSorting;
+            }
+            return displayNames;
+        }
+
+        public static GUIContent[] GetGUIContentWithSortingArray (UsableType[] usableTypes)
+        {
+            if(usableTypes == null || usableTypes.Length == 0)
+                return new GUIContent[0];
+
+            GUIContent[] guiContents = new GUIContent[usableTypes.Length];
+            for (int i = 0; i < guiContents.Length; i++)
+            {
+                guiContents[i] = usableTypes[i].guiContentWithSorting;
+            }
+            return guiContents;
+        }
+
+        public static string[] GetDistinctAdditionalNamespaces (UsableType[] usableTypes)
+        {
+            if (usableTypes == null || usableTypes.Length == 0)
+                return new string[0];
+
+            string[] namespaceArray = new string[usableTypes.Length];
+            for (int i = 0; i < namespaceArray.Length; i++)
+            {
+                namespaceArray[i] = usableTypes[i].additionalNamespace;
+            }
+            return namespaceArray.Distinct().ToArray();
+        }
+    }
+
+
+    public class UsableProperty : IComparable
+    {
+        public enum Usability
+        {
+            Blendable, Assignable, Not
+        }
+        
+        public enum UsablePropertyType
+        {
+            Property, Field
+        }
+        
+        public string type;
+        public string name;
+        public string defaultValue;
+        public Usability usability;
+        public UsablePropertyType usablePropertyType;
+        public PropertyInfo propertyInfo;
+        public FieldInfo fieldInfo;
+
+        int m_TypeIndex;
+        
+        public string NameWithCaptial
+        {
+            get { return name.First().ToString().ToUpper() + name.Substring(1); }
+        }
+
+        public string NameAsPrivate
+        {
+            get { return "m_" + NameWithCaptial; }
+        }
+
+        public string NameAsPrivateDefault
+        {
+            get { return "m_Default" + NameWithCaptial; }
+        }
+
+        public string NameAsPrivateAssigned
+        {
+            get { return "m_Assigned" + NameWithCaptial; }
+        }
+
+        public string NameAsLocalBlended
+        {
+            get { return "blended" + NameWithCaptial; }
+        }
+
+        public string NameAsLocalSerializedProperty
+        {
+            get { return name + "Prop"; }
+        }
+        
+        public UsableProperty (PropertyInfo propertyInfo)
+        {
+            usablePropertyType = UsablePropertyType.Property;
+            this.propertyInfo = propertyInfo;
+
+            if (propertyInfo.PropertyType.Name == "Single")
+                type = "float";
+            else if (propertyInfo.PropertyType.Name == "Int32")
+                type = "int";
+            else if (propertyInfo.PropertyType.Name == "Double")
+                type = "double";
+            else if (propertyInfo.PropertyType.Name == "Boolean")
+                type = "bool";
+            else if (propertyInfo.PropertyType.Name == "String")
+                type = "string";
+            else
+                type = propertyInfo.PropertyType.Name;
+
+            name = propertyInfo.Name;
+
+            if (IsTypeBlendable(propertyInfo.PropertyType))
+                usability = Usability.Blendable;
+            else if (IsTypeAssignable(propertyInfo.PropertyType))
+                usability = Usability.Assignable;
+            else
+                usability = Usability.Not;
+        }
+
+        public UsableProperty (FieldInfo fieldInfo)
+        {
+            usablePropertyType = UsablePropertyType.Field;
+            this.fieldInfo = fieldInfo;
+            
+            if (fieldInfo.FieldType.Name == "Single")
+                type = "float";
+            else if (fieldInfo.FieldType.Name == "Int32")
+                type = "int";
+            else if (fieldInfo.FieldType.Name == "Double")
+                type = "double";
+            else if (fieldInfo.FieldType.Name == "Boolean")
+                type = "bool";
+            else if (fieldInfo.FieldType.Name == "String")
+                type = "string";
+            else
+                type = fieldInfo.FieldType.Name;
+
+            name = fieldInfo.Name;
+            
+            if (IsTypeBlendable(fieldInfo.FieldType))
+                usability = Usability.Blendable;
+            else if (IsTypeAssignable(fieldInfo.FieldType))
+                usability = Usability.Assignable;
+            else
+                usability = Usability.Not;
+        }
+
+        public string ZeroValueAsString ()
+        {
+            if(usability != Usability.Blendable)
+                throw new UnityException("UsableType is not blendable, shouldn't be looking for zero value as string.");
+
+            switch (type)
+            {
+                case "float":
+                    return "0f";
+                case "int":
+                    return "0";
+                case "double":
+                    return "0.0";
+                case "Vector2":
+                    return "Vector2.zero";
+                case "Vector3":
+                    return "Vector3.zero";
+                case "Color":
+                    return "Color.clear";
+            }
+            return "";
+        }
+
+        public void CreateSettingDefaultValueString (Component defaultValuesComponent)
+        {
+            if (defaultValuesComponent == null)
+            {
+                defaultValue = "";
+                return;
+            }
+            
+            object defaultValueObj = usablePropertyType == UsablePropertyType.Property ? propertyInfo.GetValue (defaultValuesComponent, null) : fieldInfo.GetValue (defaultValuesComponent);
+            
+            switch (type)
+            {
+                case "float":
+                    float defaultFloatValue = (float)defaultValueObj;
+                    defaultValue = defaultFloatValue + "f";
+                    break;
+                case "int":
+                    int defaultIntValue = (int)defaultValueObj;
+                    defaultValue = defaultIntValue.ToString();
+                    break;
+                case "double":
+                    double defaultDoubleValue = (double)defaultValueObj;
+                    defaultValue = defaultDoubleValue.ToString();
+                    break;
+                case "Vector2":
+                    Vector2 defaultVector2Value = (Vector2)defaultValueObj;
+                    defaultValue = "new Vector2(" + defaultVector2Value.x + "f, " + defaultVector2Value.y + "f)";
+                    break;
+                case "Vector3":
+                    Vector3 defaultVector3Value = (Vector3)defaultValueObj;
+                    defaultValue = "new Vector3(" + defaultVector3Value.x + "f, " + defaultVector3Value.y + "f, " + defaultVector3Value.z + "f)";
+                    break;
+                case "Color":
+                    Color defaultColorValue = (Color)defaultValueObj;
+                    defaultValue = "new Color(" + defaultColorValue.r + "f, " + defaultColorValue.g + "f, " + defaultColorValue.b + "f, " + defaultColorValue.a + "f)";
+                    break;
+                case "string":
+                    defaultValue = "\"" + defaultValueObj + "\"";
+                    break;
+                case "bool":
+                    bool defaultBoolValue = (bool)defaultValueObj;
+                    defaultValue = defaultBoolValue.ToString ().ToLower();
+                    break;
+                default:
+                    Enum defaultEnumValue = (Enum)defaultValueObj;
+                    Type enumSystemType = defaultEnumValue.GetType ();
+                    string[] splits = enumSystemType.ToString().Split('+');
+                    string enumType = splits[splits.Length - 1];
+                    string enumConstantName = Enum.GetName (enumSystemType, defaultEnumValue);
+                    defaultValue = enumType + "." + enumConstantName;
+                    break;
+            }
+        }
+
+        public bool GUI (List<UsableProperty> allUsableProperties)
+        {
+            bool removeThis = false;
+            EditorGUILayout.BeginHorizontal();
+            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, GetNameWithSortingArray (allUsableProperties));
+            type = allUsableProperties[m_TypeIndex].type;
+            name = allUsableProperties[m_TypeIndex].name;
+            usablePropertyType = allUsableProperties[m_TypeIndex].usablePropertyType;
+            propertyInfo = allUsableProperties[m_TypeIndex].propertyInfo;
+            fieldInfo = allUsableProperties[m_TypeIndex].fieldInfo;
+            usability = allUsableProperties[m_TypeIndex].usability;
+            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
+            {
+                removeThis = true;
+            }
+            EditorGUILayout.EndHorizontal();
+            return removeThis;
+        }
+
+        public int CompareTo(object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            UsableType other = (UsableType)obj;
+
+            if (other == null)
+                throw new ArgumentException("This object is not a UsableProperty.");
+
+            return name.ToLower().CompareTo(other.name.ToLower());
+        }
+
+        public static string[] GetNameWithSortingArray (List<UsableProperty> usableProperties)
+        {
+            string[] returnVal = new string[usableProperties.Count];
+            for (int i = 0; i < returnVal.Length; i++)
+            {
+                returnVal[i] = usableProperties[i].name;
+            }
+            return returnVal;
+        }
+
+        public UsableProperty GetDuplicate ()
+        {
+            UsableProperty duplicate = usablePropertyType == UsablePropertyType.Property ? new UsableProperty (propertyInfo) : new UsableProperty (fieldInfo);
+            duplicate.defaultValue = defaultValue;
+            return duplicate;
+        }
+    }
+
+    public enum CreationError
+    {
+        NoError,
+        PlayableAssetAlreadyExists,
+        PlayableBehaviourAlreadyExists,
+        PlayableBehaviourMixerAlreadyExists,
+        TrackAssetAlreadyExists,
+        PlayableDrawerAlreadyExists,
+    }
+
+
+    public bool showHelpBoxes = true;
+    public string playableName = "";
+    public bool isStandardBlendPlayable;
+    public UsableType trackBinding;
+    public Component defaultValuesComponent;
+    public List<Variable> exposedReferences = new List<Variable> ();
+    public List<Variable> playableBehaviourVariables = new List<Variable> ();
+    public List<UsableProperty> standardBlendPlayableProperties = new List<UsableProperty> ();
+    public ClipCaps clipCaps;
+    /*public bool setClipDefaults;
+    public float clipDefaultDurationSeconds = 5f;
+    public float clipDefaultEaseInSeconds;
+    public float clipDefaultEaseOutSeconds;
+    public float clipDefaultClipInSeconds;
+    public float clipDefaultSpeedMultiplier = 1f;*/
+    public Color trackColor = new Color(0.855f, 0.8623f, 0.870f);
+
+    int m_TrackBindingTypeIndex;
+    int m_ComponentBindingTypeIndex;
+    PropertyInfo[] m_TrackBindingProperties;
+    FieldInfo[] m_TrackBindingFields;
+    List<UsableProperty> m_TrackBindingUsableProperties = new List<UsableProperty> ();
+    bool m_CreateDrawer;
+    bool m_CreateButtonPressed;
+    Vector2 m_ScrollViewPos;
+    CreationError m_CreationError;
+    
+    readonly GUIContent m_ShowHelpBoxesContent = new GUIContent("Show Help", "Do you want to see the help boxes as part of this wizard?");
+    readonly GUIContent m_PlayableNameContent = new GUIContent("Playable Name", "This is the name that will represent the playable.  E.G. TransformTween.  It will be the basis for the class names so it is best not to use the postfixes: 'Clip', 'Behaviour', 'MixerBehaviour' or 'Drawer'.");
+    readonly GUIContent m_StandardBlendPlayableContent = new GUIContent("Standard Blend Playable", "Often when creating a playable it's intended purpose is just to briefly override the properties of a component for the playable's duration and then blend back to the defaults.  For example a playable that changes the color of a Light but changes it back.  To make a playable with this functionality, check this box.");
+    readonly GUIContent m_TrackBindingTypeContent = new GUIContent("Track Binding Type", "This is the type of object the Playable will affect.  E.G. To affect the position choose Transform.");
+    readonly GUIContent m_DefaultValuesComponentContent = new GUIContent("Default Values", "When the scripts are created, each of the selected properties are assigned a default from the selected Component.  If this is left blank no defaults will be used.");
+    readonly GUIContent m_ExposedReferencesContent = new GUIContent("Exposed References", "Exposed References are references to objects in a scene that your Playable needs. For example, if you want to tween between two Transforms, they will need to be Exposed References.");
+    readonly GUIContent m_BehaviourVariablesContent = new GUIContent("Behaviour Variables", "Behaviour Variables are all the variables you wish to use in your playable that do NOT need a reference to something in a scene.  For example a float for speed.");
+    readonly GUIContent m_TrackColorContent = new GUIContent("Track Color", "Timeline tracks have a colored outline, use this to select that color for your track.");
+    readonly GUIContent m_CreateDrawerContent = new GUIContent("Create Drawer?", "Checking this box will enable the creation of a PropertyDrawer for your playable.  Having this script will make it easier to customise how your playable appears in the inspector.");
+    readonly GUIContent m_StandardBlendPlayablePropertiesContent = new GUIContent("Standard Blend Playable Properties", "Having already selected a Track Binding type, you can select the properties of the bound component you want the playable to affect.  For example, if your playable is bound to a Transform, you can affect the position property.  Note that changing the component binding will clear the list of properties.");
+    readonly GUIContent m_ClipCapsContent = new GUIContent("Clip Caps", "Clip Caps are used to change the way Timelines work with your playables.  For example, enabling Blending will mean that your playables can blend when they overlap and have ease in and out durations.  To find out a little about each hover the cursor over the options.  For details, please see the documentation.");
+    readonly GUIContent m_CCNoneContent = new GUIContent("None", "Your playable supports none of the features below.");
+    readonly GUIContent m_CCLoopingContent = new GUIContent("Looping", "Your playable has a specified time that it takes and will start again after it finishes until the clip's duration has played.");
+    readonly GUIContent m_CCExtrapolationContent = new GUIContent("Extrapolation", "Your playable will persist beyond its end time and its results will continue until the next clip is encountered.");
+    readonly GUIContent m_CCClipInContent = new GUIContent("Clip In", "Your playable need not be at the start of the Timeline.");
+    readonly GUIContent m_CCSpeedMultiplierContent = new GUIContent("Speed Multiplier", "Your playable supports changes to the time scale.");
+    readonly GUIContent m_CCBlendingContent = new GUIContent("Blending", "Your playable supports overlapping of clips to blend between them.");
+    readonly GUIContent m_CCAllContent = new GUIContent("All", "Your playable supports all of the above features.");
+    /*readonly GUIContent m_SetClipDefaultsContent = new GUIContent("Set Clip Defaults", "Do you want to set the default timings and other settings for clips when they are first created?");
+    readonly GUIContent m_ClipDefaultsContent = new GUIContent("Clip Defaults");
+    readonly GUIContent m_CDClipTimingContent = new GUIContent("Clip Timing", "Various settings that affect the durations over which the playable will be active.");
+    readonly GUIContent m_CDDurationContent = new GUIContent("Duration", "The default length of the clip in seconds.");
+    readonly GUIContent m_CDEaseInContent = new GUIContent("Ease In Duration", "The default duration over which the clip's weight increases to one.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
+    readonly GUIContent m_CDEaseOutContent = new GUIContent("Ease Out Duration", "The default duration over which the clip's weight decreases to zero.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
+    readonly GUIContent m_CDClipInContent = new GUIContent("Clip In", "The length of time after the start that the clip should start.  A clip requires the ClipIn ClipCap to support this.");
+    readonly GUIContent m_CDSpeedMultiplierContent = new GUIContent("Speed Multiplier", "The amount a clip's time dependent aspects will speed up or slow down by.  A clip requires the SpeedMultiplier ClipCap to support this.");
+    */
+    const string k_Tab = "    ";
+    const string k_ShowHelpBoxesKey = "TimelinePlayableWizard_ShowHelpBoxes";
+    const string k_TimelineClipAssetSuffix = "Clip";
+    const string k_TimelineClipBehaviourSuffix = "Behaviour";
+    const string k_PlayableBehaviourMixerSuffix = "MixerBehaviour";
+    const string k_TrackAssetSuffix = "Track";
+    const string k_PropertyDrawerSuffix = "Drawer";
+    const int k_PlayableNameCharLimit = 64;
+    const float k_WindowWidth = 500f;
+    const float k_MaxWindowHeight = 800f;
+    const float k_ScreenSizeWindowBuffer = 50f;
+
+    static UsableType[] s_ComponentTypes;
+    static UsableType[] s_TrackBindingTypes;
+    static UsableType[] s_ExposedReferenceTypes;
+    static UsableType[] s_BehaviourVariableTypes;
+    static Type[] s_BlendableTypes =
+    {
+        typeof(float), typeof(int), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Color), 
+    };
+    static Type[] s_AssignableTypes =
+    {
+        typeof(string), typeof(bool)
+    };
+    static string[] s_DisallowedPropertyNames =
+    {
+        "name",
+    };
+
+    [MenuItem("Window/Timeline Playable Wizard...")]
+    static void CreateWindow ()
+    {
+        TimelinePlayableWizard wizard = GetWindow<TimelinePlayableWizard>(true, "Timeline Playable Wizard", true);
+        
+        Vector2 position = Vector2.zero;
+        SceneView sceneView = SceneView.lastActiveSceneView;
+        if (sceneView != null)
+            position = new Vector2(sceneView.position.x, sceneView.position.y);
+        wizard.position = new Rect(position.x + k_ScreenSizeWindowBuffer, position.y + k_ScreenSizeWindowBuffer, k_WindowWidth, Mathf.Min(Screen.currentResolution.height - k_ScreenSizeWindowBuffer, k_MaxWindowHeight));
+        
+        wizard.showHelpBoxes = EditorPrefs.GetBool (k_ShowHelpBoxesKey);
+        wizard.Show();
+        
+        Init ();
+    }
+
+    static void Init ()
+    {
+        Type[] componentTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => typeof(Component).IsAssignableFrom(t)).Where (t => t.IsPublic).ToArray();
+        
+        List<UsableType> componentUsableTypesList = UsableType.GetUsableTypeArray(componentTypes).ToList();
+        componentUsableTypesList.Sort();
+        s_ComponentTypes = componentUsableTypesList.ToArray ();
+
+        UsableType gameObjectUsableType = new UsableType(typeof(GameObject));
+        UsableType[] defaultUsableTypes = UsableType.GetUsableTypeArray(componentTypes, gameObjectUsableType);
+
+        List<UsableType> exposedRefTypeList = defaultUsableTypes.ToList ();
+        exposedRefTypeList.Sort();
+        s_ExposedReferenceTypes = exposedRefTypeList.ToArray();
+
+        UsableType noneType = new UsableType((Type)null);
+        s_TrackBindingTypes = UsableType.AmalgamateUsableTypes(s_ExposedReferenceTypes, noneType);
+
+        s_BehaviourVariableTypes = UsableType.AmalgamateUsableTypes
+            (
+                s_ExposedReferenceTypes,
+                new UsableType("int"),
+                new UsableType("bool"),
+                new UsableType("float"),
+                new UsableType("Color"),
+                new UsableType("double"),
+                new UsableType("string"),
+                new UsableType("Vector2"),
+                new UsableType("Vector3"),
+                new UsableType("AudioClip"),
+                new UsableType("AnimationCurve")
+            );
+        List<UsableType> scriptVariableTypeList = s_BehaviourVariableTypes.ToList();
+        scriptVariableTypeList.Sort();
+        s_BehaviourVariableTypes = scriptVariableTypeList.ToArray();
+    }
+
+    void OnGUI ()
+    {
+        if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
+            Init ();
+
+        if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
+        {
+            EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
+            return;
+        }
+
+        m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);
+
+        bool oldShowHelpBoxes = showHelpBoxes;
+        showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
+        if (oldShowHelpBoxes != showHelpBoxes)
+        {
+            EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
+            EditorGUILayout.Space ();
+        }
+
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
+                               + "It will create 4 scripts that you can then edit to complete their functionality. "
+                               + "The purpose is to setup the boilerplate code for you.  If you are already familiar "
+                               + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
+            EditorGUILayout.Space();
+        }
+
+        EditorGUILayout.Space ();
+        EditorGUILayout.Space();
+
+        EditorGUILayout.BeginVertical (GUI.skin.box);
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+        playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);
+
+        bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
+        bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
+        if (!playableNameNotEmpty || !playableNameFormatted)
+        {
+            EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
+        }
+        bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
+        if (playableNameTooLong)
+        {
+            EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
+        }
+        EditorGUILayout.EndVertical ();
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+
+        EditorGUILayout.BeginVertical(GUI.skin.box);
+        if(showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+        bool oldStandardBlendPlayable = isStandardBlendPlayable;
+        isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
+        EditorGUILayout.EndVertical ();
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+
+        EditorGUILayout.BeginVertical(GUI.skin.box);
+        if(showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+        int oldIndex = -1;
+        if (isStandardBlendPlayable)
+        {
+            oldIndex = m_ComponentBindingTypeIndex;
+
+            m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
+            trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];
+
+            EditorGUILayout.Space ();
+
+            defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
+        }
+        else
+        {
+            m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
+            trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
+        }
+        EditorGUILayout.EndVertical ();
+        
+        bool exposedVariablesNamesValid = true;
+        bool scriptVariablesNamesValid = true;
+        bool allUniqueVariableNames = true;
+        
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+
+        if (isStandardBlendPlayable)
+        {
+            StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
+        }
+        else
+        {
+            exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");
+
+            EditorGUILayout.Space();
+            EditorGUILayout.Space();
+
+            scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");
+
+            EditorGUILayout.Space();
+            EditorGUILayout.Space();
+
+            allUniqueVariableNames = AllVariablesUniquelyNamed();
+            if (!allUniqueVariableNames)
+            {
+                EditorGUILayout.HelpBox("Your variables to not have unique names.  Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
+            }
+
+            EditorGUILayout.Space();
+            EditorGUILayout.Space();
+
+            ClipCapsGUI();
+        }
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+
+        /*ClipDefaultsGUI ();
+
+        EditorGUILayout.Space ();
+        EditorGUILayout.Space ();*/
+
+        EditorGUILayout.BeginVertical(GUI.skin.box);
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+        trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
+        EditorGUILayout.EndVertical ();
+
+        if (!isStandardBlendPlayable)
+        {
+            EditorGUILayout.Space();
+            EditorGUILayout.Space();
+
+            EditorGUILayout.BeginVertical(GUI.skin.box);
+            if (showHelpBoxes)
+            {
+                EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
+                EditorGUILayout.Space();
+            }
+            m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
+            EditorGUILayout.EndVertical ();
+        }
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+        
+        if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
+        {
+            if (GUILayout.Button("Create", GUILayout.Width(60f)))
+            {
+                m_CreateButtonPressed = true;
+
+                for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+                {
+                    standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
+                }
+
+                m_CreationError = CreateScripts();
+
+                if (m_CreationError == CreationError.NoError)
+                {
+                    Close ();
+                }
+            }
+        }
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+        
+        if (m_CreateButtonPressed)
+        {
+            switch (m_CreationError)
+            {
+                case CreationError.NoError:
+                    EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
+                    break;
+                case CreationError.PlayableAssetAlreadyExists:
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
+                    break;
+                case CreationError.PlayableBehaviourAlreadyExists:
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
+                    break;
+                case CreationError.PlayableBehaviourMixerAlreadyExists:
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
+                    break;
+                case CreationError.TrackAssetAlreadyExists:
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
+                    break;
+                case CreationError.PlayableDrawerAlreadyExists:
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
+                    break;
+            }
+        }
+
+        if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
+        {
+            ResetWindow ();
+        }
+
+        EditorGUILayout.EndScrollView ();
+    }
+
+    void StandardBlendPlayablePropertyGUI (bool findNewProperties)
+    {
+        if (findNewProperties || m_TrackBindingProperties == null && m_TrackBindingFields == null)
+        {
+            m_TrackBindingUsableProperties.Clear ();
+            
+            IEnumerable<PropertyInfo> propertyInfos = trackBinding.type.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
+            propertyInfos = propertyInfos.Where (x => IsTypeBlendable(x.PropertyType) || IsTypeAssignable(x.PropertyType));
+            propertyInfos = propertyInfos.Where (x => x.CanWrite && x.CanRead);
+            propertyInfos = propertyInfos.Where (x => HasAllowedName (x));
+            // Uncomment the below to stop Obsolete properties being selectable.
+            //propertyInfos = propertyInfos.Where (x => !Attribute.IsDefined (x, typeof(ObsoleteAttribute)));
+            m_TrackBindingProperties = propertyInfos.ToArray();
+            foreach (PropertyInfo trackBindingProperty in m_TrackBindingProperties)
+            {
+                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingProperty));
+            }
+            
+            IEnumerable<FieldInfo> fieldInfos = trackBinding.type.GetFields (BindingFlags.Instance | BindingFlags.Public);
+            fieldInfos = fieldInfos.Where(x => IsTypeBlendable(x.FieldType) || IsTypeAssignable(x.FieldType));
+            m_TrackBindingFields = fieldInfos.ToArray ();
+            foreach (FieldInfo trackBindingField in m_TrackBindingFields)
+            {
+                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingField));
+            }
+
+            m_TrackBindingUsableProperties = m_TrackBindingUsableProperties.OrderBy (x => x.name).ToList ();
+            standardBlendPlayableProperties.Clear ();
+        }
+
+        EditorGUILayout.BeginVertical (GUI.skin.box);
+
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_StandardBlendPlayablePropertiesContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+
+        EditorGUILayout.LabelField(m_StandardBlendPlayablePropertiesContent);
+
+        int indexToRemove = -1;
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            if (standardBlendPlayableProperties[i].GUI(m_TrackBindingUsableProperties))
+                indexToRemove = i;
+        }
+        if (indexToRemove != -1)
+            standardBlendPlayableProperties.RemoveAt(indexToRemove);
+
+        if (GUILayout.Button("Add", GUILayout.Width(40f)))
+            standardBlendPlayableProperties.Add(m_TrackBindingUsableProperties[0].GetDuplicate ());
+
+        if (standardBlendPlayableProperties.Any(IsObsolete))
+            EditorGUILayout.HelpBox ("One or more of your chosen properties are marked 'Obsolete'.  Consider changing them to avoid deprecation with future versions of Unity.", MessageType.Warning);
+
+        EditorGUILayout.EndVertical ();
+    }
+
+    static bool IsTypeBlendable (Type type)
+    {
+        for (int i = 0; i < s_BlendableTypes.Length; i++)
+        {
+            if (type == s_BlendableTypes[i])
+                return true;
+        }
+        return false;
+    }
+
+    static bool IsTypeAssignable (Type type)
+    {
+        for (int i = 0; i < s_AssignableTypes.Length; i++)
+        {
+            if (type == s_AssignableTypes[i] || type.IsEnum)
+                return true;
+        }
+        return false;
+    }
+
+    static bool HasAllowedName (PropertyInfo propertyInfo)
+    {
+        for (int i = 0; i < s_DisallowedPropertyNames.Length; i++)
+        {
+            if (propertyInfo.Name == s_DisallowedPropertyNames[i])
+                return false;
+        }
+        return true;
+    }
+
+    static bool IsObsolete (UsableProperty usableProperty)
+    {
+        if (usableProperty.usablePropertyType == UsableProperty.UsablePropertyType.Field)
+            return Attribute.IsDefined (usableProperty.fieldInfo, typeof(ObsoleteAttribute));
+        return Attribute.IsDefined (usableProperty.propertyInfo, typeof(ObsoleteAttribute));
+    }
+
+    bool VariableListGUI (List<Variable> variables, UsableType[] usableTypes, GUIContent guiContent, string newName)
+    {
+        EditorGUILayout.BeginVertical(GUI.skin.box);
+
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(guiContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+
+        EditorGUILayout.LabelField(guiContent);
+
+        int indexToRemove = -1;
+        bool allNamesValid = true;
+        for (int i = 0; i < variables.Count; i++)
+        {
+            if (variables[i].GUI(usableTypes))
+                indexToRemove = i;
+
+            if (!CodeGenerator.IsValidLanguageIndependentIdentifier(variables[i].name))
+            {
+                allNamesValid = false;
+            }
+        }
+
+        if (indexToRemove != -1)
+            variables.RemoveAt(indexToRemove);
+
+        if (GUILayout.Button("Add", GUILayout.Width(40f)))
+            variables.Add(new Variable(newName, usableTypes[0]));
+
+        if (!allNamesValid)
+            EditorGUILayout.HelpBox("One of the variables has an invalid character, make sure they don't contain any spaces or special characters.", MessageType.Error);
+
+        EditorGUILayout.EndVertical();
+
+        return allNamesValid;
+    }
+
+    bool AllVariablesUniquelyNamed ()
+    {
+        for (int i = 0; i < exposedReferences.Count; i++)
+        {
+            string exposedRefName = exposedReferences[i].name;
+
+            for (int j = 0; j < exposedReferences.Count; j++)
+            {
+                if (i != j && exposedRefName == exposedReferences[j].name)
+                    return false;
+            }
+
+            for (int j = 0; j < playableBehaviourVariables.Count; j++)
+            {
+                if (exposedRefName == playableBehaviourVariables[j].name)
+                    return false;
+            }
+        }
+
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        {
+            string scriptPlayableVariableName = playableBehaviourVariables[i].name;
+
+            for (int j = 0; j < exposedReferences.Count; j++)
+            {
+                if (scriptPlayableVariableName == exposedReferences[j].name)
+                    return false;
+            }
+
+            for (int j = 0; j < playableBehaviourVariables.Count; j++)
+            {
+                if (i != j && scriptPlayableVariableName == playableBehaviourVariables[j].name)
+                    return false;
+            }
+        }
+        return true;
+    }
+
+    void ClipCapsGUI ()
+    {
+        EditorGUILayout.BeginVertical (GUI.skin.box);
+
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox(m_ClipCapsContent.tooltip, MessageType.Info);
+            EditorGUILayout.Space();
+        }
+
+        EditorGUILayout.LabelField (m_ClipCapsContent);
+
+        bool isLooping = (clipCaps & ClipCaps.Looping) == ClipCaps.Looping;
+        bool isExtrapolation = (clipCaps & ClipCaps.Extrapolation) == ClipCaps.Extrapolation;
+        bool isClipIn = (clipCaps & ClipCaps.ClipIn) == ClipCaps.ClipIn;
+        bool isSpeedMultiplier = (clipCaps & ClipCaps.SpeedMultiplier) == ClipCaps.SpeedMultiplier;
+        bool isBlending = (clipCaps & ClipCaps.Blending) == ClipCaps.Blending;
+
+        bool isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
+        bool isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
+
+        EditorGUI.BeginChangeCheck ();
+        isNone = EditorGUILayout.ToggleLeft (m_CCNoneContent, isNone);
+        if (EditorGUI.EndChangeCheck ())
+        {
+            if (isNone)
+            {
+                isLooping = false;
+                isExtrapolation = false;
+                isClipIn = false;
+                isSpeedMultiplier = false;
+                isBlending = false;
+                isAll = false;
+            }
+        }
+
+        EditorGUI.BeginChangeCheck ();
+        isLooping = EditorGUILayout.ToggleLeft (m_CCLoopingContent, isLooping);
+        isExtrapolation = EditorGUILayout.ToggleLeft (m_CCExtrapolationContent, isExtrapolation);
+        isClipIn = EditorGUILayout.ToggleLeft (m_CCClipInContent, isClipIn);
+        isSpeedMultiplier = EditorGUILayout.ToggleLeft (m_CCSpeedMultiplierContent, isSpeedMultiplier);
+        isBlending = EditorGUILayout.ToggleLeft (m_CCBlendingContent, isBlending);
+        if (EditorGUI.EndChangeCheck ())
+        {
+            isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
+            isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
+        }
+
+        EditorGUI.BeginChangeCheck ();
+        isAll = EditorGUILayout.ToggleLeft (m_CCAllContent, isAll);
+        if (EditorGUI.EndChangeCheck ())
+        {
+            if (isAll)
+            {
+                isNone = false;
+                isLooping = true;
+                isExtrapolation = true;
+                isClipIn = true;
+                isSpeedMultiplier = true;
+                isBlending = true;
+            }
+        }
+
+        EditorGUILayout.EndVertical();
+
+        clipCaps = ClipCaps.None;
+
+        if (isNone)
+            return;
+
+        if (isAll)
+        {
+            clipCaps = ClipCaps.All;
+            return;
+        }
+
+        if (isLooping)
+            clipCaps |= ClipCaps.Looping;
+
+        if (isExtrapolation)
+            clipCaps |= ClipCaps.Extrapolation;
+
+        if (isClipIn)
+            clipCaps |= ClipCaps.ClipIn;
+
+        if (isSpeedMultiplier)
+            clipCaps |= ClipCaps.SpeedMultiplier;
+
+        if (isBlending)
+            clipCaps |= ClipCaps.Blending;
+    }
+
+    /*void ClipDefaultsGUI ()
+    {
+        EditorGUILayout.BeginVertical (GUI.skin.box);
+
+        setClipDefaults = EditorGUILayout.Toggle (m_SetClipDefaultsContent, setClipDefaults);
+
+        if (!setClipDefaults)
+        {
+            EditorGUILayout.EndVertical ();
+            return;
+        }
+
+        if (showHelpBoxes)
+        {
+            EditorGUILayout.HelpBox (m_ClipDefaultsContent.tooltip, MessageType.Info);
+        }
+
+        EditorGUILayout.LabelField (m_ClipDefaultsContent);
+
+        EditorGUILayout.Space ();
+
+        EditorGUILayout.LabelField (m_CDClipTimingContent);
+        EditorGUI.indentLevel++;
+        clipDefaultDurationSeconds = EditorGUILayout.FloatField(m_CDDurationContent, clipDefaultDurationSeconds);
+        
+        EditorGUILayout.Space ();
+        
+        clipDefaultEaseInSeconds = EditorGUILayout.FloatField(m_CDEaseInContent, clipDefaultEaseInSeconds);
+        clipDefaultEaseOutSeconds = EditorGUILayout.FloatField (m_CDEaseOutContent, clipDefaultEaseOutSeconds);
+
+        if (isStandardBlendPlayable)
+        {
+            EditorGUILayout.EndVertical();
+            return;
+        }
+
+        EditorGUILayout.Space();
+        
+        clipDefaultClipInSeconds = EditorGUILayout.FloatField(m_CDClipInContent, clipDefaultClipInSeconds);
+        
+        EditorGUILayout.Space();
+        
+        clipDefaultSpeedMultiplier = EditorGUILayout.FloatField(m_CDSpeedMultiplierContent, clipDefaultSpeedMultiplier);
+        EditorGUI.indentLevel--;
+        
+        EditorGUILayout.EndVertical();
+    }*/
+
+    CreationError CreateScripts ()
+    {
+        if (ScriptAlreadyExists(playableName + k_TimelineClipAssetSuffix))
+            return CreationError.PlayableAssetAlreadyExists;
+
+        if (ScriptAlreadyExists(playableName + k_TimelineClipBehaviourSuffix))
+            return CreationError.PlayableBehaviourAlreadyExists;
+
+        if (ScriptAlreadyExists(playableName + k_PlayableBehaviourMixerSuffix))
+            return CreationError.PlayableBehaviourMixerAlreadyExists;
+
+        if (ScriptAlreadyExists(playableName + k_TrackAssetSuffix))
+            return CreationError.TrackAssetAlreadyExists;
+
+        if (m_CreateDrawer && ScriptAlreadyExists(playableName + k_PropertyDrawerSuffix))
+            return CreationError.PlayableDrawerAlreadyExists;
+
+        AssetDatabase.CreateFolder ("Assets", playableName);
+
+        if (isStandardBlendPlayable)
+        {
+            CreateScript (playableName + k_TimelineClipAssetSuffix, StandardBlendPlayableAsset());
+            CreateScript (playableName + k_TimelineClipBehaviourSuffix, StandardBlendPlayableBehaviour ());
+            CreateScript (playableName + k_PlayableBehaviourMixerSuffix, StandardBlendPlayableBehaviourMixer ());
+            CreateScript (playableName + k_TrackAssetSuffix, StandardBlendTrackAssetScript ());
+
+            AssetDatabase.CreateFolder ("Assets/" + playableName, "Editor");
+
+            string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
+            using (StreamWriter writer = File.CreateText (path))
+            {
+                writer.Write (StandardBlendPlayableDrawer ());
+            }
+        }
+        else
+        {
+            CreateScript(playableName + k_TimelineClipAssetSuffix, PlayableAsset());
+            CreateScript(playableName + k_TimelineClipBehaviourSuffix, PlayableBehaviour());
+            CreateScript(playableName + k_PlayableBehaviourMixerSuffix, PlayableBehaviourMixer());
+            CreateScript(playableName + k_TrackAssetSuffix, TrackAssetScript());
+
+            if (m_CreateDrawer)
+            {
+                AssetDatabase.CreateFolder("Assets/" + playableName, "Editor");
+
+                string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
+                using (StreamWriter writer = File.CreateText(path))
+                {
+                    writer.Write(PlayableDrawer());
+                }
+            }
+        }
+
+        AssetDatabase.SaveAssets ();
+        AssetDatabase.Refresh ();
+
+        return CreationError.NoError;
+    }
+
+    static bool ScriptAlreadyExists(string scriptName)
+    {
+        string[] guids = AssetDatabase.FindAssets(scriptName);
+
+        if (guids.Length == 0)
+            return false;
+
+        for (int i = 0; i < guids.Length; i++)
+        {
+            string path = AssetDatabase.GUIDToAssetPath(guids[i]);
+            Type assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
+            if (assetType == typeof(MonoScript))
+                return true;
+        }
+
+        return false;
+    }
+
+    void CreateScript (string fileName, string content)
+    {
+        string path = Application.dataPath + "/" + playableName + "/" + fileName + ".cs";
+        using (StreamWriter writer = File.CreateText (path))
+            writer.Write (content);
+    }
+
+    void ResetWindow ()
+    {
+        playableName = "";
+        isStandardBlendPlayable = false;
+        trackBinding = s_TrackBindingTypes[0];
+        defaultValuesComponent = null;
+        exposedReferences = new List<Variable>();
+        playableBehaviourVariables = new List<Variable>();
+        standardBlendPlayableProperties = new List<UsableProperty>();
+        clipCaps = ClipCaps.None;
+        /*setClipDefaults = false;
+        clipDefaultDurationSeconds = 5f;
+        clipDefaultEaseInSeconds = 0f;
+        clipDefaultEaseOutSeconds = 0f;
+        clipDefaultClipInSeconds = 0f;
+        clipDefaultSpeedMultiplier = 1f;*/
+        trackColor = new Color(0.855f, 0.8623f, 0.870f);
+
+        m_TrackBindingTypeIndex = 0;
+        m_ComponentBindingTypeIndex = 0;
+        m_TrackBindingProperties = null;
+        m_TrackBindingFields = null;
+        m_TrackBindingUsableProperties = null;
+        m_CreateDrawer = false;
+    }
+
+    string TrackAssetScript ()
+    {
+        return 
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() + 
+            "\n" +
+            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
+            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
+            TrackBindingToString () +
+            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
+            "{\n" +
+            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string PlayableAsset ()
+    {
+        return 
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "[Serializable]\n" +
+            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
+            "{\n" +
+            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
+            ExposedReferencesToString () +
+            "\n" +
+            k_Tab + "public ClipCaps clipCaps\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "get { return " + ClipCapsToString () + "; }\n" +
+            k_Tab + "}\n" +
+            "\n" +
+            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
+            ExposedReferencesResolvingToString () +
+            k_Tab + k_Tab + "return playable;\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string PlayableBehaviour ()
+    {
+        return 
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "[Serializable]\n" +
+            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
+            "{\n" +
+            ExposedReferencesAsScriptVariablesToString () +
+            PlayableBehaviourVariablesToString () +
+            "\n" +
+            k_Tab + "public override void OnPlayableCreate (Playable playable)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string PlayableBehaviourMixer ()
+    {
+        return 
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
+            "{\n" +
+            k_Tab + "// NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.\n" +
+            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
+            k_Tab + "{\n" +
+            MixerTrackBindingLocalVariableToString () +
+            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
+            "\n" +
+            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
+            k_Tab + k_Tab + "{\n" +
+            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
+            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
+            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + k_Tab + "// Use the above variables to process each frame of this playable.\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + "}\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string PlayableDrawer ()
+    {
+        return 
+            "using UnityEditor;\n" +
+            "using UnityEngine;\n" +
+            "\n" +
+            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
+            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
+            "{\n" +
+            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "int fieldCount = " + playableBehaviourVariables.Count +";\n" +
+            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
+            k_Tab + "}\n" +
+            "\n" +
+            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "{\n" +
+            ScriptVariablesAsSerializedPropAssignmentToString () +
+            "\n" + 
+            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
+            ScriptVariablesAsSerializedPropGUIToString () +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string TrackBindingToString ()
+    {
+        if (m_TrackBindingTypeIndex != 0)
+            return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
+        return "";
+    }
+
+    string AdditionalNamespacesToString ()
+    {
+        UsableType[] exposedReferenceTypes = Variable.GetUsableTypesFromVariableArray (exposedReferences.ToArray ());
+        UsableType[] behaviourVariableTypes = Variable.GetUsableTypesFromVariableArray (playableBehaviourVariables.ToArray ());
+        UsableType[] allUsedTypes = new UsableType[exposedReferenceTypes.Length + behaviourVariableTypes.Length + 1];
+        for (int i = 0; i < exposedReferenceTypes.Length; i++)
+        {
+            allUsedTypes[i] = exposedReferenceTypes[i];
+        }
+        for (int i = 0; i < behaviourVariableTypes.Length; i++)
+        {
+            allUsedTypes[i + exposedReferenceTypes.Length] = behaviourVariableTypes[i];
+        }
+        allUsedTypes[allUsedTypes.Length - 1] = trackBinding;
+
+        string[] distinctNamespaces = UsableType.GetDistinctAdditionalNamespaces (allUsedTypes).Where (x => !string.IsNullOrEmpty (x)).ToArray ();
+        string returnVal = "";
+        for (int i = 0; i < distinctNamespaces.Length; i++)
+        {
+            returnVal += "using " + distinctNamespaces[i] + ";\n";
+        }
+        return returnVal;
+    }
+
+    string ExposedReferencesToString ()
+    {
+        string expRefText = "";
+        foreach (var expRef in exposedReferences)
+            expRefText += k_Tab + "public ExposedReference<" + expRef.usableType.name + "> " + expRef.name + ";\n";
+        return expRefText;
+    }
+
+    string ExposedReferencesResolvingToString ()
+    {
+        string returnVal = "";
+        returnVal += k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " clone = playable.GetBehaviour ();\n";
+        for (int i = 0; i < exposedReferences.Count; i++)
+        {
+            returnVal += k_Tab + k_Tab + "clone." + exposedReferences[i].name + " = " + exposedReferences[i].name + ".Resolve (graph.GetResolver ());\n";
+        }
+        return returnVal;
+    }
+
+    /*string OnCreateFunctionToString ()
+    {
+        if (!setClipDefaults)
+            return "";
+
+        string returnVal = "\n";
+            returnVal += k_Tab + "public override void OnCreate ()\n";
+            returnVal += k_Tab + "{\n";
+            returnVal += k_Tab + k_Tab + "owner.duration = " + clipDefaultDurationSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.easeInDuration = " + clipDefaultEaseInSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.easeOutDuration = " + clipDefaultEaseOutSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.clipIn = " + clipDefaultClipInSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.timeScale = " + clipDefaultSpeedMultiplier + ";\n";
+            returnVal += k_Tab + "}\n";
+        return returnVal;
+    }*/
+
+    string ClipCapsToString ()
+    {
+        string message = clipCaps.ToString ();
+        string[] splits = message.Split (' ');
+
+        for (int i = 0; i < splits.Length; i++)
+        {
+            if (splits[i][splits[i].Length - 1] == ',')
+                splits[i] = splits[i].Substring (0, splits[i].Length - 1);
+        }
+
+        string returnVal = "";
+
+        for (int i = 0; i < splits.Length; i++)
+        {
+            returnVal += "ClipCaps." + splits[i];
+
+            if (i < splits.Length - 1)
+                returnVal += " | ";
+        }
+
+        return returnVal;
+    }
+
+    string ExposedReferencesAsScriptVariablesToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < exposedReferences.Count; i++)
+        {
+            returnVal += k_Tab + "public " + exposedReferences[i].usableType.name + " " + exposedReferences[i].name + ";\n";
+        }
+        return returnVal;
+    }
+
+    string PlayableBehaviourVariablesToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        {
+            returnVal += k_Tab + "public " + playableBehaviourVariables[i].usableType.name + " " + playableBehaviourVariables[i].name + ";\n";
+        }
+        return returnVal;
+    }
+
+    string MixerTrackBindingLocalVariableToString ()
+    {
+        if (m_TrackBindingTypeIndex != 0)
+            return
+                k_Tab + k_Tab + trackBinding.name + " trackBinding = playerData as " + trackBinding.name + ";\n\n" +
+                k_Tab + k_Tab + "if (!trackBinding)\n" +
+                k_Tab + k_Tab + k_Tab + "return;\n" +
+                "\n";
+        return "";
+    }
+
+    string ScriptVariablesAsSerializedPropAssignmentToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        {
+            returnVal += k_Tab + k_Tab + "SerializedProperty " + playableBehaviourVariables[i].name + "Prop = property.FindPropertyRelative(\"" + playableBehaviourVariables[i].name + "\");\n";
+        }
+        return returnVal;
+    }
+
+    string ScriptVariablesAsSerializedPropGUIToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        {
+            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + playableBehaviourVariables[i].name + "Prop);\n";
+
+            if (i < playableBehaviourVariables.Count - 1)
+            {
+                returnVal += "\n";
+                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
+            }
+        }
+        return returnVal;
+    }
+
+    string StandardBlendPlayableAsset ()
+    {
+        return
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            "\n" +
+            "[Serializable]\n" +
+            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
+            "{\n" +
+            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
+            "\n" +
+            k_Tab + "public ClipCaps clipCaps\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "get { return ClipCaps.Blending; }\n" +
+            k_Tab + "}\n" +
+            "\n" +
+            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
+            k_Tab + k_Tab + "return playable;\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string StandardBlendPlayableBehaviour ()
+    {
+        return
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "[Serializable]\n" +
+            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
+            "{\n" +
+            StandardBlendScriptPlayablePropertiesToString () +
+            "}\n";
+    }
+
+    string StandardBlendPlayableBehaviourMixer ()
+    {
+        return
+            "using System;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
+            "{\n" +
+            StandardBlendTrackBindingPropertiesDefaultsDeclarationToString () +
+            "\n" +
+            StandardBlendTrackBindingPropertiesBlendedDeclarationToString () +
+            "\n" +
+            k_Tab + trackBinding.name + " m_TrackBinding;\n" +
+            "\n" +
+            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "m_TrackBinding = playerData as " + trackBinding.name + ";\n" +
+            "\n" +
+            k_Tab + k_Tab + "if (m_TrackBinding == null)\n" +
+            k_Tab + k_Tab + k_Tab + "return;\n" +
+            "\n" +
+            StandardBlendTrackBindingPropertiesDefaultsAssignmentToString () +
+            "\n" +
+            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
+            "\n" +
+            StandardBlendBlendedVariablesCreationToString () +
+            k_Tab + k_Tab + "float totalWeight = 0f;\n" +
+            k_Tab + k_Tab + "float greatestWeight = 0f;\n" +
+            StandardBlendPlayableCurrentInputsDeclarationToString () +
+            "\n" +
+            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
+            k_Tab + k_Tab + "{\n" +
+            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
+            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
+            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
+            StandardBlendBlendedVariablesWeightedIncrementationToString () +
+            k_Tab + k_Tab + k_Tab + "totalWeight += inputWeight;\n" +
+            "\n" +
+            StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString () +
+            StandardBlendPlayableCurrentInputIterationToString () + 
+            k_Tab + k_Tab + "}\n" +
+            StandardBlendTrackBindingPropertiesBlendedAssignmentToString () +
+            StandardBlendTrackBindingPropertiesAssignableAssignmentToString () +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+
+    string StandardBlendTrackAssetScript ()
+    {
+        return
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Timeline;\n" +
+            "using System.Collections.Generic;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
+            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
+            StandardBlendComponentBindingToString () +
+            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
+            "{\n" +
+            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
+            k_Tab + "}\n" +
+            "\n" +
+            k_Tab + "// Please note this assumes only one component of type " + trackBinding.name + " on the same gameobject.\n" +
+            k_Tab + "public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)\n" +
+            k_Tab + "{\n" +
+            "#if UNITY_EDITOR\n" +
+            k_Tab + k_Tab + trackBinding.name + " trackBinding = director.GetGenericBinding(this) as " + trackBinding.name + ";\n" +
+            k_Tab + k_Tab + "if (trackBinding == null)\n" +
+            k_Tab + k_Tab + k_Tab + "return;\n" +
+            "\n" +
+            //k_Tab + k_Tab + "var serializedObject = new UnityEditor.SerializedObject (trackBinding);\n" +
+            //k_Tab + k_Tab + "var iterator = serializedObject.GetIterator();\n" +
+            //k_Tab + k_Tab + "while (iterator.NextVisible(true))\n" +
+            //k_Tab + k_Tab + "{\n" +
+            //k_Tab + k_Tab + k_Tab + "if (iterator.hasVisibleChildren)\n" +
+            //k_Tab + k_Tab + k_Tab + k_Tab + "continue;\n" +
+            //"\n" +
+            //k_Tab + k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, iterator.propertyPath);\n" +
+            //k_Tab + k_Tab + "}\n" +
+            StandardBlendPropertiesAssignedToPropertyDriverToString () +
+            "#endif\n" +
+            k_Tab + k_Tab + "base.GatherProperties (director, driver);\n" +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+    
+    string StandardBlendPlayableDrawer ()
+    {
+        return
+            "using UnityEditor;\n" +
+            "using UnityEngine;\n" +
+            "using UnityEngine.Playables;\n" +
+            AdditionalNamespacesToString() +
+            "\n" +
+            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
+            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
+            "{\n" +
+            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "{\n" +
+            k_Tab + k_Tab + "int fieldCount = " + standardBlendPlayableProperties.Count + ";\n" +
+            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
+            k_Tab + "}\n" +
+            "\n" +
+            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "{\n" +
+            StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString () +
+            "\n" +
+            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
+            StandardBlendSerializedPropertyGUIToString () +
+            k_Tab + "}\n" +
+            "}\n";
+    }
+    
+    string StandardBlendScriptPlayablePropertiesToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            if(prop.defaultValue == "")
+                returnVal += k_Tab + "public " + prop.type + " " + prop.name + ";\n";
+            else
+            {
+                returnVal += k_Tab + "public " + prop.type + " " + prop.name + " = " + prop.defaultValue + ";\n";
+            }
+        }
+        return returnVal;
+    }
+
+    string StandardBlendTrackBindingPropertiesDefaultsDeclarationToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateDefault + ";\n";
+        }
+        return returnVal;
+    }
+
+    string StandardBlendTrackBindingPropertiesBlendedDeclarationToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            
+            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateAssigned + ";\n";
+        }
+        return returnVal;
+    }
+
+    string StandardBlendTrackBindingPropertiesDefaultsAssignmentToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+
+            switch (prop.type)
+            {
+                case "float":
+                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately(m_TrackBinding." + prop.name + ", " + prop.NameAsPrivateAssigned + "))\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    break;
+                case "double":
+                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately((float)m_TrackBinding." + prop.name + ", (float)" + prop.NameAsPrivateAssigned + "))\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    break;
+                default:
+                    returnVal += k_Tab + k_Tab + "if (m_TrackBinding." + prop.name + " != " + prop.NameAsPrivateAssigned + ")\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    break;
+            }
+        }
+        return returnVal;
+    }
+
+    string StandardBlendBlendedVariablesCreationToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            
+            if(prop.usability != UsableProperty.Usability.Blendable)
+                continue;
+            
+            string type = prop.type == "int" ? "float" : prop.type;
+            string zeroVal = prop.type == "int" ? "0f" : prop.ZeroValueAsString ();
+            returnVal += k_Tab + k_Tab + type + " " + prop.NameAsLocalBlended + " = " + zeroVal + ";\n";
+        }
+        return returnVal;
+    }
+
+    string StandardBlendPlayableCurrentInputsDeclarationToString ()
+    {
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        {
+            return k_Tab + k_Tab + "int currentInputs = 0;\n";
+        }
+        return "";
+    }
+
+    string StandardBlendBlendedVariablesWeightedIncrementationToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            
+            if (prop.usability == UsableProperty.Usability.Blendable)
+                returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsLocalBlended + " += input." + prop.name + " * inputWeight;\n";
+            
+        }
+        return returnVal;
+    }
+
+    string StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString ()
+    {
+        if (standardBlendPlayableProperties.Count == 0)
+            return "";
+
+        string returnVal = k_Tab + k_Tab + k_Tab + "if (inputWeight > greatestWeight)\n";
+        returnVal += k_Tab + k_Tab + k_Tab + "{\n";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            if (prop.usability == UsableProperty.Usability.Assignable)
+            {
+                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = input." + prop.name + ";\n";
+                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
+            }
+        }
+        returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "greatestWeight = inputWeight;\n";
+        returnVal += k_Tab + k_Tab + k_Tab + "}\n";
+        return returnVal;
+    }
+
+    string StandardBlendPlayableCurrentInputIterationToString ()
+    {
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        {
+            string returnVal = "\n";
+            returnVal += k_Tab + k_Tab + k_Tab + "if (!Mathf.Approximately (inputWeight, 0f))\n";
+            returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "currentInputs++;\n";
+            return returnVal;
+        }
+        return "";
+    }
+
+    string StandardBlendTrackBindingPropertiesBlendedAssignmentToString ()
+    {
+        string returnVal = "";
+        bool firstNewLine = false;
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            if (prop.usability != UsableProperty.Usability.Blendable)
+                continue;
+
+            if (!firstNewLine)
+            {
+                firstNewLine = true;
+                returnVal += "\n";
+            }
+            
+            if (prop.type == "int")
+                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = Mathf.RoundToInt (" + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight));\n";
+            else
+                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = " + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight);\n";
+
+            returnVal += k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
+        }
+        return returnVal;
+    }
+
+    string StandardBlendTrackBindingPropertiesAssignableAssignmentToString ()
+    {
+        if (standardBlendPlayableProperties.Count == 0)
+            return "";
+
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        {
+            string returnVal = "\n" + k_Tab + k_Tab + "if (currentInputs != 1 && 1f - totalWeight > greatestWeight)\n";
+            returnVal += k_Tab + k_Tab + "{\n";
+            for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+            {
+                UsableProperty prop = standardBlendPlayableProperties[i];
+                if (prop.usability != UsableProperty.Usability.Assignable)
+                    continue;
+
+                returnVal += k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateDefault + ";\n";
+            }
+            returnVal += k_Tab + k_Tab + "}\n";
+            return returnVal;
+        }
+
+        return "";
+    }
+
+    string StandardBlendComponentBindingToString ()
+    {
+        return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
+    }
+
+    string StandardBlendPropertiesAssignedToPropertyDriverToString ()
+    {
+        if (standardBlendPlayableProperties.Count == 0)
+            return "";
+
+        string returnVal = k_Tab + k_Tab + "// These field names are procedurally generated estimations based on the associated property names.\n";
+        returnVal += k_Tab + k_Tab + "// If any of the names are incorrect you will get a DrivenPropertyManager error saying it has failed to register the name.\n";
+        returnVal += k_Tab + k_Tab + "// In this case you will need to find the correct backing field name.\n";
+        returnVal += k_Tab + k_Tab + "// The suggested way of finding the field name is to:\n";
+        returnVal += k_Tab + k_Tab + "// 1. Make sure your scene is serialized to text.\n";
+        returnVal += k_Tab + k_Tab + "// 2. Search the text for the track binding component type.\n";
+        returnVal += k_Tab + k_Tab + "// 3. Look through the field names until you see one that looks correct.\n";
+
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+
+            if (prop.usablePropertyType == UsableProperty.UsablePropertyType.Field)
+            {
+                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.name + "\");\n";
+            }
+            else
+            {
+                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.NameAsPrivate + "\");\n";
+            }
+        }
+
+        return returnVal;
+    }
+
+    string StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            UsableProperty prop = standardBlendPlayableProperties[i];
+            returnVal += k_Tab + k_Tab + "SerializedProperty " + prop.NameAsLocalSerializedProperty + " = property.FindPropertyRelative(\"" + prop.name + "\");\n";
+        }
+        return returnVal;
+    }
+
+    string StandardBlendSerializedPropertyGUIToString ()
+    {
+        string returnVal = "";
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        {
+            if (i != 0)
+            {
+                returnVal += "\n";
+                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
+            }
+
+            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + standardBlendPlayableProperties[i].NameAsLocalSerializedProperty + ");\n";
+        }
+        return returnVal;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 01cfeabdfa5f36740b2b9c9658bbb29e
+timeCreated: 1490191896
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/LightControl.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 5f5e3cf7f402b7b40894a67f55fad9ce
+folderAsset: yes
+timeCreated: 1496914998
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/LightControl/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 01cfda49307e46248bd868ab09d47ace
+folderAsset: yes
+timeCreated: 1496915000
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 33 - 0
Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs

@@ -0,0 +1,33 @@
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Playables;
+
+[CustomPropertyDrawer(typeof(LightControlBehaviour))]
+public class LightControlDrawer : PropertyDrawer
+{
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    {
+        int fieldCount = 4;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
+    }
+
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    {
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
+        SerializedProperty intensityProp = property.FindPropertyRelative("intensity");
+        SerializedProperty bounceIntensityProp = property.FindPropertyRelative("bounceIntensity");
+        SerializedProperty rangeProp = property.FindPropertyRelative("range");
+
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
+        
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, intensityProp);
+        
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, bounceIntensityProp);
+        
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, rangeProp);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a217f65052ddf094ba45e737b2428b1c
+timeCreated: 1496915002
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 13 - 0
Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs

@@ -0,0 +1,13 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class LightControlBehaviour : PlayableBehaviour
+{
+    public Color color = Color.white;
+    public float intensity = 1f;
+    public float bounceIntensity = 1f;
+    public float range = 10f;
+}

+ 12 - 0
Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7e7c747bf1731824682c539494feba37
+timeCreated: 1496915002
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Assets/DefaultPlayables/LightControl/LightControlClip.cs

@@ -0,0 +1,20 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class LightControlClip : PlayableAsset, ITimelineClipAsset
+{
+    public LightControlBehaviour template = new LightControlBehaviour ();
+
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.Blending; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<LightControlBehaviour>.Create (graph, template);
+        return playable;    }
+}

+ 12 - 0
Assets/DefaultPlayables/LightControl/LightControlClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 23b46759ef7b0fd4bb74d73bf4d2839b
+timeCreated: 1496915002
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 81 - 0
Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs

@@ -0,0 +1,81 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+public class LightControlMixerBehaviour : PlayableBehaviour
+{
+    Color m_DefaultColor;
+    float m_DefaultIntensity;
+    float m_DefaultBounceIntensity;
+    float m_DefaultRange;
+
+    Light m_TrackBinding;
+    bool m_FirstFrameHappened;
+
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        m_TrackBinding = playerData as Light;
+
+        if (m_TrackBinding == null)
+            return;
+
+        if (!m_FirstFrameHappened)
+        {
+            m_DefaultColor = m_TrackBinding.color;
+            m_DefaultIntensity = m_TrackBinding.intensity;
+            m_DefaultBounceIntensity = m_TrackBinding.bounceIntensity;
+            m_DefaultRange = m_TrackBinding.range;
+            m_FirstFrameHappened = true;
+        }
+
+        int inputCount = playable.GetInputCount ();
+
+        Color blendedColor = Color.clear;
+        float blendedIntensity = 0f;
+        float blendedBounceIntensity = 0f;
+        float blendedRange = 0f;
+        float totalWeight = 0f;
+        float greatestWeight = 0f;
+        int currentInputs = 0;
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            float inputWeight = playable.GetInputWeight(i);
+            ScriptPlayable<LightControlBehaviour> inputPlayable = (ScriptPlayable<LightControlBehaviour>)playable.GetInput(i);
+            LightControlBehaviour input = inputPlayable.GetBehaviour ();
+            
+            blendedColor += input.color * inputWeight;
+            blendedIntensity += input.intensity * inputWeight;
+            blendedBounceIntensity += input.bounceIntensity * inputWeight;
+            blendedRange += input.range * inputWeight;
+            totalWeight += inputWeight;
+
+            if (inputWeight > greatestWeight)
+            {
+                greatestWeight = inputWeight;
+            }
+
+            if (!Mathf.Approximately (inputWeight, 0f))
+                currentInputs++;
+        }
+
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+        m_TrackBinding.intensity = blendedIntensity + m_DefaultIntensity * (1f - totalWeight);
+        m_TrackBinding.bounceIntensity = blendedBounceIntensity + m_DefaultBounceIntensity * (1f - totalWeight);
+        m_TrackBinding.range = blendedRange + m_DefaultRange * (1f - totalWeight);
+    }
+
+    public override void OnPlayableDestroy (Playable playable)
+    {
+        m_FirstFrameHappened = false;
+
+        if(m_TrackBinding == null)
+            return;
+
+        m_TrackBinding.color = m_DefaultColor;
+        m_TrackBinding.intensity = m_DefaultIntensity;
+        m_TrackBinding.bounceIntensity = m_DefaultBounceIntensity;
+        m_TrackBinding.range = m_DefaultRange;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b6ddd7db188548f49bf8d55102e62b63
+timeCreated: 1496915002
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 29 - 0
Assets/DefaultPlayables/LightControl/LightControlTrack.cs

@@ -0,0 +1,29 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using System.Collections.Generic;
+
+[TrackColor(0.9454092f, 0.9779412f, 0.3883002f)]
+[TrackClipType(typeof(LightControlClip))]
+[TrackBindingType(typeof(Light))]
+public class LightControlTrack : TrackAsset
+{
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    {
+        return ScriptPlayable<LightControlMixerBehaviour>.Create (graph, inputCount);
+    }
+
+    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
+    {
+#if UNITY_EDITOR
+       Light trackBinding = director.GetGenericBinding(this) as Light;
+       if (trackBinding == null)
+           return;
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Color");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Intensity");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Range");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_BounceIntensity");
+#endif
+        base.GatherProperties(director, driver);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/LightControl/LightControlTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e97b7684a1a63ed42afa5e89e962140f
+timeCreated: 1496915002
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/NavMeshAgentControl.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 93b4d74e1158a4d48914db94fc4e87c9
+folderAsset: yes
+timeCreated: 1492603101
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs

@@ -0,0 +1,16 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class NavMeshAgentControlBehaviour : PlayableBehaviour
+{
+    public Transform destination;
+    public bool destinationSet;
+
+    public override void OnPlayableCreate (Playable playable)
+    {
+        destinationSet = false;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 05bbdc6a3b254694e8d1e2d9d55cd256
+timeCreated: 1492603101
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 25 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs

@@ -0,0 +1,25 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class NavMeshAgentControlClip : PlayableAsset, ITimelineClipAsset
+{
+    public ExposedReference<Transform> destination;
+    [HideInInspector]
+    public NavMeshAgentControlBehaviour template = new NavMeshAgentControlBehaviour ();
+
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.None; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<NavMeshAgentControlBehaviour>.Create (graph, template);
+        NavMeshAgentControlBehaviour clone = playable.GetBehaviour ();
+        clone.destination = destination.Resolve (graph.GetResolver ());
+        return playable;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cfedc374dca69334db907af09ba5c404
+timeCreated: 1492603101
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 34 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs

@@ -0,0 +1,34 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.AI;
+
+public class NavMeshAgentControlMixerBehaviour : PlayableBehaviour
+{
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        NavMeshAgent trackBinding = playerData as NavMeshAgent;
+
+        if (!trackBinding)
+            return;
+
+        int inputCount = playable.GetInputCount();
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            float inputWeight = playable.GetInputWeight(i);
+            ScriptPlayable<NavMeshAgentControlBehaviour> inputPlayable = (ScriptPlayable<NavMeshAgentControlBehaviour>)playable.GetInput(i);
+            NavMeshAgentControlBehaviour input = inputPlayable.GetBehaviour();
+
+            if (inputWeight > 0.5f && !input.destinationSet && input.destination)
+            {
+                if (!trackBinding.isOnNavMesh)
+                    continue;
+
+                trackBinding.SetDestination (input.destination.position);
+                input.destinationSet = true;
+            }
+        }
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a3805dde487857b41b2fff7d26f06f1e
+timeCreated: 1492603101
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 15 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs

@@ -0,0 +1,15 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.AI;
+
+[TrackColor(0.855f, 0.8623f, 0.87f)]
+[TrackClipType(typeof(NavMeshAgentControlClip))]
+[TrackBindingType(typeof(NavMeshAgent))]
+public class NavMeshAgentControlTrack : TrackAsset
+{
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    {
+        return ScriptPlayable<NavMeshAgentControlMixerBehaviour>.Create (graph, inputCount);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d201ca921ed322e418c25df03740a308
+timeCreated: 1492603101
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/ScreenFader.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1482b2b9e18dc0a43baf3c92d0cd7156
+folderAsset: yes
+timeCreated: 1496916559
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/ScreenFader/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b53f46f9af38aef4c8014c759eae0bd9
+folderAsset: yes
+timeCreated: 1496916561
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 22 - 0
Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs

@@ -0,0 +1,22 @@
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.UI;
+
+[CustomPropertyDrawer(typeof(ScreenFaderBehaviour))]
+public class ScreenFaderDrawer : PropertyDrawer
+{
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    {
+        int fieldCount = 1;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
+    }
+
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    {
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
+
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7075b31fb4bae504f8480419ce90246f
+timeCreated: 1496916563
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 11 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs

@@ -0,0 +1,11 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.UI;
+
+[Serializable]
+public class ScreenFaderBehaviour : PlayableBehaviour
+{
+    public Color color = Color.black;
+}

+ 12 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4cf88cabc4dadeb4fafeefdbc61869ca
+timeCreated: 1496916563
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs

@@ -0,0 +1,20 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class ScreenFaderClip : PlayableAsset, ITimelineClipAsset
+{
+    public ScreenFaderBehaviour template = new ScreenFaderBehaviour ();
+
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.Blending; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<ScreenFaderBehaviour>.Create (graph, template);
+        return playable;    }
+}

+ 12 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0445258a5c40b364ab21547784905327
+timeCreated: 1496916563
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 64 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs

@@ -0,0 +1,64 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.UI;
+
+public class ScreenFaderMixerBehaviour : PlayableBehaviour
+{
+    Color m_DefaultColor;
+
+    Image m_TrackBinding;
+    bool m_FirstFrameHappened;
+
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        m_TrackBinding = playerData as Image;
+
+        if (m_TrackBinding == null)
+            return;
+
+        if (!m_FirstFrameHappened)
+        {
+            m_DefaultColor = m_TrackBinding.color;
+            m_FirstFrameHappened = true;
+        }
+
+        int inputCount = playable.GetInputCount ();
+
+        Color blendedColor = Color.clear;
+        float totalWeight = 0f;
+        float greatestWeight = 0f;
+        int currentInputs = 0;
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            float inputWeight = playable.GetInputWeight(i);
+            ScriptPlayable<ScreenFaderBehaviour> inputPlayable = (ScriptPlayable<ScreenFaderBehaviour>)playable.GetInput(i);
+            ScreenFaderBehaviour input = inputPlayable.GetBehaviour ();
+            
+            blendedColor += input.color * inputWeight;
+            totalWeight += inputWeight;
+
+            if (inputWeight > greatestWeight)
+            {
+                greatestWeight = inputWeight;
+            }
+
+            if (!Mathf.Approximately (inputWeight, 0f))
+                currentInputs++;
+        }
+
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+    }
+
+    public override void OnPlayableDestroy (Playable playable)
+    {
+        m_FirstFrameHappened = false;
+
+        if (m_TrackBinding == null)
+            return;
+
+        m_TrackBinding.color = m_DefaultColor;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 88173aff48b4ccb429d83dca32d03a86
+timeCreated: 1496916563
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 36 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs

@@ -0,0 +1,36 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using System.Collections.Generic;
+using UnityEngine.UI;
+
+[TrackColor(0.875f, 0.5944853f, 0.1737132f)]
+[TrackClipType(typeof(ScreenFaderClip))]
+[TrackBindingType(typeof(Image))]
+public class ScreenFaderTrack : TrackAsset
+{
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    {
+        return ScriptPlayable<ScreenFaderMixerBehaviour>.Create (graph, inputCount);
+    }
+
+    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
+    {
+#if UNITY_EDITOR
+        Image trackBinding = director.GetGenericBinding(this) as Image;
+        if (trackBinding == null)
+            return;
+
+        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
+        var iterator = serializedObject.GetIterator();
+        while (iterator.NextVisible(true))
+        {
+            if (iterator.hasVisibleChildren)
+                continue;
+
+            driver.AddFromName<Image>(trackBinding.gameObject, iterator.propertyPath);
+        }
+#endif
+        base.GatherProperties (director, driver);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6a8190b9dc143d64ab3322e49af85f7b
+timeCreated: 1496916563
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TextSwitcher.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2d691e3fbd7f57c4d81cf41595ca9cc7
+folderAsset: yes
+timeCreated: 1496915575
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TextSwitcher/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b912234a0cf57714d8cec5d0a338786d
+folderAsset: yes
+timeCreated: 1496915577
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 30 - 0
Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs

@@ -0,0 +1,30 @@
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.UI;
+
+[CustomPropertyDrawer(typeof(TextSwitcherBehaviour))]
+public class TextSwitcherDrawer : PropertyDrawer
+{
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    {
+        int fieldCount = 3;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
+    }
+
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    {
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
+        SerializedProperty fontSizeProp = property.FindPropertyRelative("fontSize");
+        SerializedProperty textProp = property.FindPropertyRelative("text");
+
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
+
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, fontSizeProp);
+
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, textProp);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d10fec9d6fdea024293153308aa74ef7
+timeCreated: 1496915579
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 13 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs

@@ -0,0 +1,13 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.UI;
+
+[Serializable]
+public class TextSwitcherBehaviour : PlayableBehaviour
+{
+    public Color color = Color.white;
+    public int fontSize = 14;
+    public string text;
+}

+ 12 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6480896635305a7418e42ec32d3c64d3
+timeCreated: 1496915579
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs

@@ -0,0 +1,20 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class TextSwitcherClip : PlayableAsset, ITimelineClipAsset
+{
+    public TextSwitcherBehaviour template = new TextSwitcherBehaviour ();
+
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.Blending; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<TextSwitcherBehaviour>.Create (graph, template);
+        return playable;    }
+}

+ 12 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d4d683f551d33a84db12bb6fa65573f9
+timeCreated: 1496915579
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 78 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs

@@ -0,0 +1,78 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using UnityEngine.UI;
+
+public class TextSwitcherMixerBehaviour : PlayableBehaviour
+{
+    Color m_DefaultColor;
+    int m_DefaultFontSize;
+    string m_DefaultText;
+
+    Text m_TrackBinding;
+    bool m_FirstFrameHappened;
+
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        m_TrackBinding = playerData as Text;
+
+        if (m_TrackBinding == null)
+            return;
+
+        if (!m_FirstFrameHappened)
+        {
+            m_DefaultColor = m_TrackBinding.color;
+            m_DefaultFontSize = m_TrackBinding.fontSize;
+            m_DefaultText = m_TrackBinding.text;
+            m_FirstFrameHappened = true;
+        }
+
+        int inputCount = playable.GetInputCount ();
+
+        Color blendedColor = Color.clear;
+        float blendedFontSize = 0f;
+        float totalWeight = 0f;
+        float greatestWeight = 0f;
+        int currentInputs = 0;
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            float inputWeight = playable.GetInputWeight(i);
+            ScriptPlayable<TextSwitcherBehaviour> inputPlayable = (ScriptPlayable<TextSwitcherBehaviour>)playable.GetInput(i);
+            TextSwitcherBehaviour input = inputPlayable.GetBehaviour ();
+            
+            blendedColor += input.color * inputWeight;
+            blendedFontSize += input.fontSize * inputWeight;
+            totalWeight += inputWeight;
+
+            if (inputWeight > greatestWeight)
+            {
+                m_TrackBinding.text = input.text;
+                greatestWeight = inputWeight;
+            }
+
+            if (!Mathf.Approximately (inputWeight, 0f))
+                currentInputs++;
+        }
+
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+        m_TrackBinding.fontSize = Mathf.RoundToInt (blendedFontSize + m_DefaultFontSize * (1f - totalWeight));
+        if (currentInputs != 1 && 1f - totalWeight > greatestWeight)
+        {
+            m_TrackBinding.text = m_DefaultText;
+        }
+    }
+
+    public override void OnPlayableDestroy (Playable playable)
+    {
+        m_FirstFrameHappened = false;
+
+        if (m_TrackBinding == null)
+            return;
+
+        m_TrackBinding.color = m_DefaultColor;
+        m_TrackBinding.fontSize = m_DefaultFontSize;
+        m_TrackBinding.text = m_DefaultText;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8a4266a3acde3c24e995780329819997
+timeCreated: 1496915579
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 36 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs

@@ -0,0 +1,36 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+using System.Collections.Generic;
+using UnityEngine.UI;
+
+[TrackColor(0.1394896f, 0.4411765f, 0.3413077f)]
+[TrackClipType(typeof(TextSwitcherClip))]
+[TrackBindingType(typeof(Text))]
+public class TextSwitcherTrack : TrackAsset
+{
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    {
+        return ScriptPlayable<TextSwitcherMixerBehaviour>.Create (graph, inputCount);
+    }
+
+    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
+    {
+#if UNITY_EDITOR
+        Text trackBinding = director.GetGenericBinding(this) as Text;
+        if (trackBinding == null)
+            return;
+
+        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
+        var iterator = serializedObject.GetIterator();
+        while (iterator.NextVisible(true))
+        {
+            if (iterator.hasVisibleChildren)
+                continue;
+
+            driver.AddFromName<Text>(trackBinding.gameObject, iterator.propertyPath);
+        }
+#endif
+        base.GatherProperties (director, driver);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 73211584ea373f3409e0a7a83d711aef
+timeCreated: 1496915579
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TimeDilation.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8ee2af8470937c74ebb226b59fab0f6c
+folderAsset: yes
+timeCreated: 1491318587
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TimeDilation/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d5d00dcf58e5bec4888a9be9ecf3d1b4
+folderAsset: yes
+timeCreated: 1491318587
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs

@@ -0,0 +1,20 @@
+using UnityEditor;
+using UnityEngine;
+
+[CustomPropertyDrawer(typeof(TimeDilationBehaviour))]
+public class TimeDilationDrawer : PropertyDrawer
+{
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    {
+        int fieldCount = 1;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
+    }
+
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    {
+        SerializedProperty timeScaleProp = property.FindPropertyRelative("timeScale");
+
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        EditorGUI.PropertyField(singleFieldRect, timeScaleProp);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 96853521ef6ea974d96cf7ef72f7c6a7
+timeCreated: 1491318587
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 10 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs

@@ -0,0 +1,10 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class TimeDilationBehaviour : PlayableBehaviour
+{
+    public float timeScale = 1f;
+}

+ 12 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a0b944926d9e8514d892737116110502
+timeCreated: 1491318587
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 21 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs

@@ -0,0 +1,21 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class TimeDilationClip : PlayableAsset, ITimelineClipAsset
+{
+    public TimeDilationBehaviour template = new TimeDilationBehaviour ();
+
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.Extrapolation | ClipCaps.Blending; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<TimeDilationBehaviour>.Create (graph, template);
+        return playable;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: eed9a3f59ff436340b05ff8248f0d998
+timeCreated: 1491318587
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 41 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs

@@ -0,0 +1,41 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+public class TimeDilationMixerBehaviour : PlayableBehaviour
+{
+    float m_OldTimeScale = 1f;
+
+    public override void OnPlayableCreate (Playable playable)
+    {
+        m_OldTimeScale = Time.timeScale;
+    }
+
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        int inputCount = playable.GetInputCount ();
+
+        float mixedTimeScale = 0f;
+        float totalWeight = 0f;
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            float inputWeight = playable.GetInputWeight(i);
+
+            totalWeight += inputWeight;
+
+            ScriptPlayable<TimeDilationBehaviour> playableInput = (ScriptPlayable<TimeDilationBehaviour>)playable.GetInput (i);
+            TimeDilationBehaviour input = playableInput.GetBehaviour ();
+
+            mixedTimeScale += inputWeight * input.timeScale;
+        }
+
+        Time.timeScale = mixedTimeScale + m_OldTimeScale * (1f - totalWeight);
+    }
+
+    public override void OnPlayableDestroy (Playable playable)
+    {
+        Time.timeScale = m_OldTimeScale;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 64af3ceaf545d3341b852718827f2b64
+timeCreated: 1491318587
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 13 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs

@@ -0,0 +1,13 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[TrackColor(0.855f, 0.8623f, 0.87f)]
+[TrackClipType(typeof(TimeDilationClip))]
+public class TimeDilationTrack : TrackAsset
+{
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    {
+        return ScriptPlayable<TimeDilationMixerBehaviour>.Create (graph, inputCount);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0282fd402247fd34eb165b280236e58a
+timeCreated: 1491318587
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TransformTween.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 770abf86f6667884f903a5e1966bc2f9
+folderAsset: yes
+timeCreated: 1489416105
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/TransformTween/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4c560c903bbc7d84089ed5183276f9c5
+folderAsset: yes
+timeCreated: 1489676106
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 44 - 0
Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs

@@ -0,0 +1,44 @@
+using UnityEngine;
+using UnityEditor;
+
+[CustomPropertyDrawer(typeof(TransformTweenBehaviour))]
+public class TransformTweenDrawer : PropertyDrawer
+{
+    GUIContent m_TweenPositionContent = new GUIContent("Tween Position", "This should be true if the transformToMove to change position.  This causes recalulations each frame which are more CPU intensive.");
+    GUIContent m_TweenRotationContent = new GUIContent("Tween Rotation", "This should be true if the transformToMove to change rotation.");
+    GUIContent m_TweenTypeContent = new GUIContent("Tween Type", "Linear - the transform moves the same amount each frame (assuming static start and end locations).\n"
+        + "Deceleration - the transform moves slower the closer to the end location it is.\n"
+        + "Harmonic - the transform moves faster in the middle of its tween.\n"
+        + "Custom - uses the customStartingSpeed and customEndingSpeed to create a curve for the desired tween.");
+    GUIContent m_CustomCurveContent = new GUIContent("Custom Curve", "This should be a normalised curve (between 0,0 and 1,1) that represents how the tweening object accelerates at different points along the clip.");
+
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    {
+        int fieldCount = property.FindPropertyRelative ("tweenType").enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom ? 5 : 3;
+        return fieldCount * (EditorGUIUtility.singleLineHeight);
+    }
+
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    {
+        SerializedProperty tweenPositionProp = property.FindPropertyRelative ("tweenPosition");
+        SerializedProperty tweenRotationProp = property.FindPropertyRelative("tweenRotation");
+        SerializedProperty tweenTypeProp = property.FindPropertyRelative ("tweenType");
+        
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        EditorGUI.PropertyField (singleFieldRect, tweenPositionProp, m_TweenPositionContent);
+        
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField (singleFieldRect, tweenRotationProp, m_TweenRotationContent);
+
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        EditorGUI.PropertyField(singleFieldRect, tweenTypeProp, m_TweenTypeContent);
+
+        if (tweenTypeProp.enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom)
+        {
+            SerializedProperty customCurveProp = property.FindPropertyRelative ("customCurve");
+            
+            singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+            EditorGUI.PropertyField (singleFieldRect, customCurveProp, m_CustomCurveContent);
+        }
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d4c9e800b8d9b3344850b4b658de699d
+timeCreated: 1491229652
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 81 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs

@@ -0,0 +1,81 @@
+using System;
+using JetBrains.Annotations;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class TransformTweenBehaviour : PlayableBehaviour
+{
+    public enum TweenType
+    {
+        Linear,
+        Deceleration,
+        Harmonic,
+        Custom,
+    }
+
+    public Transform startLocation;
+    public Transform endLocation;
+    public bool tweenPosition = true;
+    public bool tweenRotation = true;
+    public TweenType tweenType;
+    public AnimationCurve customCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
+    
+    public Vector3 startingPosition;
+    public Quaternion startingRotation = Quaternion.identity;
+
+    AnimationCurve m_LinearCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
+    AnimationCurve m_DecelerationCurve = new AnimationCurve
+    (
+        new Keyframe(0f, 0f, -k_RightAngleInRads, k_RightAngleInRads),
+        new Keyframe(1f, 1f, 0f, 0f)
+    );
+    AnimationCurve m_HarmonicCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
+
+    const float k_RightAngleInRads = Mathf.PI * 0.5f;
+
+    public override void PrepareFrame (Playable playable, FrameData info)
+    {
+        if (startLocation)
+        {
+            startingPosition = startLocation.position;
+            startingRotation = startLocation.rotation;
+        }
+    }
+
+    public float EvaluateCurrentCurve (float time)
+    {
+        if (tweenType == TweenType.Custom && !IsCustomCurveNormalised ())
+        {
+            Debug.LogError("Custom Curve is not normalised.  Curve must start at 0,0 and end at 1,1.");
+            return 0f;
+        }
+        
+        switch (tweenType)
+        {
+            case TweenType.Linear:
+                return m_LinearCurve.Evaluate (time);
+            case TweenType.Deceleration:
+                return m_DecelerationCurve.Evaluate (time);
+            case TweenType.Harmonic:
+                return m_HarmonicCurve.Evaluate (time);
+            default:
+                return customCurve.Evaluate (time);
+        }
+    }
+
+    bool IsCustomCurveNormalised ()
+    {
+        if (!Mathf.Approximately (customCurve[0].time, 0f))
+            return false;
+        
+        if (!Mathf.Approximately (customCurve[0].value, 0f))
+            return false;
+        
+        if (!Mathf.Approximately (customCurve[customCurve.length - 1].time, 1f))
+            return false;
+        
+        return Mathf.Approximately (customCurve[customCurve.length - 1].value, 1f);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0594bfd3cbfda4d4bab34de00fb2faed
+timeCreated: 1493024223
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 26 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs

@@ -0,0 +1,26 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[Serializable]
+public class TransformTweenClip : PlayableAsset, ITimelineClipAsset
+{
+    public TransformTweenBehaviour template = new TransformTweenBehaviour ();
+    public ExposedReference<Transform> startLocation;
+    public ExposedReference<Transform> endLocation;
+    
+    public ClipCaps clipCaps
+    {
+        get { return ClipCaps.Blending; }
+    }
+
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    {
+        var playable = ScriptPlayable<TransformTweenBehaviour>.Create (graph, template);
+        TransformTweenBehaviour clone = playable.GetBehaviour ();
+        clone.startLocation = startLocation.Resolve (graph.GetResolver ());
+        clone.endLocation = endLocation.Resolve (graph.GetResolver ());
+        return playable;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f28fb04ff66f85e40af453230799042c
+timeCreated: 1489416659
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 119 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs

@@ -0,0 +1,119 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+
+public class TransformTweenMixerBehaviour : PlayableBehaviour
+{
+    bool m_FirstFrameHappened;
+
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    {
+        Transform trackBinding = playerData as Transform;
+
+        if(trackBinding == null)
+            return;
+
+        Vector3 defaultPosition = trackBinding.position;
+        Quaternion defaultRotation = trackBinding.rotation;
+
+        int inputCount = playable.GetInputCount ();
+
+        float positionTotalWeight = 0f;
+        float rotationTotalWeight = 0f;
+
+        Vector3 blendedPosition = Vector3.zero;
+        Quaternion blendedRotation = new Quaternion(0f, 0f, 0f, 0f);
+
+        for (int i = 0; i < inputCount; i++)
+        {
+            ScriptPlayable<TransformTweenBehaviour> playableInput = (ScriptPlayable<TransformTweenBehaviour>)playable.GetInput (i);
+            TransformTweenBehaviour input = playableInput.GetBehaviour ();
+
+            if(input.endLocation == null)
+                continue;
+
+            float inputWeight = playable.GetInputWeight(i);
+
+            if (!m_FirstFrameHappened && !input.startLocation)
+            {
+                input.startingPosition = defaultPosition;
+                input.startingRotation = defaultRotation;
+            }
+
+            float normalisedTime = (float)(playableInput.GetTime() / playableInput.GetDuration ());
+            float tweenProgress = input.EvaluateCurrentCurve(normalisedTime);
+
+            if (input.tweenPosition)
+            {
+                positionTotalWeight += inputWeight;
+
+                blendedPosition += Vector3.Lerp(input.startingPosition, input.endLocation.position, tweenProgress) * inputWeight;
+            }
+
+            if (input.tweenRotation)
+            {
+                rotationTotalWeight += inputWeight;
+
+                Quaternion desiredRotation = Quaternion.Lerp(input.startingRotation, input.endLocation.rotation, tweenProgress);
+                desiredRotation = NormalizeQuaternion(desiredRotation);
+
+                if (Quaternion.Dot (blendedRotation, desiredRotation) < 0f)
+                {
+                    desiredRotation = ScaleQuaternion (desiredRotation, -1f);
+                }
+
+                desiredRotation = ScaleQuaternion(desiredRotation, inputWeight);
+
+                blendedRotation = AddQuaternions (blendedRotation, desiredRotation);
+            }
+        }
+
+        blendedPosition += defaultPosition * (1f - positionTotalWeight);
+        Quaternion weightedDefaultRotation = ScaleQuaternion (defaultRotation, 1f - rotationTotalWeight);
+        blendedRotation = AddQuaternions (blendedRotation, weightedDefaultRotation);
+
+        trackBinding.position = blendedPosition;
+        trackBinding.rotation = blendedRotation;
+        
+        m_FirstFrameHappened = true;
+    }
+
+    public override void OnPlayableDestroy (Playable playable)
+    {
+        m_FirstFrameHappened = false;
+    }
+
+    static Quaternion AddQuaternions (Quaternion first, Quaternion second)
+    {
+        first.w += second.w;
+        first.x += second.x;
+        first.y += second.y;
+        first.z += second.z;
+        return first;
+    }
+
+    static Quaternion ScaleQuaternion (Quaternion rotation, float multiplier)
+    {
+        rotation.w *= multiplier;
+        rotation.x *= multiplier;
+        rotation.y *= multiplier;
+        rotation.z *= multiplier;
+        return rotation;
+    }
+
+    static float QuaternionMagnitude (Quaternion rotation)
+    {
+        return Mathf.Sqrt ((Quaternion.Dot (rotation, rotation)));
+    }
+
+    static Quaternion NormalizeQuaternion (Quaternion rotation)
+    {
+        float magnitude = QuaternionMagnitude (rotation);
+
+        if (magnitude > 0f)
+            return ScaleQuaternion (rotation, 1f / magnitude);
+
+        Debug.LogWarning ("Cannot normalize a quaternion with zero magnitude.");
+        return Quaternion.identity;
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e904ec43bfb67e843b3b830e3d2adc1d
+timeCreated: 1493024236
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 32 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs

@@ -0,0 +1,32 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+
+[TrackColor(0.855f,0.8623f,0.870f)]
+[TrackClipType(typeof(TransformTweenClip))]
+[TrackBindingType(typeof(Transform))]
+public class TransformTweenTrack : TrackAsset
+{
+	public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+	{
+	    return ScriptPlayable<TransformTweenMixerBehaviour>.Create (graph, inputCount);
+	}
+
+    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
+    {
+#if UNITY_EDITOR
+        var comp = director.GetGenericBinding(this) as Transform;
+        if (comp == null)
+            return;
+        var so = new UnityEditor.SerializedObject(comp);
+        var iter = so.GetIterator();
+        while (iter.NextVisible(true))
+        {
+            if (iter.hasVisibleChildren)
+                continue;
+            driver.AddFromName<Transform>(comp.gameObject, iter.propertyPath);
+        }
+#endif
+        base.GatherProperties(director, driver);
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f2e6ab84ba07902498da4807885565cb
+timeCreated: 1489416673
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/DefaultPlayables/Video.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3beda1e3675ee5a438601ebe0052d01d
+folderAsset: yes
+timeCreated: 1497258609
+licenseType: Store
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 176 - 0
Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs

@@ -0,0 +1,176 @@
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Video;
+
+namespace UnityEngine.Timeline
+{
+	public class VideoPlayableBehaviour : PlayableBehaviour
+    {
+        public VideoPlayer videoPlayer;
+		public VideoClip videoClip;
+        public bool mute = false;
+        public bool loop = true;
+        public double preloadTime = 0.3;
+        public double clipInTime = 0.0;
+
+        private bool playedOnce = false;
+        private bool preparing = false;
+
+        public void PrepareVideo()
+        {
+            if (videoPlayer == null || videoClip == null)
+                return;
+
+            videoPlayer.targetCameraAlpha = 0.0f;
+
+            if (videoPlayer.clip != videoClip)
+                StopVideo();
+
+            if (videoPlayer.isPrepared || preparing)
+                return;
+
+            videoPlayer.source = VideoSource.VideoClip;
+            videoPlayer.clip = videoClip;
+            videoPlayer.playOnAwake = false;
+            videoPlayer.waitForFirstFrame = true;
+		    videoPlayer.isLooping = loop;
+
+            for (ushort i = 0; i < videoClip.audioTrackCount; ++i)
+            {
+                if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
+                    videoPlayer.SetDirectAudioMute(i, mute || !Application.isPlaying);
+                else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
+                {
+                    AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
+                    if (audioSource != null)
+                        audioSource.mute = mute || !Application.isPlaying;
+                }
+            }
+
+            videoPlayer.loopPointReached += LoopPointReached;
+            videoPlayer.time = clipInTime;
+            videoPlayer.Prepare();
+            preparing = true;
+        }
+
+        void LoopPointReached(VideoPlayer vp)
+        {
+            playedOnce = !loop;
+        }
+
+        public override void PrepareFrame(Playable playable, FrameData info)
+		{
+			if (videoPlayer == null || videoClip == null)
+				return;
+
+            videoPlayer.timeReference = Application.isPlaying ? VideoTimeReference.ExternalTime :
+                                                                VideoTimeReference.Freerun;
+																
+		    if (videoPlayer.isPlaying && Application.isPlaying)
+			    videoPlayer.externalReferenceTime = playable.GetTime();
+            else if (!Application.isPlaying)
+                SyncVideoToPlayable(playable);
+        }
+
+        public override void OnBehaviourPlay(Playable playable, FrameData info)
+        {
+            if (videoPlayer == null)
+                return;
+
+            if (!playedOnce)
+            {
+                PlayVideo();
+                SyncVideoToPlayable(playable);
+            }
+        }
+
+        public override void OnBehaviourPause(Playable playable, FrameData info)
+        {
+            if (videoPlayer == null)
+                return;
+
+            if (Application.isPlaying)
+                PauseVideo();
+            else
+                StopVideo();
+        }
+
+		public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+		{
+			if (videoPlayer == null || videoPlayer.clip == null)
+				return;
+
+            videoPlayer.targetCameraAlpha = info.weight;
+
+		    if (Application.isPlaying)
+		    {
+		        for (ushort i = 0; i < videoPlayer.clip.audioTrackCount; ++i)
+		        {
+		            if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
+		                videoPlayer.SetDirectAudioVolume(i, info.weight);
+		            else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
+		            {
+		                AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
+		                if (audioSource != null)
+		                    audioSource.volume = info.weight;
+		            }
+		        }
+		    }
+		}
+
+		public override void OnGraphStart(Playable playable)
+		{
+		    playedOnce = false;
+		}
+
+		public override void OnGraphStop(Playable playable)
+		{
+		    if (!Application.isPlaying)
+		        StopVideo();
+		}
+
+        public override void OnPlayableDestroy(Playable playable)
+        {
+            StopVideo();
+        }
+
+        public void PlayVideo()
+        {
+            if (videoPlayer == null)
+                return;
+
+            videoPlayer.Play();
+            preparing = false;
+
+            if (!Application.isPlaying)
+                PauseVideo();
+        }
+
+        public void PauseVideo()
+        {
+            if (videoPlayer == null)
+                return;
+
+            videoPlayer.Pause();
+            preparing = false;
+        }
+
+        public void StopVideo()
+        {
+            if (videoPlayer == null)
+                return;
+
+            playedOnce = false;
+            videoPlayer.Stop();
+            preparing = false;
+        }
+
+        private void SyncVideoToPlayable(Playable playable)
+        {
+            if (videoPlayer == null || videoPlayer.clip == null)
+                return;
+
+            videoPlayer.time = (clipInTime + (playable.GetTime() * videoPlayer.playbackSpeed)) % videoPlayer.clip.length;
+        }
+    }
+}

+ 12 - 0
Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f9cbe3d1fa4843444a5eb76370a4dd15
+timeCreated: 1497258618
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 52 - 0
Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Playables;
+
+namespace UnityEngine.Timeline
+{
+    public sealed class VideoSchedulerPlayableBehaviour : PlayableBehaviour
+    {
+		private IEnumerable<TimelineClip> m_Clips;
+        private PlayableDirector m_Director;
+
+        internal PlayableDirector director
+        {
+            get { return m_Director; }
+            set { m_Director = value; }
+        }
+
+        internal IEnumerable<TimelineClip> clips
+        {
+            get { return m_Clips; }
+            set { m_Clips = value; }
+        }
+
+        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+        {
+            if (m_Clips == null)
+                return;
+
+            int inputPort = 0;
+            foreach (TimelineClip clip in m_Clips)
+            {
+				ScriptPlayable<VideoPlayableBehaviour> scriptPlayable =
+					(ScriptPlayable<VideoPlayableBehaviour>)playable.GetInput(inputPort);
+
+				VideoPlayableBehaviour videoPlayableBehaviour = scriptPlayable.GetBehaviour();
+
+				if (videoPlayableBehaviour != null)
+				{
+					double preloadTime = Math.Max(0.0, videoPlayableBehaviour.preloadTime);
+					if (m_Director.time >= clip.start + clip.duration ||
+						m_Director.time <= clip.start - preloadTime)
+						videoPlayableBehaviour.StopVideo();
+					else if (m_Director.time > clip.start - preloadTime)
+						videoPlayableBehaviour.PrepareVideo();
+				}
+					
+                ++inputPort;
+            }
+        }
+	}
+}

+ 12 - 0
Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6dfd332197b07004c90e572e7b383e47
+timeCreated: 1497258618
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 45 - 0
Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs

@@ -0,0 +1,45 @@
+using System;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Video;
+
+namespace UnityEngine.Timeline
+{
+	[Serializable]
+    public class VideoScriptPlayableAsset : PlayableAsset
+	{
+        public ExposedReference<VideoPlayer> videoPlayer;
+
+        [SerializeField, NotKeyable]
+		public VideoClip videoClip;
+
+        [SerializeField, NotKeyable]
+        public bool mute = false;
+
+        [SerializeField, NotKeyable]
+        public bool loop = true;
+
+        [SerializeField, NotKeyable]
+        public double preloadTime = 0.3;
+
+        [SerializeField, NotKeyable]
+        public double clipInTime = 0.0;
+
+        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
+		{
+            ScriptPlayable<VideoPlayableBehaviour> playable =
+                ScriptPlayable<VideoPlayableBehaviour>.Create(graph);
+
+            VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour();
+
+            playableBehaviour.videoPlayer = videoPlayer.Resolve(graph.GetResolver());
+            playableBehaviour.videoClip = videoClip;
+            playableBehaviour.mute = mute;
+            playableBehaviour.loop = loop;
+            playableBehaviour.preloadTime = preloadTime;
+            playableBehaviour.clipInTime = clipInTime;
+
+            return playable;
+		}
+	}
+}

+ 12 - 0
Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 88bb1acb4c6ce544788ae727c940bd7e
+timeCreated: 1497258618
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 34 - 0
Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Playables;
+
+namespace UnityEngine.Timeline
+{
+	[Serializable]
+    [TrackClipType(typeof(VideoScriptPlayableAsset))]
+    [TrackMediaType(TimelineAsset.MediaType.Script)]
+    [TrackColor(0.008f, 0.698f, 0.655f)]
+    public class VideoScriptPlayableTrack : TrackAsset
+	{
+        public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+        {
+            PlayableDirector playableDirector = go.GetComponent<PlayableDirector>();
+
+            ScriptPlayable<VideoSchedulerPlayableBehaviour> playable =
+                ScriptPlayable<VideoSchedulerPlayableBehaviour>.Create(graph, inputCount);
+
+            VideoSchedulerPlayableBehaviour videoSchedulerPlayableBehaviour =
+                   playable.GetBehaviour();
+
+            if (videoSchedulerPlayableBehaviour != null)
+            {
+                videoSchedulerPlayableBehaviour.director = playableDirector;
+                videoSchedulerPlayableBehaviour.clips = GetClips();
+            }
+
+            return playable;
+        }
+    }
+}
+

Some files were not shown because too many files changed in this diff