Search Unity

Powerful Preview - Extend your assets with a preview.

Discussion in 'Assets and Asset Store' started by startassets, Mar 10, 2017.

  1. startassets

    startassets

    Joined:
    Feb 13, 2017
    Posts:
    11
    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.
    • Open source.
    Asset Store: https://assetstore.unity.com/packages/tools/utilities/powerful-preview-82899
    Tutorials: http://startassets.net/assets/PowerfulPreview/tutorials.html
    Code Reference: http://startassets.net/assets/PowerfulPreview/annotated.html
    Feedback: startassets@gmail.com

     

    Attached Files:

    Last edited: Mar 21, 2020
  2. startassets

    startassets

    Joined:
    Feb 13, 2017
    Posts:
    11

    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.



    Asset Store: https://www.assetstore.unity3d.com/en/#!/content/86480
    Feedback: startassets@gmail.com


     

    Attached Files:

  3. startassets

    startassets

    Joined:
    Feb 13, 2017
    Posts:
    11
    Last edited: Mar 21, 2020
    WinterboltGames likes this.
  4. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    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!
     
  5. startassets

    startassets

    Joined:
    Feb 13, 2017
    Posts:
    11
    Yes, sure it's possible.

    Here is a code how you can make this.

    Code (CSharp):
    1. //Put this code into either OnUpdate() or OnPreviewSettings() method.
    2. if ( GUILayout.Button( "Take a screenshot" ) )
    3. {
    4.     //First of all you need to cast preview camera to unity engine camera.
    5.     var unityCamera = (UnityEngine.Camera)preview.camera;
    6.  
    7.     //Then create a render target with desired dimension. I used 4k here, for testing.
    8.     var renderTarget = RenderTexture.GetTemporary( 4096, 3072 );
    9.  
    10.     //After that you need to set an aspect ratio to the camera. It's calculated as width divided by height.
    11.     unityCamera.aspect = (float)renderTarget.width / renderTarget.height;
    12.     unityCamera.fieldOfView = 60.0f;
    13.  
    14.     //Set your render target as a target texture of the unity camera.
    15.     unityCamera.targetTexture = renderTarget;
    16.     unityCamera.Render();
    17.  
    18.     //!Optional! If you want to add any image effect you can edit the output with Graphics.Blit
    19.     //https://docs.unity3d.com/ScriptReference/Graphics.Blit.html
    20.     //Example code, don't forget to replace it with valid one.
    21. #if false
    22.     Material imageEffect = new Material( Shader.Find( "MyCustomImageEffect" ) ); //It can be anything, blur, bloom etc.
    23.     Graphics.Blit( renderTarget, imageEffect );
    24. #endif
    25.     //After the camera rendered an image you need to set it as a foreground to get data from it.
    26.     RenderTexture.active = renderTarget;
    27.  
    28.     //Create a texture which you will use to save a screenshot, remember that it should have same resolution as
    29.     //render target.
    30.     Texture2D screenshot = new Texture2D( renderTarget.width, renderTarget.height );
    31.     //Read pixels from the screen.
    32.     screenshot.ReadPixels( new Rect( 0, 0, renderTarget.width, renderTarget.height ), 0, 0 );
    33.  
    34.     //Save the image.
    35.     System.IO.File.WriteAllBytes( "Assets/Screenshot.png", screenshot.EncodeToPNG() );
    36. }
    Hopefully you will enjoy the asset.
     

    Attached Files:

    Last edited: Mar 23, 2018
    WinterboltGames likes this.
  6. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    Looks like someone is going to get your asset soon!
     
  7. jacwilso-tt

    jacwilso-tt

    Joined:
    Jan 14, 2019
    Posts:
    3
    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 :)