Skip to content

Instantly share code, notes, and snippets.

@Frank-Buss
Created February 26, 2020 09:05
Show Gist options
  • Save Frank-Buss/678ee83938f25b0dde0980f922fca127 to your computer and use it in GitHub Desktop.
Save Frank-Buss/678ee83938f25b0dde0980f922fca127 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private static System.Type[] types = {
typeof(Integer),
typeof(Long),
typeof(String)};
public void test(int ID)
{
System.Type type = default;
if (ID >= 0 && ID < types.length) {
type = types[ID];
}
// do something with type
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment