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()
    {
        
    }
}
相关推荐
淡海水4 小时前
08-02-优化-LINQ与函数式编程的GC代价
unity·c#·.netcore·linq·gc
警醒与鞭策17 小时前
Codex桌面版与Claude桌面版使用设置
android·unity·ai·性能优化
xcLeigh19 小时前
Unity基础:Destroy与DestroyImmediate——正确销毁游戏物体的方式
游戏·unity·游戏引擎·教程
lllhhh_远方1 天前
unity中URP场景阴影锯齿严重解决方案
unity·游戏引擎
淡海水1 天前
07-06-源码-.NET Core GC的极致优化技术
unity·架构·c#·.netcore·gc·1024程序员节
野区捕龙为宠1 天前
Unity 中使用 UnityWebRequest 加载 StreamingAssets 文件夹中的图片
unity·游戏引擎
北里闻箫1 天前
推荐一款游戏引擎,一剑十八年引擎(YiJian18-Engine) - 跨平台2D/3D ECS 游戏引擎
3d·游戏引擎
淡海水2 天前
07-02-源码-.NET Core GC分配路径
算法·unity·c#·.netcore·gc·1024程序员节
FFFFujige2 天前
【Unity】基于Dots + Luban的Buff模块
unity·游戏引擎
紫龙大侠2 天前
Unity许可证文件(激活成功后)默认保存位置
unity