Content-Length: 19991 | pFad | https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/MonoBehaviour-print.html

Unity - Scripting API: MonoBehaviour.print
Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

MonoBehaviour.print

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Declaration

public static void print(Object message);

Parameters

Parameter Description
message The message to display in the console.

Description

Logs a message to the Unity Console. Functionally equivalent to Debug.Log.

The print method is a functionally equivalent alternative to Debug.Log when used in a Monobehaviour script. Refer to Debug.Log for more information.

Additional resources: Debug.Log, Debug.LogWarning, Debug.LogError.

using UnityEngine;

public class PrintExample : MonoBehaviour { public int playerHealth = 85; public int maxHealth = 100;

void Start() { // Simply print a message in the console print("The Start method has been called.");

// Log variables using string interpolation print($"Initial player health: {playerHealth}");

// Log a variable using formatting float healthPercentage = playerHealth / (float)maxHealth; print($"The player's total score is: {healthPercentage:F2}"); } }








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/MonoBehaviour-print.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy