コード例 #1
0
 public static void Open(ChallengePresetAsset asset, string fileName)
 {
     if (asset != null)
     {
         ChallengePresetEditor editor = CreateInstance <ChallengePresetEditor>();
         editor.pathToFile = new AssetFile(AssetDatabase.GetAssetPath(asset)).ShowResourcePath();
         if (string.IsNullOrEmpty(editor.pathToFile))
         {
             return;
         }
         editor.Show();
         editor.position = new Rect(100, 200, 640, 480);
         GUIContent editorTitleContent = new GUIContent(editor.titleContent);
         editorTitleContent.text = asset.name;
         editor.titleContent     = editorTitleContent;
     }
 }
コード例 #2
0
        public static bool OnOpenAsset(int instanceID, int line)
        {
            ChallengePresetAsset challengePresetAsset = Selection.activeObject as ChallengePresetAsset;

            if (!mouseOverWindow.titleContent.text.Contains("Project"))
            {
                return(false);
            }
            if (challengePresetAsset != null)
            {
                ChallengePresetEditor editor = CreateInstance <ChallengePresetEditor>();
                editor.pathToFile = new AssetFile(AssetDatabase.GetAssetPath(instanceID)).ShowResourcePath();
                editor.Show();
                editor.position = new Rect(100, 400, 640, 480);
                GUIContent editorTitleContent = new GUIContent(editor.titleContent);
                editorTitleContent.text = challengePresetAsset.name;
                editor.titleContent     = editorTitleContent;
            }

            return(false);
        }