当前位置:网站首页>Unity 子线程调用主线程的UI
Unity 子线程调用主线程的UI
2022-06-22 13:04:00 【苍狼王unity学院】
Unity 子线程调用主线程的UI
1.在Unity中,子线程是无法调用Unity主线程的API的,因为unity不允许这么干。
将子线程中需要调用的函数,通过委托传递给Loom中的委托列表,在Loom中去调用该委托。因为Loom是继承MonoBehavior的,挂载在空物体上面,所以由他去执行委托,自热是没问题的!
2.详细思路:一开始在Unity中创建一个新物体obj,挂上Loom脚本。
Loom中有List listActions;
将子线程中的函数,以委托的形式,传递给listActions,Loom在Updata里面,轮询去调用委托。
巧妙的将子线程无法调用主线程的API 转化为 子线程传递给空物体上面的Loom,在Loom里面去调用委托来调用主线程API。
using UnityEngine;
using System.Collections.Generic;
using System;
using System.Threading;
using Sy
边栏推荐
- Seven cattle cloud upload picture
- Are you familiar with redis cache of highly paid programmers & interview questions series 114? How are redis keys designed? Are you familiar with the memory obsolescence mechanism?
- 《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》
- CVE-2022-22965複現
- 力扣每日一练之双指针2Day9
- How many days are there between the two timestamps of PHP
- ThoughtWorks.QRCode和ZXing.Net 二维码,网址可以直接跳转
- ThoughtWorks. QRcode and zxing Net QR code, URL can be directly jumped
- 想知道股票开户优惠链接,如何得知?网上开户安全么?
- 数据库 就业咨询系统求各位帮下忙
猜你喜欢

线下实体店结合VR全景,让虚拟购物更加真实

Policy deployment of firewall Foundation

How to understand fold change? Multiple analysis?

Query rewriting for opengauss kernel analysis

防火墙基础之策略部署
How MySQL enables multiple auto incrementing columns in a table

Chip silicon and streaming technology

测试组的任务职责和测试的基本概念

Instanceinforeplicator class of Eureka (service registration auxiliary class)

JS advanced programming version 4: learning iterators
随机推荐
Word skills summary
Quickly understand the commonly used symmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
JasperReport报表生成工具的基本使用和常见问题
防火墙基础之策略部署
Chapter 1 overview of naturallanguageprocessing and deep learning
Chip silicon and streaming technology
My suggestions on SAP ABAP transformation
client-go gin的简单整合九-Create
Oracle's skills in dealing with inserting duplicate records
If you want to know the stock account opening discount link, how do you know? Is it safe to open an account online?
SQL Server common functions
Some common SQL (version 05 and above) database maintenance scripts
数据库中如何使用SQL进行修改&删除
Which securities company is good for retail investors to open an account? Is it safe to open a mobile account?
SQL and Oracle statements for eliminating duplicate records
Istio服务网格中的流量复制
Microservice test efficiency governance
Flink状态管理
uniapp app 端截屏且保存到本地
成都测试设备开发_单片机C语言之数组介绍