Commit 5dc8452e authored by HaTrungVI's avatar HaTrungVI

Trung: Fix resolution

parent a571ff95
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
...@@ -1614,6 +1614,53 @@ MonoBehaviour: ...@@ -1614,6 +1614,53 @@ MonoBehaviour:
m_RequiresDepthTexture: 0 m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0 m_RequiresColorTexture: 0
m_Version: 2 m_Version: 2
--- !u!1 &2033920571
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2033920573}
- component: {fileID: 2033920572}
m_Layer: 0
m_Name: AvoidNativeResolution
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2033920572
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2033920571}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f0a0975d01fd0d342978f3a3013b4d73, type: 3}
m_Name:
m_EditorClassIdentifier:
totalChange: 1
overideScale: 0.7
perfectFps: 60
fullScreen: 1
--- !u!4 &2033920573
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2033920571}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 868.60455, y: 1069.564, z: -942.7166}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2044911679 --- !u!1001 &2044911679
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AvoidNativeResolution : MonoBehaviour
{
public int totalChange = 1;
[Range(0f, 1f)] public float overideScale = 1f;
[Range(30, 60)] public int perfectFps = 60;
public bool fullScreen = true;
private int originWidth;
private int originHeight;
private int currentWidth;
private int currentHeight;
public static int count = 0;
private void Awake()
{
Screen.sleepTimeout = SleepTimeout.NeverSleep;
}
private void Start()
{
if (count < totalChange)
{
originWidth = Screen.width;
originHeight = Screen.height;
currentWidth = (int)(originWidth * overideScale);
currentHeight = (int)(originHeight * overideScale);
Screen.SetResolution(currentWidth, currentHeight, fullScreen, perfectFps);
Application.targetFrameRate = perfectFps;
count += 1;
}
}
}
fileFormatVersion: 2
guid: f0a0975d01fd0d342978f3a3013b4d73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment