protected Component()
        {
            this.InstanceId = IdGenerater.GenerateInstanceId();
#if !SERVER
            if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            {
                this.GameObject      = new GameObject();
                this.GameObject.name = this.GetType().Name;
                this.GameObject.transform.SetParent(Global.transform, false);
                this.GameObject.AddComponent <ComponentView>().Component = this;
            }
#endif
        }
Example #2
0
        protected Component()
        {
            this.InstanceId = IdGenerater.GenerateInstanceId();
#if !SERVER
            //if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            //{
            //	this.GameObject = new GameObject();
            //	this.GameObject.name = this.GetType().Name;
            //	//this.GameObject.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
            //	this.GameObject.transform.SetParent(Global.transform, false);
            //	this.GameObject.AddComponent<ComponentView>().Component = this;
            //}
#endif
        }
        //构造函数
        protected Component()
        {
            this.InstanceId = IdGenerater.GenerateInstanceId();
#if !SERVER
            //如果不是标记了隐藏的特性,那么不在Hierarchy面板中隐藏,并且要求是继承的对象
            if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            {
                this.GameObject      = new GameObject();
                this.GameObject.name = this.GetType().Name;
                //层级设置为隐藏的"Hidden"
                this.GameObject.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
                this.GameObject.transform.SetParent(Global.transform, false);
                //组件视图?
                this.GameObject.AddComponent <ComponentView>().Component = this;
            }
#endif
        }