Warning: Declaration of action_plugin_linebreak::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/linebreak/action.php on line 41

Warning: Declaration of action_plugin_markdownextra::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/markdownextra/action.php on line 16

Warning: Declaration of action_plugin_syntaxhighlighter3_action::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/syntaxhighlighter3/action/action.php on line 28
====== 005 インターフェースについて(4.7.6) ====== BPにもインターフェースクラスが存在します。ここでは使い方のみ説明します。より詳細な部分は[[http://unrealengine.hatenablog.com/entry/2014/09/23/201458|ブループリント インターフェースについて - Let's Enjoy Unreal Engine]]がとても参考になります。 ===== インターフェースBPの作成 ===== コンテンツブラウザから、新規作成 → ブループリント →ブループリントインターフェースを選択する。BPインターフェースの名前はICommandとしておきます。 {{:wiki:ue4:tips:bp_create_interface.png|}} \\ \\ \\ \\ \\ \\ ==== インターフェースの実装 ==== 作成したBPインターフェースを編集します。 {{:wiki:ue4:tips:bp_create_interface_2.png|}} \\ ツールバーのクラス設定を開き、詳細パネルから関数を登録します。入力値は文字列の配列を引数にしています。出力値は文字列を返す様にしています。UE4のバージョン(4.7.6)では出力値を必ず一つ設定しておかないと、インターフェース扱いにならずイベント扱いになってしまいますので文字列を返す様にしておきます。 \\ \\ \\ \\ \\ \\ ===== 関数の実装 ===== コンテンツブラウザから、新規作成 → ブループリント → Actorを継承しただけのBP「WaitCommand」を作成します。次に、WaitCommandの関数を実装します。編集画面のツールバー → クラス設定の詳細パネルから実装インターフェース「ICommand」を追加します。これで「ICommand」を継承した形になるので、関数の中身を実装します。 {{:wiki:ue4:tips:bp_create_interface_impl.png|}} きちんと処理が通るか確認するため、文字列を出すだけのノードを追加しています。 \\ \\ \\ \\ \\ \\ ===== 使ってみる ===== あとは、作成した「WaitCommand」クラスはActorを継承しているので、SpawnActorで生成して関数を呼び出すだけです。 {{:wiki:ue4:tips:bp_create_interface_use.png|}}