This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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