MicroSoft Docsを見ると,「thisキーワードはクラスの現在のインスタンスを参照します」とあるのですがよくわかりません.
Teratailにあるthisはあるクラスのメンバーであることを表すという説明なら分かるのですが...
例えば下記のコードだとthis.GetComoponent・・・のthisはクラス名を指すと思うのですが(ImageMove) インスタンスを参照するとはどういうことなのでしょうか.
よろしくおねがいします.
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class ImageMove : MonoBehaviour { 6 7 // Use this for initialization 8 void Start () { 9 10 } 11 12 // Update is called once per frame 13 void Update () { 14 Transform tr = this.GetComponent<Transform>(); 15 Vector3 pos = tr.position; 16 pos.x = Random.Range(-2.0f, 2.0f); 17 pos.y = Random.Range(-2.0f, 2.0f); 18 tr.position = pos; 19 } 20} 21

回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。