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()
    {
        
    }
}
相关推荐
孟无岐9 小时前
【Laya】Socket 使用指南
websocket·typescript·游戏引擎·游戏程序·laya
tealcwu12 小时前
【Unity资源】Unity MCP 介绍
unity·游戏引擎
晚霞的不甘14 小时前
Flutter for OpenHarmony 引力弹球游戏开发全解析:从零构建一个交互式物理小游戏
前端·flutter·云原生·前端框架·游戏引擎·harmonyos·骨骼绑定
Thomas_YXQ16 小时前
Unity3D中提升AssetBundle加载速度的详细指南
java·spring boot·spring·unity·性能优化·游戏引擎·游戏开发
Miss_SQ17 小时前
Unity接入AI—Deepseek,数据流式传输
unity·ai
chillxiaohan18 小时前
unity 批量修改场景内字体工具
unity
晚霞的不甘19 小时前
Flutter 方块迷阵游戏开发全解析:构建可扩展的关卡式益智游戏
前端·flutter·游戏·游戏引擎·游戏程序·harmonyos
ellis19701 天前
Unity中ScriptableObject用法整理
unity
玉梅小洋2 天前
Unity Muse 完整使用文档:Sprite+Texture专项
unity·ai·游戏引擎
能源革命2 天前
Three.js、Unity、Cesium对比分析
开发语言·javascript·unity