首页 > 解决方案 > c#中浮点数数组的定义

问题描述

我有一个数组在它被定义为双精度时起作用。当我将它们传递给 Vector3(用于 Unity 中的某些用途)时,它们需要定义为浮点数,我在定义时似乎无法做到这一点。我究竟做错了什么?

    private float[] coords_x = { -13.3, -48.2, -53.3, -68, -74, -78.9, -79.1, -72.7 };
    private float[] coords_y = { -54.8, -78.3, -81.7, -82, -76.9, -69.2, -54.4, -40.8 };
    private float[] coords_theta = { 124, 124, 115, 96, 50, 0, -25.3, -25.3 };

错误:无法将“double”隐式转换为“float”。存在显式转换(您是否缺少演员表)?

标签: c#

解决方案


推荐阅读