cocos creator “TypeError: Cannot set property ‘string‘ of null

背景:
学习cocos creator时遇到"TypeError: Cannot set property 'string' of null" 错误。

具体代码如下:

    @property({
    type: Label })
    public stepsLabel: Label | null = null;

	update(deltaTime: number) {
   
		this.stepsLabel.string = '' + Math.floor(this.count/600);
	}
原因:还是要注意的,我记得我当时有进行挂载的

在这里插入图片描述

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-08 00:34:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-08 00:34:03       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-08 00:34:03       87 阅读
  4. Python语言-面向对象

    2023-12-08 00:34:03       96 阅读

热门阅读

  1. OWASP Web 安全测试指南 WSTG -Web 安全测试框架

    2023-12-08 00:34:03       60 阅读
  2. 小程序如何刷新当前页面?

    2023-12-08 00:34:03       56 阅读
  3. python中的map函数

    2023-12-08 00:34:03       70 阅读
  4. Kubernetes学习笔记-Part.02 Docker版本

    2023-12-08 00:34:03       58 阅读