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()
    {
        
    }
}
相关推荐
wgslucky12 小时前
Godot GDScript初学者遇到的问题记录
游戏引擎·godot
点心的游戏开发世界14 小时前
GDScript 入门笔记(五):函数
笔记·游戏引擎·godot
谢斯17 小时前
[unity]如何在unity中添加newtonsoft-json
unity·json·游戏引擎
天人合一peng18 小时前
Unity标记固定颜色及投影标记
unity
云雨巫山21 小时前
Unity 游戏开发性能优化全景手册
unity·智能手机·性能优化·游戏引擎
maybeyaluokenai1 天前
unity build in渲染管线概述
unity·图形渲染
学习星球1 天前
AI 原生游戏开发:Godot 4 + AI Agent 全栈指南(Ziva 3 / Godot MCP 深度实战)
人工智能·游戏引擎·godot
云雨巫山1 天前
Unity 性能优化 · 图解全景手册
unity·性能优化·游戏引擎
Madokaly2 天前
DOTween的Vector3Plugin
unity
点心的游戏开发世界2 天前
GDScript 入门笔记(二):变量与数据类型
笔记·游戏引擎·godot