Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

400
Vistas
Why is float.IsFinite “not defined” in Unity?

When I use float.IsFinite(float f) in a C# shell, I have no problems. However, when I use it in the context of Unity, I get an error alleging that it is not defined:

error CS0117: 'float' does not contain a definition for 'IsFinite'

Here is the relevent code:

public static bool IsFinite(Unit u) => float.IsFinite(u.blocks);

Unit is a struct in which I wrote the above line.

My question is: why does this error appear and how can I fix it?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

float.IsFinite exists in .NET 5, .NET Standard 2.1 and .NET Core 2.1. However Unity supports neither of those frameworks, just .NET Standard 2.0. This is why you cannot use the function here.

However it´s easy to create a workaround for the lack of that function:

public static bool IsFinite(Unit u) => !float.IsInfinity(u.blocks)

There´s an angoing discussion at Unitity support forum about .NET 5

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda