Значение переменной в сбилженной версии игры отличается от значения в самом движке. Unity
У меня есть две переменные которые отвечают за чувствительность мыши и скрипт отвечающий за поворот камеры, который использует эти 2 переменные. Когда я тестирую это в самом Unity никаких проблем нету, но когда я делаю билд под PC и тестирую там, то чувствительность существенно падает.
Я вывел значение обоих переменных на экран и обнаружил что их значение равно 15 и в Unity и в билд версии. Вот скрипт в котором происходит объявления переменных:
using System;
using System.Collections.Generic;
using UnityEngine;
public static class Models {
[Serializable]
public class PlayerSettingsModel {
[Header("Настройки камеры")]
public float ViewXSensivity = 15.0f;
public float ViewYSensivity = 15.0f;
}
}
Вот скрипт камеры:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static Models;
public class PlayerController : MonoBehaviour {
private CharacterController characterController;
private DefaultInput defaultInput;
private Vector2 inputMovement;
[HideInInspector]
public Vector2 inputView;
private Vector3 newCameraRotation, newCharacterRotation;
[Header("Настройки объектов")]
public Transform cameraHolder;
[Header("Настройки")]
public PlayerSettingsModel playerSettings;
public float viewClampYMin = -70f;
public float viewClampYMax = 80f;
public LayerMask playerMask;
private void Awake()
{
defaultInput = new DefaultInput();
defaultInput.Character.Movement.performed += e => inputMovement = e.ReadValue<Vector2>();
defaultInput.Character.View.performed += e => inputView = e.ReadValue<Vector2>();
defaultInput.Enable();
newCameraRotation = cameraHolder.localRotation.eulerAngles;
newCharacterRotation = transform.localRotation.eulerAngles;
characterController = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
}
private void Update()
{
CalculateView();
}
private void CalculateView()
{
newCharacterRotation.y += playerSettings.ViewXSensivity * (playerSettings.ViewXInverted ? -inputView.x : inputView.x) * Time.deltaTime;
transform.localRotation = Quaternion.Euler(newCharacterRotation);
newCameraRotation.x += playerSettings.ViewYSensivity * (playerSettings.ViewYInverted ? inputView.y : -inputView.y) * Time.deltaTime;
newCameraRotation.x = Mathf.Clamp(newCameraRotation.x, viewClampYMin, viewClampYMax);
cameraHolder.localRotation = Quaternion.Euler(newCameraRotation);
}
}
Источник: Stack Overflow на русском