handzlikchris / handzlikchris/FastScriptReload

Swapping the order of field declarations lead to an unexpected results.

Offen
#197 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When script
``` C#
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;

public class Test : MonoBehaviour
{
int i1;
float i2;

void Start()
{
i1 = 1;
i2 = 1.5f;
}

void Update()
{
Debug.Log(i1);
}
}
```
swap the declaration positions of i1 and i2 and reload to
``` C#
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;

public class Test : MonoBehaviour
{
float i2;
int i1;

void Start()
{
i1 = 1;
i2 = 1.5f;
}

void Update()
{
Debug.Log(i1);
}
}
```
expected output was 1, but the actual output was 1069547520 (this is the value of a 1.5 as an integer in binary).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.