Search Unity

Create a Line from Button 1 to Button 3 in 2D

Discussion in '2D' started by Horror_King, Feb 18, 2020.

  1. Horror_King

    Horror_King

    Joined:
    Nov 16, 2017
    Posts:
    3
    Hello there Geniuses..
    I am Sajjad Ali from Pakistan.
    I am getting trouble making a line between Button 1 to Button 3 in Unity 2D.
    I am making a board game ( Tic Tac Toe ), I am attaching the image as i want the line.
    Please provide me code as simple as you can and in C#.



    Thanks in Advance.
    Love from Pakistan
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi @Horror_King

    "Please provide me code as simple as you can and in C#."

    In general this or any other user forums isn't place to ask tailor made code... if you need work to be done, you can use Unity Connect.

    However, in your case, what you could do:

    - Use LineRenderer to draw line between two points, where points are located in the centers of the edge cells.

    - Just use pre-made textures / sprites if your playfield stays always the same... you only have horizontal, vertical and two diagonal lines, and you could rotate your line to use even smaller amount of line images.
     
    Horror_King likes this.
  3. Horror_King

    Horror_King

    Joined:
    Nov 16, 2017
    Posts:
    3
    Quite Beginner.. Did not understand properly.. By the Way thanks for your answer buddy
     
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    "Quite Beginner.. Did not understand properly"

    I think you should head to Learning section - Unity has extensive set of tutorials available.