Unityチュートリアル・カメラの追従とズームイン・ズームアウトさせるスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine.UI; | |
public class CameraController : MonoBehaviour { | |
// 『Slider』オブジェクトへの参照 | |
[SerializeField] | |
GameObject sliderObject; | |
// 『ZoomText』オブジェクトへの参照 | |
[SerializeField] | |
GameObject zoomTextObject; | |
// Sliderコンポーネントの参照 | |
Slider zoomSlider; | |
// Textコンポーネントの参照 | |
Text zoomText; | |
// 拡大率のテキストで変数以外の部分を定義 | |
string zoomTextPrefix = "Magnification : "; | |
string zoomTextSuffix = "%"; | |
// 拡大率の最小値と最大値 | |
const int OffsetMin = 50; | |
const int OffsetMax = 150; | |
// カメラの拡大率(%) | |
[SerializeField, Range(OffsetMin, OffsetMax)] | |
int magnify = 100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment