Skip to content

Instantly share code, notes, and snippets.

@hecres
Created March 4, 2018 12:22
Show Gist options
  • Select an option

  • Save hecres/d117e3f67eeef109deea982a3390c0e0 to your computer and use it in GitHub Desktop.

Select an option

Save hecres/d117e3f67eeef109deea982a3390c0e0 to your computer and use it in GitHub Desktop.
オブジェクトサイズ=画面サイズとするフィッター処理
private void FillScreen()
{
// orthographicSizeはカメラの垂直サイズの半分です。
var worldHeight = targetCamera.orthographicSize * 2f;
var worldWidth = worldHeight / Screen.height * Screen.width;
transform.localScale = new Vector3(worldWidth, worldHeight);
var tempPosition = Camera.main.transform.position;
tempPosition.z = 0f;
transform.position = tempPosition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment