Create a gist now

Instantly share code, notes, and snippets.

Embed
using System.Collections;
using System.Collections.Generic;
using Unity.IL2CPP.CompilerServices;
using UnityEngine;
[Il2CppSetOption(Option.NullChecks, false)]
public sealed class SampleBehaviour : MonoBehaviour {
struct Point
{
public int x;
public int y;
}
Point[] points = new Point[]
{
new Point(){y = 1},
new Point(){y = 2},
new Point(){y = 3},
};
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
void Awake()
{
int length = points.Length;
for (int i=0; i< length; i++)
{
var p = points[i];
p.x = p.y;
points[i] = p;
}
var p2 = points[2];
p2.x = 12;
points[2] = p2;
}
void Start()
{
for (int i = 0; i < points.Length; i++)
Debug.Log(points[i].x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment