public void RegisterInstance(object instance)
        {
            void RegisterInstanceInternal()
            {
                Type instanceType = instance.GetType();

                KlaxAssembly assembly = instanceType.Assembly.GetCustomAttribute <KlaxAssembly>();

                //Register properties
                foreach (var property in instanceType.GetProperties())
                {
                    CVarAttribute attribute = property.GetCustomAttribute <CVarAttribute>();
                    if (attribute != null)
                    {
                        string name = string.IsNullOrEmpty(attribute.NameOverride) ? (assembly.ConsoleVariablePrefix + property.Name) : attribute.NameOverride;
                        RegisterVariable(name, property.PropertyType, attribute.ValueOverride ?? property.GetValue(instance), property, instance, attribute.Callback != null ? instanceType.GetMethod(attribute.Callback, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) : null);
                    }
                }
            }

            if (IsInAuthoritativeThread())
            {
                RegisterInstanceInternal();
            }
            else
            {
                Dispatch(EConfigDispatcherPriority.Update, RegisterInstanceInternal);
            }
        }
        private void RegisterAssembly(Assembly assembly)
        {
            KlaxAssembly klaxAssembly = assembly.GetCustomAttribute <KlaxAssembly>();

            if (klaxAssembly == null)
            {
                return;
            }

            foreach (TypeInfo type in assembly.DefinedTypes)
            {
                KlaxScriptTypeAttribute klaxType = type.GetCustomAttribute <KlaxScriptTypeAttribute>();
                if (klaxType != null)
                {
                    RegisterType(new CKlaxScriptTypeInfo()
                    {
                        Type = type, Color = klaxType.Color.A == 0 ? DEFAULT_TYPE_COLOR : klaxType.Color, Name = klaxType.Name ?? type.Name
                    });
                }
                else
                {
                    KlaxLibraryAttribute klaxLibrary = type.GetCustomAttribute <KlaxLibraryAttribute>();
                    if (klaxLibrary != null)
                    {
                        foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static))
                        {
                            KlaxFunctionAttribute klaxFunc = method.GetCustomAttribute <KlaxFunctionAttribute>();
                            if (klaxFunc != null)
                            {
                                LibraryFunctions.Add(CreateFunction(klaxFunc, method));
                            }
                        }
                    }
                }
            }
        }