Search Unity

Making a Trail Used for Detection Invisible

Discussion in 'Editor & General Support' started by flannegeddes, Apr 29, 2016.

  1. flannegeddes

    flannegeddes

    Joined:
    Mar 10, 2016
    Posts:
    9
    Hi all,

    I know this has probably been answered before, but I am having a hard time finding a solution. I am not an experienced programmer and am working off code written by someone I had hired to finish this project (and is now no longer responding to messages).

    There is code written into this program (pasted below) which renders a trail behind the player object. This trail is used by another object in the game to detect when the player has made a circle around an object. It is currently set to a default material which does not appear to be editable. I tried adding a material to the object to change the color and while that seems to work, I cannot find a way to make it invisible.


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class DrawALine : MonoBehaviour {
    5.     public GameObject Dot;
    6.     public GameObject Cube;
    7.     public float Distance = 0.0F;
    8.     Vector3 PreviousPos;
    9.  
    10.     // Use this for initialization
    11.     void Start () {
    12.         Cube = GameObject.FindGameObjectWithTag("Player");
    13.         Instantiate(Dot, transform.position, transform.rotation);
    14.         PreviousPos = Cube.transform.position;
    15.     }
    16.     // Update is called once per frame
    17.     void Update () {
    18.         //Distance = Vector3.Distance(PreviousPos, Cube.transform.position);
    19.         Cube = GameObject.FindGameObjectWithTag("Player");
    20.         Distance = Vector3.Distance(PreviousPos, Cube.transform.position);
    21.         if (Distance > .1) {
    22.      //       Debug.Log("You took a Step");
    23.             Instantiate(Dot, Cube.transform.position, Cube.transform.rotation);
    24.             PreviousPos = Cube.transform.position;
    25.         }
    26.         //Instantiate(Dot, Cube.transform.position, Cube.transform.rotation);
    27.     }
    28. }
    29.  
    Please let me know if additional photos or code would be helpful, thank you!
     

    Attached Files: