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()
    {
        
    }
}
相关推荐
老朱佩琪!2 小时前
Unity备忘录模式
java·unity·备忘录模式
一帘多啦A梦2 小时前
解决unity2022.3.x版本项目使用vs无法生成解决方案的问题
unity·vs
weixin_424294674 小时前
Unity LocalPosition 和 Position 的区别?还有其他的Position 没?
unity·游戏引擎
UX20175 小时前
Git LFS 管理 Unity 大文件
git·unity
nnsix5 小时前
Unity WebGL端调用Windows窗口选择文件
unity·游戏引擎·webgl
向宇it5 小时前
【unity游戏开发——网络】使用Unity+PurrNet+Heathens+Steam,在 Unity 中通过 Steam与你的朋友建立联系
网络·游戏·unity·c#·游戏引擎·steam
nnsix6 小时前
Unity 反编译dll(Windows平台)
unity
XR技术研习社6 小时前
四种安装特定版本Package的方法
unity·ar·xr·vr
dzj20217 小时前
Unity行为脚本与编辑器脚本的解耦例子之一
unity·解耦·编辑器脚本·行为脚本
技术小甜甜9 小时前
【Godot】【入门】编辑器界面速通:场景/节点/Inspector/信号(30 分钟上手不迷路)
编辑器·游戏引擎·godot