public void OnGUI()
        {
            GUI.skin.label.wordWrap  = true;
            GUI.skin.label.alignment = TextAnchor.UpperLeft;

            CognitiveVR_Manager manager = FindObjectOfType <CognitiveVR_Manager>();

            //==============
            //component list
            //==============

            GetAnalyticsComponentTypes();

            canvasPos = GUILayout.BeginScrollView(canvasPos, false, true);
            EditorGUI.BeginDisabledGroup(manager == null);

            if (manager == null)
            {
                GUI.color = new Color(0.5f, 0.5f, 0.5f);
                GUI.Box(new Rect(canvasPos.x, canvasPos.y, position.width, position.height), "");
                GUI.color = new Color(0.7f, 0.7f, 0.7f);
            }

            bool displayedFirstComponent = false;

            foreach (var v in childTypes)
            {
                GUILayout.Space(10);
                if (displayedFirstComponent)
                {
                    GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
                }
                else
                {
                    displayedFirstComponent = true;
                }
                TogglableComponent(manager, v);
            }
            GUI.color = Color.white;
            EditorGUI.EndDisabledGroup();
            GUILayout.EndScrollView();



            //==============
            //footer
            //==============

            GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });

            //add/select manager
            if (manager == null)
            {
                if (GUILayout.Button(new GUIContent("Add CognitiveVR Manager", "Does not Destroy on Load\nInitializes analytics system with basic device info"), GUILayout.Height(40)))
                {
                    string             sampleResourcePath = GetSamplesResourcePath();
                    UnityEngine.Object basicInit          = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(sampleResourcePath + "CognitiveVR/Resources/CognitiveVR_Manager.prefab");
                    if (basicInit)
                    {
                        Selection.activeGameObject = PrefabUtility.InstantiatePrefab(basicInit) as GameObject;
                    }
                    else
                    {
                        Debug.LogWarning("Couldn't find CognitiveVR_Manager.prefab");
                        GameObject go = new GameObject("CognitiveVR_Manager");
                        manager = go.AddComponent <CognitiveVR_Manager>();
                        Selection.activeGameObject = go;
                    }
                }
            }
            else
            {
                if (GUILayout.Button("Select CognitiveVR Manager", GUILayout.Height(40)))
                {
                    Selection.activeGameObject = manager.gameObject;
                }
            }

            //add/remove all
            EditorGUI.BeginDisabledGroup(manager == null);
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Add All", GUILayout.MaxWidth(position.width / 2)))
            {
                foreach (var component in childTypes)
                {
                    if (!manager.GetComponent(component))
                    {
                        manager.gameObject.AddComponent(component);
                    }
                }
            }

            if (GUILayout.Button("Remove All", GUILayout.MaxWidth(position.width / 2)))
            {
                foreach (var component in childTypes)
                {
                    if (manager.GetComponent(component))
                    {
                        DestroyImmediate(manager.GetComponent(component));
                    }
                }
            }

            GUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();

            //close

            GUILayout.Space(20);

            if (GUILayout.Button("Close"))
            {
                Close();
            }
        }
        void TogglableComponent(CognitiveVR_Manager manager, System.Type componentType)
        {
            Component component = null;

            if (manager != null)
            {
                component = manager.GetComponent(componentType);
            }

            GUILayout.BeginHorizontal();

            string prettyName = componentType.Name;

            if (prettyName.Contains("Tracker"))
            {
                prettyName = prettyName.Replace("Tracker", "");
            }
            GUI.skin.toggle.richText = true;

            /*string supportedPlatforms = "";
             * MethodInfo getPlatforms = componentType.GetMethod("GetPlatforms");
             * if (getPlatforms != null)
             * {
             *  var platforms = getPlatforms.Invoke(null, null) as string[];
             *  if (platforms != null)
             *  {
             *      for(int i = 0; i<platforms.Length; i++)
             *      {
             *          supportedPlatforms += platforms[i] + ", ";
             *      }
             *      if (supportedPlatforms.Length > 0)
             *      {
             *          supportedPlatforms = supportedPlatforms.Remove(supportedPlatforms.Length - 2);
             *      }
             *  }
             * }*/

            bool b = GUILayout.Toggle(component != null, "<size=14><b>" + prettyName + "</b></size>");

            if (b != (component != null))
            {
                if (component == null)
                {
                    manager.gameObject.AddComponent(componentType);
                }
                else
                {
                    DestroyImmediate(component);
                }
            }

            if (GUILayout.Button("Open Script", GUILayout.Width(100)))
            {
                //temporarily add script, open from component, remove component
                var tempComponent = manager.gameObject.AddComponent(componentType);
                AssetDatabase.OpenAsset(MonoScript.FromMonoBehaviour(tempComponent as MonoBehaviour));
                DestroyImmediate(tempComponent);
            }

            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();

            if (component != null)
            {
                GUI.backgroundColor = Green;
                MethodInfo warningInfo = componentType.GetMethod("GetWarning");
                if (warningInfo != null)
                {
                    var v = warningInfo.Invoke(null, null);
                    if (v != null && (bool)v == true)
                    {
                        GUI.backgroundColor = Orange;
                    }
                }
            }

            MethodInfo info = componentType.GetMethod("GetDescription");

            if (info == null)
            {
                GUILayout.Box("No description\nAdd a description by implementing 'public static string GetDescription()'", new GUILayoutOption[] { GUILayout.ExpandWidth(true) });
            }
            else
            {
                var v = info.Invoke(null, null);
                GUILayout.Box((string)v, new GUILayoutOption[] { GUILayout.ExpandWidth(true) });
            }

            GUI.backgroundColor = Color.white;

            GUILayout.EndHorizontal();
        }