【3Dゲームエンジン】Unity質問スレッド5at GAMEDEV【3Dゲームエンジン】Unity質問スレッド5 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト188:名前は開発中のものです。 13/07/18 16:47:05.01 UbedvFXW enemy はGameObject型だから、以下のメンバしか参照できない http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html もし座標を直接参照したいなら、 こんな感じで辿ってく必要がある enemy ← GameObject型 http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html enemy.transform ←Transform型 http://docs.unity3d.com/Documentation/ScriptReference/Transform.html enemy.transform.position ←Vector3型 http://docs.unity3d.com/Documentation/ScriptReference/Vector3.html enemy.transform.position.x ←float型 189:名前は開発中のものです。 13/07/18 18:05:26.28 UbedvFXW gameObject や transform と書くだけで参照できるのは、EnemyAiがComponentを継承しているから。 Componentクラスには、gameObjectやtransformが定義されている http://docs-jp.unity3d.com/Documentation/ScriptReference/Component.html 「EnemyAi : MonoBehaviour」だから、MonoBehaviourしか継承していないんじゃないの?と思いきや、 MonoBehaviourも別のクラスを継承しているから、実際の継承の関係はこうなってる: Object←Component←Behaviour←MonoBehaviour←EnemyAi 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch