public override void OnInspectorGUI() { //gets the TestRotation reference TestRotation rotationTester = (TestRotation)target; DrawDefaultInspector(); //creates a button that calls Test when Pressed if (GUILayout.Button("Print Rotation")) { rotationTester.Test(); } }
void InitPlayer() { GameObject player = GameObject.Find("player"); if (player == null) { GameObject p = Instantiate(_playerPrefab); p.name = "player"; player = p; _player = player; } if (player == null) { Debug.LogError("player == null"); } Vector3 startPos = _startPoint.transform.position; player.transform.position = new Vector3(startPos.x, startPos.y, startPos.z); control userControl = player.GetComponent <control>(); userControl._joystick = _joystick; Debug.Log("moveForce :" + userControl.MoveForce); userControl.MoveForce = 10.0f; TestRotation rotationControl = player.GetComponentInChildren <TestRotation>(); rotationControl._rjoystick = _rjoystick; }