Search Unity

LineRenderer2D: GPU pixel-perfect 2D line renderer for Unity URP (2D Renderer)

Discussion in 'Made With Unity' started by AlexVillalba, Apr 1, 2021.

  1. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    PlanarBit likes this.
  2. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    New commit:
    Fixed: The multi line was not working properly with OpenGL due to wrong texture sampler configuration.
    Now you can use standard shaders instead of Shadergraph.
    Standard shaders allow to make the line unlit by enabling a checkbox in the material.
    Files moved to 2 folders: Shadergraph and Shaders.
    The .hlsl files are shared among both versions.
    The test scene has been updated. 2 new lines have been added which use the new standard shaders. A 2D point light has been added to demonstrate how the light affects the lines, unless they are unlit.
     
  3. FakePsychotropic

    FakePsychotropic

    Joined:
    Dec 24, 2018
    Posts:
    2
    @ThundThund is there any chance you could help me with basic usage? I am relatively new to Unity, especially shaders. My basic questions are:
    Can this be imported as a package? If so, how?
    If I just run the project, it seems to run as a 3D project, and I can't get any lines to render... How do I get it to run as a 2D project, and what are the instructions for running a basic single line test?
     
  4. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    It's not a package, just copy the files to the right place.
    You may need to press the 2D button at the top bar of the Scene view.
     
  5. FakePsychotropic

    FakePsychotropic

    Joined:
    Dec 24, 2018
    Posts:
    2
    I dug into your code and used one of your prefabs and changed around some project settings and it works beautifully - this is a really cool implementation, and it's exactly what I'm looking to add to my game for a pixel perfect zipline. Thank you for sharing.
     
    AlexVillalba likes this.
  6. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    I'm glad you find it useful.