티스토리 뷰


Debug.zip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class MakeLine : MonoBehaviour 
{
    GameObject obj;
 
    private void FixedUpdate()
    {
        obj = new GameObject("CheckPoint");
        obj.tag = "CheckPoint";
        obj.transform.position = this.transform.position;
    }
}
 
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class DrawLine : MonoBehaviour 
{
    public GameObject[] checkPoint;
 
    private void FixedUpdate()
    {
        checkPoint = GameObject.FindGameObjectsWithTag("CheckPoint");
 
        if(checkPoint.Length > 1)
        {
            for(int i = 0; i < checkPoint.Length - 1; i++)
            {
                Debug.DrawLine(checkPoint[i].transform.position, checkPoint[i + 1].transform.position, Color.green);
            }
        }
    }
}
 
cs


먼저 Tag에 CheckPoint를 만듭니다.



Camera에 DrawLine을 넣어줍니다.



이동경로를 보고싶은 물체에 MakeLine을 넣어주시면



Scene에서 물체가 이동하는 뒤꽁무니를 따라 Line을 그려줍니다.


※코딩지적및비판은 저에게 많은 도움이됩니다.

※코딩질문 또한 많은 도움이 됩니다.


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함