Hi i am making a script that rotates the charecter when a button pressed.Heres the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayButtonScript : MonoBehaviour
{
private CharecterMovementScript charecterMovementScript;
private GunScript gunScript;
private CameraRotation cameraRotation;
public GameObject Player;
public GameObject Gun;
public GameObject TheMenu;
public GameObject crosshair;
public GameObject PlayerSpawnPoint;
void Start()
{
charecterMovementScript = FindObjectOfType<CharecterMovementScript>();
gunScript = FindObjectOfType<GunScript>();
cameraRotation = FindObjectOfType<CameraRotation>();
Player = FindObjectOfType<GameObject>();
}
public void OnButtonPress()
{
charecterMovementScript.enabled = true;
gunScript.enabled = true;
cameraRotation.enabled = true;
Gun.SetActive(true);
Cursor.lockState = CursorLockMode.Locked;
TheMenu.SetActive(false);
crosshair.SetActive(true);
Player.transform.Rotate(0f, 180f, 0f)
}
}
It should work but it doesn’t and idk why.
and the players rotation is 0,0,0.
Idk why it happens,can someone help?