/// <summary>
        /// Create new weapon by properties.
        /// </summary>
        private static GameObject CreatePickableWeapon(WeaponProperties properties)
        {
            // Initialize gameobjects.
            GameObject weponObject = new GameObject(properties.GetName());
            GameObject weapon      = GameObject.Instantiate(properties.GetClearWeapon(), Vector3.zero, Quaternion.identity, weponObject.transform);

            // Initialize weapon components.
            PickableItem   pickupItem       = UEditorInternal.AddComponent <PickableItem>(weponObject);
            Rigidbody      physicsRigidbody = UEditorInternal.AddComponent <Rigidbody>(weponObject);
            AudioSource    audioSource      = UEditorInternal.AddComponent <AudioSource>(weponObject);
            SphereCollider triggerCollider  = UEditorInternal.AddComponent <SphereCollider>(weponObject);
            BoxCollider    physicsCollider  = UEditorInternal.AddComponent <BoxCollider>(weponObject);

            // Setup PickableItem component.
            pickupItem.SetProcessingType(properties.GetProcessingType());
            pickupItem.SetObjectType(properties.GetObjectType());
            pickupItem.SetPickUpKey(properties.GetPickUpKey());
            pickupItem.SetItem(weapon.transform);
            pickupItem.SetWeapon(properties.GetWeaponID());
            pickupItem.SetValue(properties.GetValue());
            pickupItem.SetReusableDelay(properties.GetReusableDelay());
            pickupItem.IsReusable(properties.IsReusable());
            pickupItem.DestroyAfterUse(properties.DestroyAfterUse());
            pickupItem.SetPickUpMessage(properties.GetPickUpMessage());
            pickupItem.SetSoundEffect(properties.GetSoundEffect());

            // Setup SphereCollider component.
            triggerCollider.isTrigger = true;
            triggerCollider.radius    = 1.25f;

            // Setup BoxCollider component.
            Renderer renderer = weapon.GetComponentInChildren <Renderer>();

            if (renderer != null)
            {
                physicsCollider.center = renderer.bounds.center;
                physicsCollider.size   = renderer.bounds.size;
            }

            // Apply components position.
            UEditorInternal.MoveComponentBottom <PickableItem>(weponObject.transform);
            UEditorInternal.MoveComponentBottom <Rigidbody>(weponObject.transform);
            UEditorInternal.MoveComponentBottom <SphereCollider>(weponObject.transform);
            UEditorInternal.MoveComponentBottom <BoxCollider>(weponObject.transform);
            UEditorInternal.MoveComponentBottom <AudioSource>(weponObject.transform);

            return(weponObject);
        }
        private static void DrawPickableWeaponGUI()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Space(5);
            GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);

            properties.SetName(EditorGUILayout.TextField(ContentProperties.Name, properties.GetName()));
            properties.SetProcessingType((PickableItem.PickupType)EditorGUILayout.EnumPopup(ContentProperties.PickupType, properties.GetProcessingType()));
            properties.SetObjectType((PickableItem.ItemType)EditorGUILayout.EnumPopup(ContentProperties.ObjecftType, properties.GetObjectType()));

            if (properties.GetProcessingType() == PickableItem.PickupType.ByKey)
            {
                properties.SetPickUpKey((KeyCode)EditorGUILayout.EnumPopup(ContentProperties.PickupKey, properties.GetPickUpKey()));
            }

            GUILayout.Space(10);
            GUILayout.Label(ContentProperties.ItemProperties, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);
            properties.SetClearWeapon(UEditor.ObjectField <GameObject>(ContentProperties.Item, properties.GetClearWeapon(), true));
            if (properties.GetClearWeapon() == null)
            {
                UEditorHelpBoxMessages.Error("Item cannot be empty!", "Add item game object!");
            }
            switch (properties.GetObjectType())
            {
            case PickableItem.ItemType.Weapon:
                properties.SetWeaponID(UEditor.ObjectField <WeaponID>(ContentProperties.Weapon, properties.GetWeaponID(), true));
                properties.AutoActivate(EditorGUILayout.Toggle(ContentProperties.AutoActivate, properties.AutoActivate()));
                break;

            case PickableItem.ItemType.Ammo:
                properties.SetWeaponID(UEditor.ObjectField <WeaponID>(new GUIContent("Target Weapon", "Target weapon for ammo."), properties.GetWeaponID(), true));
                properties.SetValue(EditorGUILayout.IntField(new GUIContent("Bullets", "How many bullet add in weapon ammo."), properties.GetValue()));
                break;

            case PickableItem.ItemType.HealthBox:
                properties.SetValue(EditorGUILayout.IntField(new GUIContent("Health Point", "How many health point add in target."), properties.GetValue()));
                break;
            }
            if (!properties.DestroyAfterUse())
            {
                float refReusableDelay = properties.GetReusableDelay();
                bool  refIsReusable    = properties.IsReusable();
                UEditor.HiddenFloatField(ContentProperties.ReusableDelay, ContentProperties.IsReusable, ref refReusableDelay, ref refIsReusable);
                properties.SetReusableDelay(refReusableDelay);
                properties.IsReusable(refIsReusable);
            }
            else
            {
                EditorGUI.BeginDisabledGroup(true);
                properties.IsReusable(EditorGUILayout.Toggle(ContentProperties.IsReusable, false));
                EditorGUI.EndDisabledGroup();
            }

            if (!properties.IsReusable())
            {
                properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, properties.DestroyAfterUse()));
            }
            else
            {
                EditorGUI.BeginDisabledGroup(true);
                properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, false));
                EditorGUI.EndDisabledGroup();
            }

            GUILayout.Space(10);
            GUILayout.Label(ContentProperties.UI, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);

            if (properties.GetWeaponID() != null)
            {
                GUILayout.BeginHorizontal();
                properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage()));
                if (UEditor.GenerateButton())
                {
                    properties.SetPickUpMessage("HOLD [{0}] TO PICKUP \"{1}\"");
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage()));
            }

            if (properties.GetWeapon() != null)
            {
                GUILayout.BeginHorizontal();
                properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage()));
                if (UEditor.GenerateButton())
                {
                    properties.SetPickUpMessage("HOLD [{0}] TO CHANGE \"{1}\"");
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage()));
            }

            GUILayout.Space(10);
            GUILayout.Label(ContentProperties.Effects, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);
            AudioClip se = properties.GetSoundEffect();

            UEditor.ObjectHiddenField <AudioClip>(ContentProperties.P_SoundEffect, ContentProperties.P_SoundEffect, ref se, ref useSoundEffect);
            properties.SetSoundEffect(useSoundEffect ? se : null);

            GUILayout.Space(5);
            UEditor.HorizontalLine();
            GUILayout.Space(5);

            EditorGUI.BeginDisabledGroup(!properties.NameIsValid() || properties.GetClearWeapon() == null);
            if (UEditor.Button("Create", "Right", GUILayout.Width(70)))
            {
                weapon = CreatePickableWeapon(properties);
            }
            EditorGUI.EndDisabledGroup();

            if (weapon != null && delay.WaitForSeconds())
            {
                if (UDisplayDialogs.Message("Create Successful", "Pickable weapon was created on scene!\nSetup weapon components before start play.", "Select", "Ok"))
                {
                    Selection.activeGameObject = weapon;
                }
                weapon = null;
            }

            GUILayout.Space(5);
            GUILayout.EndVertical();
        }