当前位置:网站首页>WebGL给Unity传递参数问题1: Cannot read properties of undefined (reading ‘SendMessage‘)
WebGL给Unity传递参数问题1: Cannot read properties of undefined (reading ‘SendMessage‘)
2022-07-31 11:43:00 【先生沉默先】
Cannot read properties of undefined (reading ‘SendMessage’)
报错信息翻译:无法读取未定义的属性(读取“SendMessage”)
问题:WebGL给Unity传递参数并调用方法,在浏览器报错。


解决方式
缺少一个全局变量,并且没有把创建的全局变量在回调中用unityInstance赋值?这里报错的意思是,你用的“SendMessage”是未定义的,为什么会未被定义呢?是因为你的unityInsace是空的,所以他说你的“SendMessage”的未被定义的。具体步骤是在这篇博客的
https://blog.csdn.net/GoodCooking/article/details/123590928

问题来自
用户的私信。报错的Unity版本为2020.3,
因为Unity更新之后,在WEBGL调用Unity方法和Unity调用WebGL的方法都有所改动了,所以也要根据版本来解决这个问题。
边栏推荐
- Data Lake (19): SQL API reads Kafka data and writes it to Iceberg table in real time
- 无法将“node.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
- 5 open source Rust web development frameworks, which one do you choose?
- 生命不息,刷题不止,简单题学习知识点
- 分布式事务Seata详细使用教程
- 应用层基础 —— 认识URL
- MySQL百万数据优化总结 一
- deeplab implements its own remote sensing geological segmentation dataset
- 关于IDEA开发工具的介绍
- Docker实践经验:Docker 上部署 mysql8 主从复制
猜你喜欢

初始JDBC 编程

【虚拟化生态平台】树莓派安装虚拟化平台操作流程

Mysql环境变量的配置(详细图解)

Docker practical experience: Deploy mysql8 master-slave replication on Docker

The most complete phpmyadmin vulnerability summary

kubernetes之服务发现

Docker实践经验:Docker 上部署 mysql8 主从复制

Docker installs canal and mysql for simple testing and achieves cache consistency between redis and mysql

Read through the interface to call the artifact RestTemplate

"JUC Concurrent Programming - Advanced" 06 - Immutability of Shared Models (Design of Immutable Classes | Use of Immutable Classes | Flyweight Pattern)
随机推荐
Different lower_case_table_names settings for server (‘1‘) and data dictionary (‘0‘) 解决方案
拥抱趋势!阿里这套微服务开源框架权威手册,实战到底层细致清晰
无法将“node.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
DCM 中间件家族迎来新成员
Mysql环境变量的配置(详细图解)
Master SSR
音视频基础
Android studio connects to MySQL and completes simple login and registration functions
kubernetes之服务发现
【虚拟化生态平台】平台架构图&思路和实现细节
LeetCode - 025. 链表中的两数相加
关于IDEA开发工具的介绍
基于Multisim的函数信号发生器–方波、三角波、正弦波[通俗易懂]
Standard SQL/JSON - the sobering part
多线程学习笔记-2.final关键字和不变性
file contains vulnerabilities
最全phpmyadmin漏洞汇总
PyQt5快速开发与实战 9.5 PyQtGraph在PyQt中的应用 && 9.6 Plotly在PyQt中的应用
生信周刊第38期
The principle of v-model