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()
    {
        
    }
}
相关推荐
Wanda12141 天前
机器人与机电一体化3D数字孪生机器-Day5
人工智能·unity·游戏引擎·数字孪生
Wanda12141 天前
机器人与机电一体化3D数字孪生机器-Day4
3d·unity·机器人·数字孪生
年少无知且疯狂2 天前
【Unity】Shader spine动画冻结效果
unity·spine
淡海水2 天前
05-02-源码-Boehm GC标记阶段
算法·unity·c#·游戏引擎·gc
淡海水2 天前
05-03-源码-Boehm GC分配与碎片管理
开发语言·算法·unity·c#·游戏引擎·gc
WarPigs4 天前
Unity无法修改Assembly-CSharp.csproj错误
unity
FairGuard手游加固4 天前
手游加固怎么做?SO、IL2CPP、AssetBundle 与运行时保护详解
安全·游戏·unity
阿松爱学习6 天前
【Unity开发】监听Scene场景事件
unity·c#
xiaogai_gai6 天前
BOM 物料清单同步实战:金蝶云星空 → 四化智造 MES 修改场景深度拆解
unity·游戏引擎
淡海水6 天前
03-03-架构篇-SGen GC架构解析
unity·架构·c#·gc·sgen