C# Assets/line_generator.cs(9,5):错误CS0246:类型或命名空间名称'line';找不到。是否缺少程序集引用?

C# Assets/line_generator.cs(9,5):错误CS0246:类型或命名空间名称'line';找不到。是否缺少程序集引用?,c#,C#,它的给定错误CS)246该行找不到您是否缺少程序集引用有3个脚本所有脚本都是链接的,因此我应该怎么做我无法解决该错误 using System.Collections; using System.Collections.Generic; using UnityEngine; public class line_genertaor : MonoBehaviour { public GameObject linePrefab; Line activeLine; voi

它的给定错误CS)246该行找不到您是否缺少程序集引用有3个脚本所有脚本都是链接的,因此我应该怎么做我无法解决该错误

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class line_genertaor : MonoBehaviour {

    public GameObject linePrefab;

    Line activeLine;

    void Update()

    {
        if (Input.GetMouseButtonDown(0))
        {

            GameObject lineGo = Instantiate(linePrefab);
            activeLine = lineGo.GetComponent<Line>();

        }

        if (Input.GetMouseButtonUp(0))

        {

            activeLine = null;

        }

        if (activeLine != null)
        {
            Vector2 mousePos = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            activeLine.UpdateLine (mousePos);

        }

    }

}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类行\u generator:单一行为{
公共游戏对象线预制;
活性线;
无效更新()
{
if(Input.GetMouseButtonDown(0))
{
GameObject lineGo=实例化(linePrefab);
activeLine=lineGo.GetComponent();
}
if(Input.GetMouseButtonUp(0))
{
activeLine=null;
}
如果(activeLine!=null)
{
Vector2 mousePos=Camera.main.ScreenToWorldPoint(Input.mousePosition);
activeLine.UpdateLine(mousePos);
}
}
}

您的代码看起来像来自这里:


然后,您可能缺少的是Line类,它在这里定义:

添加一个对该类
Line
所在名称空间的引用。