Skip to content

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

Description

@Tsuku-Yomi

When script

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

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions