Skip to content

Instantly share code, notes, and snippets.

@iwashihead
Created April 10, 2017 08:23
Show Gist options
  • Save iwashihead/9e54a9ea2dec71ce1142fdff2e904d36 to your computer and use it in GitHub Desktop.
Save iwashihead/9e54a9ea2dec71ce1142fdff2e904d36 to your computer and use it in GitHub Desktop.
選択補助メニューアイテム
//-------------------------------------------------------
// @file SelectionHelper.cs
// @brief .
//
// @author haruki.tachihara
//-------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
using UnityEditor.SceneManagement;
public class SelectionHelper
{
[MenuItem("Assets/Select/Textures")]
public static void SelectTextures() {
Select<Texture2D>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Sprites")]
public static void SelectSprites() {
Select<Sprite>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/AudioClips")]
public static void SelectAudioClips() {
Select<AudioClip>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Shaders")]
public static void SelectShaders() {
Select<Shader>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Materials")]
public static void SelectMaterials() {
Select<Material>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Prefabs")]
public static void SelectPrefabs() {
Select<GameObject>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/AnimationClips")]
public static void SelectAnimationClips() {
Select<AnimationClip>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/AnimatorControllers")]
public static void SelectAnimatorControllers() {
Select<RuntimeAnimatorController>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Scenes")]
public static void SelectScenes() {
Select<SceneAsset>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/Scripts")]
public static void SelectScripts() {
Select<MonoScript>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/TextAssets")]
public static void SelectTextAssets() {
Select<TextAsset>(SelectionMode.DeepAssets);
}
[MenuItem("Assets/Select/ScriptableObjects")]
public static void SelectScriptableObjects() {
Select<ScriptableObject>(SelectionMode.DeepAssets);
}
public static void Select<T>(SelectionMode mode)
{
Selection.objects = Selection.GetFiltered(typeof(T), mode);
}
}
@iwashihead
Copy link
Author

2017-04-10 17 21 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment