public static void DrawComponents(IEntityExt entity)
        {
            var unfoldedComponents    = getUnfoldedComponents(entity);
            var componentMemberSearch = getComponentMemberSearch(entity);

            EditorLayout.BeginVerticalBox();
            {
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Components (" + entity.GetComponents().Length + ")", EditorStyles.boldLabel);
                    if (EditorLayout.MiniButtonLeft("▸"))
                    {
                        for (int i = 0; i < unfoldedComponents.Length; i++)
                        {
                            unfoldedComponents[i] = false;
                        }
                    }

                    if (EditorLayout.MiniButtonRight("▾"))
                    {
                        for (int i = 0; i < unfoldedComponents.Length; i++)
                        {
                            unfoldedComponents[i] = true;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                var index = drawAddComponentMenu(entity);
                if (index >= 0)
                {
                    var componentType = entity.contextInfo.componentTypes[index];
                    var component     = entity.CreateComponent(index, componentType);
                    entity.AddComponent(index, component);
                }

                EditorGUILayout.Space();

                componentNameSearchString = EditorLayout.SearchTextField(componentNameSearchString);

                EditorGUILayout.Space();

                var indices    = entity.GetComponentIndices();
                var components = entity.GetComponents();
                for (int i = 0; i < components.Length; i++)
                {
                    DrawComponent(unfoldedComponents, componentMemberSearch, entity, indices[i], components[i]);
                }
            }
            EditorLayout.EndVerticalBox();
        }
        /// Adds all components from the blueprint to the entity.
        /// When 'replaceComponents' is set to true entity.ReplaceComponent()
        /// will be used instead of entity.AddComponent().
        public static void ApplyBlueprint(this IEntityExt entity, Blueprint blueprint,
                                          bool replaceComponents = false)
        {
            var componentsLength = blueprint.components.Length;

            for (int i = 0; i < componentsLength; i++)
            {
                var componentBlueprint = blueprint.components[i];
                if (replaceComponents)
                {
                    entity.ReplaceComponent(componentBlueprint.index,
                                            componentBlueprint.CreateComponent(entity));
                }
                else
                {
                    entity.AddComponent(componentBlueprint.index,
                                        componentBlueprint.CreateComponent(entity));
                }
            }
        }