Unityでスクリプトエラーが発生したのですがどうしても解決することができません。
____________________________________________________
Assets/Script/UniAction.cs(12,12): error CS0305: Using the generic method UnityEngine.Component.GetComponent<T>()' requires
1' type argument(s)
____________________________________________________
using UnityEngine;
using System.Collections;
public class UniAction : MonoBehaviour
{
private Animator animator; // Use this for initialization<br> void Start() {
animator = GetComponent();
}
// Update is called once per frame<br> void Update() { if (Input.GetKey("up")) {
transform.position += transform.forward * 0.02f;
animator.SetBool("Walk", true);
}
else if (Input.GetKey("down"))
{
transform.position += transform.forward * -0.02f;
animator.SetBool("Walk", true);
}
else if (Input.GetKey("right"))
{
transform.Rotate(0, 5, 0);
}
else if (Input.GetKey("left"))
{
transform.Rotate(0, -5, 0);
}
else
{
animator.SetBool("Walk", false);
}
}
}
____________________________________________________
もしわかる方がいましたらよろしくお願いします。(_ _)

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/16 15:05
2019/08/17 03:00