Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Draw Line

Discussion in 'Scripting' started by petea, Apr 25, 2014.

  1. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    Tell me how to draw the line on the screen, I checked not working?
    console shows not error.
    #pragma strict

    function Start () {
    Debug.DrawLine (Vector3.zero, new Vector3 (0, 10000, 0), Color.red);
    }

    function Update () {
    Debug.DrawLine (Vector3.zero, new Vector3 (10000, 1, 0), Color.green);
    Debug.DrawLine (Vector3.zero, new Vector3 (1, 0, 10000), Color.green);
    Debug.DrawLine (Vector3.zero, new Vector3 (0, 10000, 1), Color.green);
    }
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Debug function are only visible in the SceneView, not in game. Is it what you want?
     
  3. jabez

    jabez

    Joined:
    Nov 2, 2013
    Posts:
    26
    Try
    function OnDrawGizmosSelected () {
    Debug.DrawLine (Vector3.zero, new Vector3 (10000, 1, 0), Color.green);
    }
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  5. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    I need to build the cube of the lines and track the mouse coordinates inside the cube.
     
  6. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
  7. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    no not work

    #pragma strict

    function Start () {
    OnDrawGizmosSelected();
    }



    function OnDrawGizmosSelected () {
    Debug.DrawLine (Vector3.zero, new Vector3 (10000, 1, 0), Color.green);
    }
    function Update () {

    }