Version: 2021.3
언어: 한국어
public void Clear ();

설명

Removes all points from the TrailRenderer. Useful for restarting a trail from a new position.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private TrailRenderer tr;

void Start() { tr = GetComponent<TrailRenderer>(); tr.material = new Material(Shader.Find("Sprites/Default")); }

void Update() { tr.transform.position = new Vector3(Mathf.Sin(Time.time * 1.51f) * 7.0f, Mathf.Cos(Time.time * 1.27f) * 4.0f, 0.0f); }

void OnGUI() { if (GUI.Button(new Rect(25, 25, 200, 30), "Clear")) tr.Clear(); } }