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()
    {
        
    }
}
相关推荐
老朱佩琪!1 小时前
Unity享元模式
unity·游戏引擎·享元模式
lrh30254 小时前
Custome SRP 17 - FXAA
3d·unity·srp·render pipeline·fxaa·抗锯齿
XR技术研习社6 小时前
第二种升级Quest系统的方案
unity·xr·vr
三和尚7 小时前
AI开发之Cursor的下载安装以及Unity-MCP下载安装到你的个人Unity项目中(一)
unity·ai·游戏引擎·cursor·unity-mcp·unity自动化
__water7 小时前
RHQ《Unity2D图片切割方式》
unity·2d·精灵图切割
DaLiangChen8 小时前
Unity 导览相机实现:键鼠控制自由漫游(WASD 移动 + 右键旋转)
数码相机·unity·游戏引擎
沉默金鱼1 天前
Unity实用技能-UI进度条
ui·unity·游戏引擎
老朱佩琪!1 天前
Unity离线开发经验分享
unity·游戏引擎
Sator11 天前
unity的GPUInstance和GPU动画
unity·游戏引擎
沉默金鱼2 天前
Unity实用技能-模型
unity·游戏引擎