|
|
|
|
|
|
public class ProjectSettingsOverrides : MonoBehaviour |
|
|
|
{ |
|
|
|
// Original values
|
|
|
|
float m_OriginalMonitorVerticalOffset; |
|
|
|
|
|
|
|
Vector3 m_OriginalGravity; |
|
|
|
float m_OriginalFixedDeltaTime; |
|
|
|
float m_OriginalMaximumDeltaTime; |
|
|
|
|
|
|
[Tooltip("Increase or decrease the scene gravity. Use ~3x to make things less floaty")] |
|
|
|
public float gravityMultiplier = 1.0f; |
|
|
|
|
|
|
|
[Header("Display Settings")] |
|
|
|
public float monitorVerticalOffset; |
|
|
|
|
|
|
|
[Header("Advanced physics settings")] |
|
|
|
[Tooltip("The interval in seconds at which physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) are performed.")] |
|
|
|
public float fixedDeltaTime = .02f; |
|
|
|
|
|
|
public void Awake() |
|
|
|
{ |
|
|
|
// Save the original values
|
|
|
|
m_OriginalMonitorVerticalOffset = Monitor.verticalOffset; |
|
|
|
m_OriginalGravity = Physics.gravity; |
|
|
|
m_OriginalFixedDeltaTime = Time.fixedDeltaTime; |
|
|
|
m_OriginalMaximumDeltaTime = Time.maximumDeltaTime; |
|
|
|
|
|
|
// Override
|
|
|
|
Monitor.verticalOffset = monitorVerticalOffset; |
|
|
|
Physics.gravity *= gravityMultiplier; |
|
|
|
Time.fixedDeltaTime = fixedDeltaTime; |
|
|
|
Time.maximumDeltaTime = maximumDeltaTime; |
|
|
|
|
|
|
|
|
|
|
public void OnDestroy() |
|
|
|
{ |
|
|
|
Monitor.verticalOffset = m_OriginalMonitorVerticalOffset; |
|
|
|
Physics.gravity = m_OriginalGravity; |
|
|
|
Time.fixedDeltaTime = m_OriginalFixedDeltaTime; |
|
|
|
Time.maximumDeltaTime = m_OriginalMaximumDeltaTime; |
|
|
|