public void onSelect(SimObject item) { if (item.GetType() == typeof(TerrainMaterial)) { setActiveMaterial(item.unSafeCast <TerrainMaterial>()); } else { setActiveMaterial(0); } }