Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active May 15, 2018 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/273baa243745aa88cffb15e43588ce10 to your computer and use it in GitHub Desktop.
Save tsubaki/273baa243745aa88cffb15e43588ce10 to your computer and use it in GitHub Desktop.
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