Plott_1
1
I’ve been going around and I have found the issue. But I dont know how to fix it.
Now for my game i want to have a simple pause menu and thats all nice.
but whenever I test the buttons out it won’t work, it doesn’t show me any type of reaction.
But when I remove my player object and just replace it with another camera and test out the buttons it works.
I’ll leave that there but uppon further inspection I see that if I take off my Mouselook script it works, only thing is i can’t look around anymore. So here is the code
Link: mouselook script: https://github.com/TmPlott/Mouselook/blob/main/Mouselook
Any ideas?
I am currently using the newest version of unity (2021.1.16f1)
here it is copy pasted:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mouselook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90, 90);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
}
Plott_1
2
okey, just disabling the player object diden’t work. but since I knew the camera was the problem I made the camera instead of the player to be disabled and that made it work.