Error: CompareBaseObjectsInternal can only be called from the main thread
hi, we’re working on a project where we need to do some calculations on a separate thread. The data we need for the calculations is stored on a scriptable object. We use the scriptable object so that we can
serialize the data and save it as an asset file. However, when we tried to access the data from a separate thread we get the following error.
CompareBaseObjectsInternal can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
For our purposes we only need to read the data. One of the things that we tried to do to get around this was to use an interface. It appears that if you use an interface as a reference to the object then you’re able to access the data without getting that error.
For exampleCode:
public class Node : ScriptableObject { public int[] data; } List<Node> dataset; .. // Error, this fails inside of thread Node node = dataset[i];this works:
Code:
public interface INodeData { int[] data { get; } } public class Node : ScriptableObject, INodeData { public int[] data; } List<INodeData> dataset; .. // this works! inside of thread INodeData node = dataset[i];
Error: CompareBaseObjectsInternal can only be called from the main thread的更多相关文章
- Unity3d报告奇怪的错误CompareBaseObjectsInternal can only be called from the main thread.
其中使用了该项目.NET的Async Socket代码.后来不知道什么时候这个奇怪的错误的出现: CompareBaseObjectsInternal can only be called from ...
- [原]openstack-kilo--issue(十九) ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named main
查看此问题的时候请先查看 这个问题包含在(十)中,此篇只是从(十)中分离出来 openstack-kilo--issue(十)ERROR: openstack Unable to establish ...
- [java] [error] java.lang.OutOfMemoryError: unable to create new native thread
前言 最近公司的服务器出现了oom的报错,经过一番排查,终于找到了原因.写下这篇博客是为了记录下查找的过程,也是为了帮助那些跟我门遇到的情况相同的人可以更快的寻找到答案. 环境 系统:linux(ce ...
- Unity 中 使用c#线程
使用条件 天下没有免费的午餐,在我使用unity的那一刻,我就感觉到不自在,因为开源所以不知道底层实现,如果只是简单的做点简单游戏,那就无所谓的了,但真正用到实际地方的时候,就会发现一个挨着一个坑 ...
- SFTP & FTP Upload
简述 >> FTP: 1. Install FTP service on Linux(Red Hat) as root user [root]# yum install ftp 2. ...
- CompletableFuture的使用例子
1. CompletableFuture的介绍 在Java8时被引入,在包java.util.concurrent下,是Java多线程编程中的一个类,扩展了Future中很多功能,Completabl ...
- 【Linux】关于Linux的系统编程总结
作者:李春港 出处:https://www.cnblogs.com/lcgbk/p/14673383.html 目录 系统编程 (一)进程 1.进程的概念 2.进程函数接口 (1)fork()在进程内 ...
- error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用
MSVCRTD.lib(crtexew.obj) : error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用 Debug ...
- MSVCRTD.lib(mfc.obj) : error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainC (转)
一.问题描述 我所使用的编程环境:VS2010 出现的问题如下: MSVCRTD.lib(mfc.obj) : error LNK2019: 无法解析的外部符号_WinMain@16,该符号在函数 _ ...
随机推荐
- 使用autofac在mvc5下依赖注入
把遇到的问题汇总一下: 一.安装mvc5版本 命令:pm> Install-Package Autofac 结果安装的Autofac.Integration.Mvc(版本为4.0),所引用的依赖 ...
- Super超级ERP系统---(7)货位管理
货位是ERP系统总的仓库管理中必不可少的,仓库是有货架组成,货架上的每个格子就是一个货位,所有货位上的商品的库存总和就是仓库商品的库存.仓库的货位主要分为货架和托盘,货架就是仓库的固定货位,托盘就是移 ...
- king枚举帮助类
可以方便的实现枚举 枚举 public enum DeptType { [Description("科室1")] Professional = , [Description(&qu ...
- 【Oracle】闪回技术
1.闪回技术描述 2.数据库的准备: --undo表空间要设置成AUTO,设置合适的保存时间.undo表空间: SYS@ENMOEDU> show parameter undo NAME TYP ...
- go开发和运行环境的配置
1.运行环境的下载.安装.配置: 下载:http://www.golangtc.com/download 官网下载经常被墙屏蔽,所以就从golang中国下载; 安装及其配置:http://jingy ...
- vsftp进阶-锁定目录
把用户锁定到特定的目录下面: 一.配置文件: #grep -Ev "^#|^$" /etc/vsftpd/vsftpd.conf anonymous_enable=NOlocal_ ...
- 路飞学城Python-Day77
11-DIY一个web框架3 web框架 yuan功能总结 main.py: 启动文件,封装了socket 1 urls.py: 路径与视图函数映射关系 ---- url控制器 2 views.py ...
- 【Java编程】volatile和transient关键字的理解
理解volatile volatile是java提供的一种轻量级的同步机制,所谓轻量级,是相对于synchronized(重量级锁,开销比较大)而言的. 根据java虚拟机的内存模型,我们知道 ...
- react阻止无效重渲染的多种方式
在开发React组件的过程中,我们经常会遇到这个问题:什么情况下组件会重新渲染? 当内部data发生改变,state发生改变(通过调用this.setState()) 以及父组件传过来的props发生 ...
- IOS与h5交互记录
博主之前做过移动端app嵌入网页,与Android和IOS有交互,一直没有时间分享过程.这里不多说Android交互啦-很简单,详细了解IOS与h5的交互吧. IOS不同语法和h5的交互所建立的JSB ...