fliiamountを用いて、マウスのクリックにより増減するゲージを下記のサイトを引用してスクリプトを作成しました。
https://www.ame-name.com/archives/94
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class fillamount : MonoBehaviour { // Start is called before the first frame update void Start() { public Image image; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetMouseButton(0)) { image.fillAmount -= Time.deltaTime; } else { image.fillAmount += Time.deltaTime; } } }
そうしたところ下記のエラーが発生しましたが、どのように対応すればよろしいでしょうか?
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
よろしくお願いいたします。
あなたの回答
tips
プレビュー