public override void OnInspectorGUI() { DrawDefaultInspector(); GridBall gridBall = (GridBall)target; if (GUILayout.Button("Refresh Material")) { EditorCommon.RefreshBallMaterialByColor(gridBall); } }
public static GridBall GenerateGridBall(Transform parentTF) { GameObject gridBallPrefab = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Bubble Shooter VR/Prefabs/GridBall.prefab"); GameObject gridBallGO = (GameObject)PrefabUtility.InstantiatePrefab(gridBallPrefab); GridBall gridBall = gridBallGO.GetComponent <GridBall>(); gridBall.transform.SetParent(parentTF); gridBall.transform.localPosition = Vector3.zero; gridBall.transform.localScale = Vector3.one * 0.7f; gridBall.transform.localRotation = Quaternion.identity; gridBall.ballColor = (BallColor)Random.Range(1, (int)BallColor.LENGTH); EditorCommon.RefreshBallMaterialByColor(gridBall); return(gridBall); }