private static void AddBarChartTMProOption() { GameObject gameObject = new GameObject("BarChart - TMPro"); BarChart barchart = gameObject.AddComponent <BarChart> (); barchart.AxisConfig.HorizontalAxisConfig.AxisLabelPrefab = Resources.Load <ChartLabel> ("prefabs/TMProAxisLabelPrefab"); barchart.AxisConfig.VerticalAxisConfig.AxisLabelPrefab = Resources.Load <ChartLabel> ("prefabs/TMProAxisLabelPrefab"); barchart.Config.PopupPrefab = Resources.Load <ChartValuePopup> ("prefabs/TMProChartValuePopup"); if (Selection.transforms.Length > 0) { gameObject.GetComponent <RectTransform> ().SetParent(Selection.transforms[0], false); } gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(300f, 200f); }