Last active
August 29, 2015 14:01
-
-
Save p-chin/4f84de96267d2a7fe1d8 to your computer and use it in GitHub Desktop.
UnityのProjectWindowからAssetを選択して右クリックして出たメニューからgithubのページを開いてくれるEditorTool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class GitHubPageJumper | |
{ | |
// ref https://github.com/p-chin/dotfiles | |
private static readonly string gitHubTeamName = "p-chin"; | |
private static readonly string gitHubRepositoryName = "dotfiles"; | |
private static readonly string gitHubBranchName = "master"; | |
[MenuItem("Assets/OpenGithubPage")] | |
public static void OpenGitHubPage() { | |
string targetPath = GetTargetPath(); | |
var url = string.Format ("https://github.com/{0}/{1}/blob/{2}/{3}", | |
gitHubTeamName, gitHubRepositoryName, gitHubBranchName, targetPath); | |
Debug.Log("Open " + url); | |
Application.OpenURL (url); | |
} | |
private static string GetTargetPath() | |
{ | |
Object selected = Selection.objects[0]; | |
if (selected == null) | |
{ | |
Debug.LogError ("Please select from the file ProjectWindow"); | |
return null; | |
} | |
return AssetDatabase.GetAssetPath(selected);; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment