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()
    {
        
    }
}
相关推荐
死也不注释8 小时前
【第零章编辑器开发与拓展】
unity·编辑器
死也不注释9 小时前
【第一章编辑器开发基础第二节编辑器布局_3GUI元素和布局大小(3/4)】
unity·编辑器
KhalilRuan1 天前
Unity Demo-3DFarm详解-其二
unity·游戏引擎
死也不注释2 天前
【unity编辑器开发与拓展EditorGUILayoyt和GUILayoyt】
unity·编辑器·游戏引擎
Zillionnn3 天前
Unreal Engine 自动设置图像
游戏引擎·虚幻
3 天前
Unity开发中常用的洗牌算法
java·算法·unity·游戏引擎·游戏开发
马特说3 天前
Unity VR手术模拟系统架构分析与数据流设计
unity·系统架构·vr
心前阳光4 天前
Unity WebGL文本输入
unity·游戏引擎·webgl
天涯过客TYGK4 天前
unity A星寻路
unity·游戏引擎
KhalilRuan4 天前
Unity Demo——3D平台跳跃游戏笔记
笔记·游戏·unity·游戏引擎