yasirkula / unityruntimepreviewgenerator Goto Github PK
View Code? Open in Web Editor NEWGenerate preview textures (thumbnails) for your GameObject's or materials on the fly in Unity
License: MIT License
Generate preview textures (thumbnails) for your GameObject's or materials on the fly in Unity
License: MIT License
RuntimePreviewGenerator.BackgroundColor = Color.clear; //new Color(1, 1, 1, 0); //new Color(0.3f, 0.3f, 0.3f, 0f) ;
tex = RuntimePreviewGenerator.GenerateModelPreview(model.transform ,256,256);
image.texture = tex; // RawImage
Thanks
Hi, when using your script in one of my editor scripts I get the following error when trying to save as PNG:
UnityException: Texture '' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
CreateAssetBundles.SaveTextureToFile (UnityEngine.Texture2D texture, System.String filename) (at Assets/Editor/CreateAssetBundles.cs:37)
CreateAssetBundles.BuildAllAssetBundlesiOS () (at Assets/Editor/CreateAssetBundles.cs:29)
Trying to generate a preview on a simple Unlit/Transparent material on a primitive Quad.
Issue occurs regardless if a render pipeline was set or not.
Tried tweaking player settings with no luck.
Preview Generator configuration:
RuntimePreviewGenerator.PreviewRenderCamera = null;
RuntimePreviewGenerator.PreviewDirection = Vector3.forward;
RuntimePreviewGenerator.BackgroundColor = new Color(1, 1, 1, 0); // Also occurs using Color.clear and a black background;
RuntimePreviewGenerator.Padding = 0;
RuntimePreviewGenerator.OrthographicMode = true;
RuntimePreviewGenerator.MarkTextureNonReadable = false;
Previews work fine in editor, but Android builds using OpenGLES3 seem to ignore transparency on textures. On Vulkan this works correctly, but the platforms I want to support do not support Vulkan.
Specs:
Additional info:
Minimum API Level: 26, Android 8 (Oreo)
Target API Level: 30
Is supersampling or antialiasing available
When render a prefab with Particle System ,the bounds is too larger which make camera too far away ,can't get the true thumbnail.
Description of the bug
A clear and concise description of what the bug is. Before reporting a bug, please do a quick search in Issues to see if it is already reported. If the documentation has a FAQ (Frequently Asked Questions), please also check out the entries there.
Reproduction steps
If possible, providing reproduction steps would be very helpful while pinpointing the issue. You can also post screenshots if you think they would be helpful.
Platform specs
Please provide the following info if this is a Unity 3D repository.
Additional info
Please check Logcat (Android) or Xcode console (iOS) for any meaningful error messages and include them here.
Unity version: 2019.4.7f1
Imported Runtime Preview Generator package.
Configured runtime preview generator, set background color to Color.clear, also tried new Color(0, 0, 0, 0);
In editor this works, but an Android build shows the resulting texture has a black backgorund fully opaque.
We use the alpha of the preview texture to assist us with raycasting and selecting objects in the scene using Google Cardboard.
I have tried OpenGLES3 and Vulkan graphics API but they show the same result.
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.