Quantcast
Channel: プログラミング
Viewing all articles
Browse latest Browse all 7851

【備忘録】EditorGUI リンクタグクリック時の処理 - ゲーム作りは楽しい

$
0
0

EditorGUI.hyperLinkClicked

EditorGUI-hyperLinkClicked - Unity スクリプトリファレンス

<a>タグで囲ったテキストのクリック時の処理を登録できる。
なお、hrefはデフォルト登録されているので実装は不要。

対応しているレイアウト

EditorGUILayout.TextFieldEditorGUILayout.SelectableLabelに対応している
表示するだけなら、後者で良いと思うが
勝手にスクロール表示になったりするので注意

以下みたいにしておけば、普通のラベル表示っぽくできる

GUIStyle labelStyle =new GUIStyle(GUI.skin.label);
labelStyle.wordWrap =true;
labelStyle.richText =true;
var height = labelStyle.CalcHeight(new GUIContent(Text), EditorGUIUtility.currentViewWidth);
EditorGUILayout.SelectableLabel(Text, labelStyle, GUILayout.Height(height));

Viewing all articles
Browse latest Browse all 7851

Trending Articles