标签:des android http io os ar sp 数据 div
欢迎来到unity学习、unity培训、unity企业培训教育专区,这里有很多U3D资源、U3D培训视频、U3D教程、U3D常见问题、U3D项目源码,我们致力于打造业内unity3d培训、学习第一品牌。
场景中有2个物体:A,B
AbstractMonoBehaviour.cs
using UnityEngine;
using System.Text;
public abstract class AbstractMonoBehaviour : MonoBehaviour
{
protected abstract bool EnableLog { get;}
void Start ()
{
Log("Start");
}
void Awake()
{
Log("Awake");
}
void OnDestroy()
{
Log("OnDestroy");
}
void OnDisable()
{
Log("OnDisable");
}
void OnEnable()
{
Log("OnEnable");
}
protected void Log(object obj)
{
if (EnableLog)
{
StringBuilder sb = new StringBuilder();
sb.Append("Object : ").Append(gameObject.name)
.Append(" , Script : ").Append(GetType().Name)
.Append(" , Message : ").Append(obj);
Debug.Log(sb.ToString());
}
}
}
A.cs
using UnityEngine;
public class A : AbstractMonoBehaviour
{
protected override bool EnableLog
{
get { return true; }
}
}
B.cs
using UnityEngine;
public class B : AbstractMonoBehaviour
{
protected override bool EnableLog
{
get { return true; }
}
}
更多精彩请点击 http://www.gopedu.com/
Unity3D脚本(MonoBehaviour)生命周期分析
标签:des android http io os ar sp 数据 div
原文地址:http://www.cnblogs.com/Unity3Dqishituan/p/4067878.html