Powerful Preview - is an asset, that helps you to extend and improve your custom assets with a nice preview-area.
It allows your users to navigate through the preview and interact with the content.
Make your assets more user-friendly with cool visual information about assets data.
Create controls for the preview, e.g. timeline, and put any UI element on the preview-bar, so you will have a quick access to any tool and functionality you want.
Features:
Easy to use - all you need to make preview work is the next code snippet:
Well documented.
Five tutorials and three sample assets - that show how to use and implement almost every feature of the Powerful Preview.
Wide camera settings - work with the preview camera just like you do with the original Unity camera.
Add as many objects as you need inside the preview.
Draw visual information inside the preview - e.g. skeleton hierarchy, camera frustum.
Add preview controls and put UI elements on the preview bar.
Canvas Preview - is an extension to the Powerful Preview asset, that allows you to preview your canvas prefabs.
Also, it’s an example of what you can achive through the Powerful Preview asset.
Features:
It’s not static, so it changes as the canvas changes (only Scaler right now).
It works with any UI element.
It handles children canvases.
In Updates:
Implement handling for any canvas components: layouts, filters, groups etc.
Canvas elements adding, removing and editing through the preview.
There are three sample prefabs, that show how preview works.
Samples Screenshots
This plugin looks very interesting, I just want to know if you can add the ability to take a screen shot of the preview, If yes, then I will definitely buy this amazing plugin!
//Put this code into either OnUpdate() or OnPreviewSettings() method.
if ( GUILayout.Button( "Take a screenshot" ) )
{
//First of all you need to cast preview camera to unity engine camera.
var unityCamera = (UnityEngine.Camera)preview.camera;
//Then create a render target with desired dimension. I used 4k here, for testing.
var renderTarget = RenderTexture.GetTemporary( 4096, 3072 );
//After that you need to set an aspect ratio to the camera. It's calculated as width divided by height.
unityCamera.aspect = (float)renderTarget.width / renderTarget.height;
unityCamera.fieldOfView = 60.0f;
//Set your render target as a target texture of the unity camera.
unityCamera.targetTexture = renderTarget;
unityCamera.Render();
//!Optional! If you want to add any image effect you can edit the output with Graphics.Blit
//https://docs.unity3d.com/ScriptReference/Graphics.Blit.html
//Example code, don't forget to replace it with valid one.
#if false
Material imageEffect = new Material( Shader.Find( "MyCustomImageEffect" ) ); //It can be anything, blur, bloom etc.
Graphics.Blit( renderTarget, imageEffect );
#endif
//After the camera rendered an image you need to set it as a foreground to get data from it.
RenderTexture.active = renderTarget;
//Create a texture which you will use to save a screenshot, remember that it should have same resolution as
//render target.
Texture2D screenshot = new Texture2D( renderTarget.width, renderTarget.height );
//Read pixels from the screen.
screenshot.ReadPixels( new Rect( 0, 0, renderTarget.width, renderTarget.height ), 0, 0 );
//Save the image.
System.IO.File.WriteAllBytes( "Assets/Screenshot.png", screenshot.EncodeToPNG() );
}
Hey I really like the idea of your asset and would like to do something similar, I was just wondering though how you are achieving this. Are you overriding Unity’s AnimationClipEditor? Using the PreviewRenderUtility? Could you just give me a slight hint