Question by
CaveGames · Jul 25, 2017 at 09:39 PM ·
canvasresolutionscrollbar
Change Resolution with Script
Hey! I have a problem, I've been trying to make my game change resolutions with a scroll menu...The scroll menu isn't the problem... its the script, Heres my current code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ResolutionScaler : MonoBehaviour
{
public int width;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void R640x480()
{
Resolution.width = 640;
Resolution.height = 480;
}
I have multiple resolutions, so there isn't an ending parenthesis, but the errors I'm getting go along the lines of:
An object reference is required for the non static field, method, or property 'Resolution.width' An object reference is required for the non static field, method, or property 'Resolution.height'
Anyone have a fix? Please put it in the comments.
Comment
Your answer
Follow this Question
Related Questions
Fit an overlay canvas to the same position in all resolutions 1 Answer
UI Appear not appearing after build 0 Answers
Canvas scale 0 Answers
Sprite in Canvas not projected correctly in Maximum playmode 0 Answers