Skip to content

Plugins to receive message when drag end into Unity window frame.

License

Notifications You must be signed in to change notification settings

DigitalLavender/unity-windows-file-bridge

Repository files navigation

Windows Unity File Bridge

This example provide that hook drag end event from windows api.
See native plugin builder too.

Video

2021-06-25.05-24-59.mp4

API

See FileBridge.cs.

  • FileBridge.Enable() : Enable hook
  • FileBridge.Disable() : Disable hook
  • FileBridge.OnDragFiles : Callback event when dragging end.

Example

See FileBridgeExample.cs.

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

namespace DLavender.Windows
{
    public class FileBridgeExample : MonoBehaviour
    {
        public Text board = default;
        
        private void OnEnable()
        {
            FileBridge.Enable();
            FileBridge.OnDragFiles += OnDragCallback;
        }

        private void OnDisable()
        {
            FileBridge.Disable();
        }

        private void OnDragCallback(List<string> paths)
        {
            board.text = "";
            foreach (string path in paths)
            {
                board.text += path;
                board.text += "\n";
            }
        }
    }
}