Home>
Question

I am developing a game in Unity.
I didn't understand even if I looked it up.
I want to know what's happening with the following 3 lines of code, line by line!

Corresponding source code
  [SerializeField] LineRenderer m_line = null;
    void DrawLaser (Vector3 destination)
    {
        Vector3 [] positions = {m_line.transform.position, destination};
        m_line.positionCount = positions.Length;
        m_line.SetPositions (positions);
    }
Supplementary information (FW/tool version, etc.)

Visual Studio 2019

  • Answer # 1

    Check and understand the following:
    Only after examining all of these will it be "examined".

    LineRendererWhat is a class to do

    Vector3 [] positions = {m_line.transform.position, destination};What is defining

    positions.LengthWhat is

    m_line.positionCountWhat is

    m_line.SetPositions (~);What is

  • Answer # 2

    With Visual Studio you can stop execution at any line and see the contents of the variable
    You can also execute it line by line from there, so let's check the operation like that