2016-10-22 71 views
0
的小孩遊戲對象

是否可以將父GameObject放入UnityEditor並從代碼中看到小孩的gameObjects?我試圖創建具有必要結構的自定義類,堅果統一不理解它。查看代碼

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繼承,也許這是你的缺失。

它應該看起來像

class myClass : MonoBehaviour{ 
} 

您選擇您的遊戲管理器的腳本。嘗試選擇Path_1,Path類的所有公共變量都應出現在UnityEditor中。你

也可以改變UnityEditor模式進行調試,這將顯示更多的信息UnityEditor Debug Mode

+0

無影響。我試圖把GameObject放在Path類上 –

+0

你可以添加你的代碼或UnityEditor的截圖來幫助澄清這個問題嗎? – asantacreu

+0

我已編輯我的答案@ЧечилКрым – asantacreu