2016-10-22 74 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