MonoBehaviour
- Awake
- CancelInvoke
- FixedUpdate
- InvokeRepeating
- Invoke
- IsInvoking
- LateUpdate
- OnApplicationFocus
- OnApplicationPause
- OnApplicationQuit
- OnBecameInvisible
- OnBecameVisible
- OnCollisionEnter
- OnCollisionExit
- OnCollisionStay
- OnConnectedToServer
- OnControllerColliderHit
- OnDestroy
- OnDisable
- OnDisconnectedFromServer
- OnDrawGizmosSelected
- OnDrawGizmos
- OnEnable
- OnFailedToConnectToM...
- OnFailedToConnect
- OnGUI
- OnJointBreak
- OnLevelWasLoaded
- OnMasterServerEvent
- OnMouseDown
- OnMouseDrag
- OnMouseEnter
- OnMouseExit
- OnMouseOver
- OnMouseUpAsButton
- OnMouseUp
- OnNetworkInstantiate
- OnParticleCollision
- OnPlayerConnected
- OnPlayerDisconnected
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnSerializeNetworkView
- OnServerInitialized
- OnTriggerEnter
- OnTriggerExit
- OnTriggerStay
- OnWillRenderObject
- Reset
- StartCoroutine
- Start
- StopAllCoroutines
- StopCoroutine
- Update
- useGUILayout
MonoBehaviour.print 打印
static function print (message : object) : void
Description描述
Logs message to the Unity Console. This function is identical to Debug.Log .
记录消息到Unity控制台,这个函数和Debug.Log作用相同。
参见: Debug.Log, Debug.LogWarning, Debug.LogError.
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public int currentHealth = 0;
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) {
if (stream.isWriting) {
int healthC = currentHealth;
stream.Serialize(ref healthC);
} else {
int healthZ = 0;
stream.Serialize(ref healthZ);
currentHealth = healthZ;
}
}
}
// This objects health information
// 此物体的健康信息
var currentHealth : int = 0;
function OnSerializeNetworkView(stream : BitStream , info : NetworkMessageInfo ) {
if (stream.isWriting) {
var healthC : int = currentHealth;
stream.Serialize(healthC);
} else {
var healthZ : int = 0;
stream.Serialize(healthZ);
currentHealth = healthZ;
}
}
最后修改:2011年1月2日 Sunday 19:02