// Use this for initialization void Start() { _Camera = Camera.main; if (_PointerSettings.AutoStart) { _isLeftsAppearing = true; _isRightsAppearing = true; } else { _isLeftsAppearing = false; _isRightsAppearing = false; } gameObject.transform.SetParent(_Camera.transform, false); _controller = new Controller(); pointersObj = new GameObject("Pointers"); pointersObj.transform.SetParent(gameObject.transform, false); leftHandObj = new GameObject("Left Hand"); leftHandObj.transform.SetParent(pointersObj.transform, false); rightHandObj = new GameObject("Right Hand"); rightHandObj.transform.SetParent(pointersObj.transform, false); // 포인터의 중복설정을 확인한다. for (int i = 0; i < _PointerSettings.PointerUsed.Length - 1; i++) { for (int j = i + 1; j < _PointerSettings.PointerUsed.Length; j++) { if (_PointerSettings.PointerUsed[i] == _PointerSettings.PointerUsed[j]) { print("same pointers are detected"); return; } } } // 사용하기로 설정한 포인터타입에만 포인터를 생성한다. foreach (PointerType type in _PointerSettings.PointerUsed) { // 포인터 객체를 만들고 사전에 추가 후 빌드한다. GameObject pointerObj = new GameObject("Pointer_" + type); if (type == PointerType.LeftThumb || type == PointerType.LeftIndex || type == PointerType.LeftMiddle || type == PointerType.LeftRing || type == PointerType.LeftPinky) { pointerObj.transform.SetParent(leftHandObj.transform, false); } else { pointerObj.transform.SetParent(rightHandObj.transform, false); } _pointerDict.Add(type, pointerObj); InteractionManager.SetPointerPos(type, Vector3.one * 9999.0f); ObjectInteractionManager.SetPointerWorldPos(type, Vector3.one * 99999.0f); Pointer pointer = pointerObj.AddComponent <Pointer> (); pointer.Build(_PointerSettings, type); } }