- Home /
Question by
OsamaDeep · Jun 22, 2013 at 01:47 PM ·
classconstructor
Print function not work with Class Constructor
i wonder why the pring not work with the following code :
function Update ()
{
var osos = newPlayer("osama",30);
print("New Player Name is : " + osos.playerName + " ,and he old " + osos.playerAge);
}
class newPlayer
{
var playerName:String;
var playerAge:int;
function newPlayer(name:String,age:int)
{
playerName = name;
playerAge = age;
print("New player is created"); // Not Work !!
}
}
Comment
Answer by ThermalFusion · Jun 09, 2014 at 12:13 PM
http://docs.unity3d.com/ScriptReference/MonoBehaviour-print.html print is a static function in MonoBehaviour. Use Debug.Log() instead.