private void UnSelectCurrent() { if (mSelectedSphere != null) { mSelectedSphere.GetComponent <Renderer>().material.color = Color.blue; mSelectedSphere = null; } }
public void SelectObjectAt(GameObject obj, Vector3 p) { // 1. unselect the current UnSelectCurrent(); if (obj.name == "CreationPlane") { GameObject o = GameObject.CreatePrimitive(PrimitiveType.Sphere); mSelectedSphere = o.AddComponent <ScalableSphere>(); mSelectedSphere.SetSpherePosition(p); } else { mSelectedSphere = obj.GetComponent <ScalableSphere>(); Debug.Assert(mSelectedSphere != null); } SetSelectedColor(); }