// 生け花を花器毎削除 void ClearIkebana() { foreach (Transform ch in ikebanaRootObj.transform) { Destroy(ch.gameObject); } GameObject leftGrabObject = null; GameObject rightGrabObject = null; if (leftHandState.isFlowerGrabbing) { leftGrabObject = leftHandState.GetComponent <OVRGrabber>().grabbedObject.gameObject; } if (rightHandState.isFlowerGrabbing) { rightGrabObject = rightHandState.GetComponent <OVRGrabber>().grabbedObject.gameObject; } // 生けてない花を削除 foreach (ItemObject itemObj in Resources.FindObjectsOfTypeAll <ItemObject>()) { GameObject targetObj = itemObj.gameObject; // 手に持っていない花またはアイテムを削除 if (leftGrabObject != targetObj && rightGrabObject != targetObj) { Destroy(itemObj.gameObject); } } }