问题的出现与描述

在Unity中创建一个NPC,使它一直跟踪一个目标Destination,C#脚本代码如下,错误信息描述如下

using System.Collections;
using System.Collections.Generic;
using UnityEngine; public class FollowDestination : MonoBehaviour {
private NavMeshAgent ThisAgent = null;
public Transform Destination = null; void Awake()
{
ThisAgent = GetComponent<NavMeshAgent>();
}
// Use this for initialization
void Start () { } // Update is called once per frame
void Update () {
ThisAgent.SetDestination(Destination.position);
}
}

解决方案

根据提示信息我知道原因是 “缺失的是引用UnityEngine.AI命名空间的指令 ”,所以我们要在FollowDestination.cs 中加上 using UnityEngine.AI

Assets/FollowDestination.cs(6,13): error CS0246: The type or namespace name `NavMeshAgent' could not be found. Are you missing `UnityEngine.AI' using directive?的解决方案的更多相关文章

  1. [virsh] error: unknown OS type hvm解决办法

    今天在linux服务器上编译安装升级了下qemu,升级命令如下: root@ubuntu:/opt/qemu-# ./configure --prefix=/usr/local/ --target-l ...

  2. ASP.NET MVC 提示there was error getting the type的解决方法

    在MVC中根据模型类创建控制器时提示there was error getting the type的原因是你新建的这个类模型文件后没有重新生成,先重新生成项目就可以添加控制器了.

  3. jersey处理支付宝异步回调通知的问题:java.lang.IllegalArgumentException: Error parsing media type 'application/x-www-form-urlencoded; text/html; charset=UTF-8'

    tcpflow以流为单位分析请求内容,非常适合服务器端接口类服务查问题 这次遇到的问题跟支付宝支付后的回调post结果有关 淘宝的代码例子: public void doPost(HttpServle ...

  4. Ubuntu urllib2.URLError:<urlopen error unknown url type:https>

    描述: python中urllib2 下载网页时,出现错误urllib2.URLError:<urlopen error unknown url type:https> 解决方法: pyt ...

  5. Solve Error: 'has incomplete type', foward declaration of 'class x'

    在C++的OOB编程中,有时候我们会遇到这样的错误Error: 'has incomplete type',forward declaration of 'class x',那么是什么原因引起的这个问 ...

  6. scala 2.11报错error: not found: type Application

    FROM: http://j-q-j.org/scala/scala-2-11-application-error.html 这两天学习scala,官网下载的最新版本2.11,书用的是<Prog ...

  7. error: unkown OS type hvm 解决方法 kvm libvirtd 重新加载已有虚拟机信息

    想验证下最新版本的qemu的一些功能,于是将其从qemu-0.12升级到了qemu-1.4,编译安装一切都很顺利,但是当创建virtual machine时,报错如下: [root@compute-- ...

  8. {"timestamp":"2019-11-12T02:39:28.949+0000","status":415,"error":"Unsupported Media Type","message":"Content type 'text/plain;charset=UTF-8' not supported","path":&quo

    在Jmeter运行http请求时报错: {"timestamp":"2019-11-12T02:39:28.949+0000","status&quo ...

  9. 安装mysql 初始化的时候报错 Can't find file: './mysql/db.frm' (errno: 13) ERROR: 1017

    目录下没有权限 需要权限

随机推荐

  1. ie6遮罩层兼容 100%高度的实现

    .black { position:absolute;width:100%;height:100%;opacity:0.5;filter:alpha(opacity=50);background:#0 ...

  2. ES6,新增数据结构WeakSet的用法

    WeakSet和Set类似,同样是元素不重复的集合,它们的区别是WeakSet内的元素必须是对象,不能是其它类型. 特性: 1.元素必须是对象. 添加一个number类型的元素. const ws = ...

  3. 导入第三方Jar包到Nexus私服

    公司里面有自己的公共代码库,如果希望交给Maven进行管理,可以搭建Nexus服务器,将公司的公共代码库的代码打成jar包,然后上传到Nexus私服服务器上,项目组的成员就可以在Maven项目中通过添 ...

  4. Mysql下SELECT的结果集作为UPDATE的WHERE条件时的SQL语法

    UPDATE `WarningSendMail` AS alias_1 INNER JOIN (SELECT * FROM `WarningSendMail` WHERE flag=1 AND top ...

  5. poj2528(线段树+区间离散)

    题意:那个城市里要竞选市长,然后在一块墙上可以贴海报为自己拉票,每个人可以贴连续的一块区域,后来帖的可以覆盖前面的,问到最后一共可以看到多少张海报.思路:一看就知道是线段树,只是说要利用到离散化,也不 ...

  6. 无刷新文件上传 利用iframe实现

    效果如图: 示例是基于asp.net mvc实现的 html代码: <form id="form2" name="form2" class="f ...

  7. 开发错误处理记录(无法激活服务,因为它不支持 ASP.NET 兼容性)

    错误提示:无法激活服务,因为它不支持 ASP.NET 兼容性.已为此应用程序启用了 ASP.NET 兼容性.请在 web.config 中关闭 ASP.NET 兼容性模式或将 AspNetCompat ...

  8. java基础篇---正则表达式

    正则表达式在许多语言,例如Perl.PHP.Python.JavaScript和JScript,都支持用正则表达式处理文本,一些文本编辑器用正则表达式实现高级“搜索-替换”功能. 正则表达式是一种可以 ...

  9. bootstrapTable刷新当前页码不变和从第一页开始查询

    function searchAgencyProject(){ $("#statisticalProjectListTable").bootstrapTable('refresh' ...

  10. jQuery 实现前端模糊匹配与首字母搜索

    实现效果 源码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <t ...