How to Change Canvas Scaler's Reference Resolution in Run Time?

How to Change Canvas Scaler’s Reference Resolution in Run Time?

Try

YourCanvas.GetComponent<CanvasScaler> ().referenceResolution = new Vector2 (1920,1080);