Skip to content

Instantly share code, notes, and snippets.

@leventeren
Created September 8, 2021 19:11
Show Gist options
  • Save leventeren/aad1926bff04e54ae693a7f7fd36cea8 to your computer and use it in GitHub Desktop.
Save leventeren/aad1926bff04e54ae693a7f7fd36cea8 to your computer and use it in GitHub Desktop.
Array Resize
public void GroupResize (int Size, ref GameObject[] Group)
{
GameObject[] temp = new GameObject[Size];
for (int c = 1; c < Mathf.Min(Size, Group.Length); c++ ) {
temp [c] = Group [c];
}
Group = temp;
}
void Start ()
{
GameObject[] Test = new GameObject[5];
Debug.Log (Test.Length);
GroupResize (15, ref Test);
Debug.Log (Test.Length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment