hcq0618 / unity-imageloader Goto Github PK
View Code? Open in Web Editor NEW用于Unity中的图片异步显示加载库 async load and display image in unity
License: MIT License
用于Unity中的图片异步显示加载库 async load and display image in unity
License: MIT License
My Unity app loads lots of large images from a server, this causes Unity to freeze while decoding and rendering the image becuase this is all done on the main thread.
Does your code still use the main thread to load the images onto textures?
To test have a code like this
void Update()
{
transform.rotate(Vector3(1,0,0)* Time.deltatime*10);
}
Run that while loading several images using your code, see if the object being rotated ever pauses and then resume rotation.
Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
texture.LoadImage(data);
纹理创建和纹理数据载入不能在子线程中做,只能在主线程。一旦下载的图片是png、jpg等格式,LoadImage内部会解码元数据格式到ARGB32,这个是比较花费CPU的,所以图片多一些的时候,卡顿会很明显。好一点的做法考虑在收到http下载的图片数据后。自己写一个解码图片的函数在线程中计算解码。然后在主线程中把解码后的数据直接通过SetPixels或LoadRawTextureData。这样会减少卡顿。
Hello, I found your project is very promising.
Can you please provide any working sample?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.