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

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。