cocos creator 3.0 一直警告这个是什么意思?

You are explicitly specifying undefined type to cc property “target” of cc class “cc.TargetOverrideInfo”.
Is this intended? If not, this may indicate a circular reference.
For example:

// foo.ts
import { _decorator } from ‘cc’;
import { Bar } from ‘./bar’; // Given that ‘./bar’ also reference ‘foo.ts’.
// When importing ‘./bar’, execution of ‘./bar’ is hung on to wait execution of ‘foo.ts’,
// the Bar imported here is undefined until ‘./bar’ finish its execution.
// It leads to that
@_decorator.ccclass // ↓
export class Foo { // ↓
@_decorator.type(Bar) // → is equivalent to @_decorator.type(undefined)
public bar: Bar; // To eliminate this error, either:
// - Refactor your module structure(recommended), or
// - specify the type as cc class name: @_decorator.type('Bar'/* or any name you specified for Bar */)
}

循环引用?

是说你的A,B两个脚本之间循环引用了。

没有的,我才3个脚本文件

引擎自身原因

没法解决吗

下个版本就好了

能不能用于正式项目?

3.0.1马上就出来了

3.1.2空项目还有这个问题

3.3.1 +1

引擎内部确实有循环引用,我们尽快修复

3.3.1是在哪里提示这个问题呢?

能否把报错信息发一下?

报错是这个


代码是这样的

不知道是不是用法错误 :sweat_smile:


看一下是不是功能裁剪里把“基础3D功能”给钩掉了。这样会导致MeshRender类型找不到。

这里的提示是表示@property后面括号里的类型传入了一个’undefined’,有可能是模块没有导出,也有可能是循环引用导致的~

好像确实没有打开,谢谢大佬 :rofl:

我之前判断有问题,其实引擎内部只是 Type 类型的引用,不会引起循环引用问题,楼主说的问题在 3.0.1 就修复了,为了防止因为不同的问题挖坟,此问题关闭