unity输出打印小数点位数设置

cs 复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Run : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("hello unity");
        print(this.gameObject.transform.position.x); //默认小数位数

        print(this.transform.position.x.ToString("F4"));//修改为5位小数

        print(this.transform.position.ToString("F3"));

    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
相关推荐
狂人开飞机28 分钟前
11、UI系统
游戏引擎·godot
真鬼1231 小时前
【Unity AI】Untiy链接cursor与MCP
unity·游戏引擎
WarPigs3 小时前
Unity设置人物位置无效的原因
unity
程序员正茂3 小时前
Unity3d行为树Behavior Designer Pro
unity·行为树
郝学胜-神的一滴4 小时前
C++11 工程级应用 10:减少拷贝,让容器跑得更快
服务器·开发语言·c++·游戏引擎·opengl
玖玥拾4 小时前
Lua 基础语法(八) Unity Huatuo (HybridCLR)
开发语言·unity·游戏引擎·lua
平行云4 小时前
国产GPU云渲染适配实战:驱动兼容、编码调优与多路并发
unity·ue5·webrtc·webgl·实时云渲染·云桌面·像素流送
狂人开飞机4 小时前
10、相机系统
游戏引擎·godot
不吃凉粉1 天前
Unity与AS通信
unity·游戏引擎
两水先木示2 天前
【Unity】探索小地图迷雾散开Shader效果(基础版)
unity·游戏引擎