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()
    {
        
    }
}
相关推荐
小贺儿开发19 小时前
《长征 · 征途》Unity 三维互动沙盘
科技·3d·unity·1024程序员节·地形·互动·沙盘
解决小子19 小时前
【虚幻引擎】【C++】【GAS框架】构建角色基类、属性集、数值钳制
c++·笔记·游戏引擎·虚幻·gas·能力系统
上班摸鱼下班游戏20 小时前
Unity 仿生智能算法 从蚁群算法 开始
算法·unity·游戏引擎
Oiiouui1 天前
针对Godot-GridGame(网格游戏)的DI注入+RefCounted数据驱动信号流架构设计的研究(全程开源)
游戏·游戏引擎·godot·1024程序员节
Wanda12141 天前
机器人与机电一体化3D数字孪生机器-Day6
unity·机器人·数字孪生·1024程序员节
淡海水1 天前
07-03-源码-.NET Core GC标记与扫描
unity·c#·.netcore·gc
上班摸鱼下班游戏2 天前
从零开始玩转 DOTween
unity·游戏引擎
阿松爱学习2 天前
【Unity开发】Unity长截图功能实现
unity·c#·游戏引擎
小小数媒成员2 天前
Rect Transform
游戏·unity·游戏引擎
淡海水2 天前
07-01-源码-.NET Core GC总览与架构
unity·架构·c#·.netcore·gc