Answer the question
In order to leave comments, you need to log in
'Camera' does not contain a definition for 'main'?
'Camera' does not contain a definition for 'main'? What is the problem? tell me please
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BG : MonoBehaviour
{
void Start()
{
var height = Camera.main.ortographicSize * 2f;
var width = height * Screen.width / Screen.height;
if (gameObject.name == "Background")
{
transform.localScale = new Vector3(width, height, 0);
}
}
}
Answer the question
In order to leave comments, you need to log in
What is the problem?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question