上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1.2 KiB

Runtime Image Viewer

FEATURES

  • Behaves similar to Windows 10 Photos Viewer
  • Simple user interface
  • Draggable and resizable
  • Rotate Image
  • Scale Image
  • Drag and Resize Image

HOW TO

Simply import ImageViewer.unitypackage to your project. Afterwards, add using XR.ImageViewer; to your script.

EXAMPLE CODE3181515

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using XR.ImageViewer;

public class ImageViewerTest : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    { 
        //Loacl Image
        GameObject.Find("LocalButton").GetComponent<Button>().onClick.AddListener(() =>
        {
            string fullpath = "file://" + Application.dataPath + "/TestImage/001.jpg";
            StartCoroutine(ImageViewer.ShowImage(fullpath));
        });
        //Network Image
        GameObject.Find("NetworkButton").GetComponent<Button>().onClick.AddListener(() =>
        {
            string fullpath = "https://blogs.unity3d.com/wp-content/uploads/2019/04/Unity-Havok-blog.jpg";
            StartCoroutine(ImageViewer.ShowImage(fullpath));
        });

    }
}