2016-10-22 6 views
0

親ゲームオブジェクトをUnityEditorに配置し、子ゲームオブジェクトをコードから見ることは可能ですか?私は必要な構造を持つカスタムクラスを作成しようとしましたが、ナットの団結はそれを理解していません。コードから子ゲームオブジェクトを見る

public Path Path1; 
public Path Path2; 
public Path Path3; 
public Path Path4; 

enter image description here

[Serializable] 
public class Path : MonoBehaviour 
{ 
    public List<Way> Ways; 

    public Path() 
    { 
    } 
} 

ウェイクラス

[Serializable] 
public class Way : MonoBehaviour 
{ 
    public Transform StartPoint { get; set;} 
    public Transform[] EndPoints { get; set;} 
    public Transform[] AngleWaypoints { get; set;} 

    public Way() 
    { 
    } 
    public Way (Transform startPoint, Transform[] endPoints, Transform[] angleWaypoints) 
    { 
     this.StartPoint = startPoint; 
     this.EndPoints = endPoints; 
     this.AngleWaypoints = angleWaypoints; 
    } 


} 

答えて

0

あなたのクラスは、多分それはあなたが欠けていることもあり、MonoBehaviourから継承する必要があります。

それはあなたがあなたのGameManagerスクリプトを選択している

class myClass : MonoBehaviour{ 
} 

のようになります。 Path_1を選択すると、PathEditorにPathクラスのすべてのパブリック変数が表示されます。

また、あなたはより多くの情報UnityEditor Debug Mode

+0

影響なしが表示されますデバッグにUnityEditorモードを変更することができます。私はGameObjectをPathクラスに入れようとしています –

+0

この問題を明確にするために、コードまたはUnityEditorのスクリーンショットを追加できますか? – asantacreu

+0

私の回答を編集しました@ЧечилКрым – asantacreu

関連する問題