/// <summary> /// Unity callback that is invoked before the first frame update. /// Here we initialize drag-and-drop, parse command line arguments, /// and start the initial glTF model import (if any). /// </summary> void Start() { // Drag-and-drop code that only works correctly // in Windows standalone builds. See the README at: // https://github.com/Bunny83/UnityWindowsFileDrag-Drop #if UNITY_STANDALONE_WIN && !UNITY_EDITOR_WIN UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += OnDropFiles; #endif Gui.Instance.DefaultFooterMessage = "drag .gltf/.glb/.zip onto window to view"; Gui.Instance.ResetFooterMessage(); // By default, the Windows Unity Player will pause // execution when it loses focus. Setting // `Application.runInBackground` to true overrides // this behaviour and tells it to keep running // always. // // The player must be continuously running in // order for drag-and-drop of files to work in // an intuitive manner. Otherwise, dropping // a .gltf/.glb file onto a non-focused player // window will not immediately trigger an import, // and the user will have to additionally click // the window to give it focus again, before the // glTF import will start running. Application.runInBackground = true; }
private void OnEnable() { // must be created on the main thread to get the right thread id. _hook = new UnityDragAndDropHook(); _hook.InstallHook(); _hook.OnDroppedFiles += OnFiles; }
void Start() { // must be created on the main thread to get the right thread id. hook = new UnityDragAndDropHook(); hook.InstallHook(); hook.OnDroppedFiles += OnFiles; }
void OnEnable() { // must be installed on the main thread to get the right thread id. UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += OnFiles; enabled = true; }
/// <summary> /// Unity callback that is invoked before the first frame update. /// Here we initialize drag-and-drop, parse command line arguments, /// and start the initial glTF model import (if any). /// </summary> void Start() { _dragAndDropHook = new UnityDragAndDropHook(); _dragAndDropHook.InstallHook(); _dragAndDropHook.OnDroppedFiles += OnDropFiles; Gui.Instance.DefaultFooterMessage = "drag .gltf/.glb/.zip onto window to view"; Gui.Instance.ResetFooterMessage(); // By default, the Windows Unity Player will pause // execution when it loses focus. Setting // `Application.runInBackground` to true overrides // this behaviour and tells it to keep running // always. // // The player must be continuously running in // order for drag-and-drop of files to work in // an intuitive manner. Otherwise, dropping // a .gltf/.glb file onto a non-focused player // window will not immediately trigger an import, // and the user will have to additionally click // the window to give it focus again, before the // glTF import will start running. Application.runInBackground = true; ParseCommandLineArgs(); }
void OnEnable() { // must be created on the main thread to get the right thread id. hook = new UnityDragAndDropHook(); hook.InstallHook(); hook.OnDroppedFiles += OnFiles; Application.logMessageReceived += HandleLog; }
void Start() { UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += OnFilesDropped; _notificationDisplayer = FindObjectOfType <TemporaryNotificationDisplayer>(); _uriConverter = new FilePathConverter(); }
protected override void OnEnable() { #if UNITY_STANDALONE_WIN && !UNITY_EDITOR UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += LoadDropPaths; #endif base.OnEnable(); }
void OnEnable() { // must be created on the main thread to get the right thread id. hook = new UnityDragAndDropHook(); hook.InstallHook(); hook.OnDroppedFiles += OnFiles; var binding = time_line.playableAsset.outputs.First(c => c.streamName == "MoveRoot"); time_line.SetGenericBinding(binding.sourceObject, move_root); SetTimeline(); }
void Start() { if (defaultArtwork != null) { defaultArtworkData = Convert.ToBase64String(defaultArtwork.EncodeToPNG()); SetSpriteToImage(newArtworkField, defaultArtworkData); } // must be created on the main thread to get the right thread id. hook = new UnityDragAndDropHook(); hook.InstallHook(); hook.OnDroppedFiles += OnFiles; }
// important to keep the instance alive while the hook is active. void Start() { if (!isAdministrator) { ReStartAs(); } else { Debug.Log("管理员"); // must be created on the main thread to get the right thread id. hook = new UnityDragAndDropHook(); hook.InstallHook(); hook.OnDroppedFiles += OnFiles; } }
void Awake() { instance = this; _hwnd = FindWindow(null, UnityEngine.Application.productName); UnityDragAndDropHook.InstallHook(_hwnd); UnityDragAndDropHook.OnDroppedFiles += OpenDragFile; if (UnityEngine.Application.isEditor) { return; } // UnityEngine.Screen.fullScreen = false; //SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED); //int intExTemp = GetWindowLong(_hwnd, GWL_EXSTYLE); //SetWindowLong(_hwnd, GWL_STYLE, WS_POPUP | WS_VISIBLE); //SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT); SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED); int intExTemp = GetWindowLong(_hwnd, GWL_EXSTYLE); SetWindowLong(_hwnd, GWL_EXSTYLE, intExTemp | WS_EX_TRANSPARENT | WS_EX_LAYERED); SetWindowLong(_hwnd, GWL_STYLE, GetWindowLong(_hwnd, GWL_STYLE) & ~WS_BORDER & ~WS_CAPTION); int currentX = UnityEngine.Screen.currentResolution.width / 2 - winWidth / 2; int currentY = UnityEngine.Screen.currentResolution.height / 2 - winHeight / 2; SetWindowPos(_hwnd, (int)currentTopType, currentX, currentY, winWidth, winHeight, SWP_SHOWWINDOW); var margins = new MARGINS() { cxLeftWidth = -1 }; DwmExtendFrameIntoClientArea(_hwnd, ref margins); }
private void Start() { _hook = new UnityDragAndDropHook(); _hook.InstallHook(); _hook.OnDroppedFiles += OnFiles; }
void OnEnable() { UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += OnFiles; }
private void OnEnable() { m_DragAndDropHook = new UnityDragAndDropHook(); m_DragAndDropHook.InstallHook(); m_DragAndDropHook.OnDroppedFiles += OnDroppedFiles; }
protected void OnEnable() { UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += FilesDropped; }
void OnEnable() { UnityDragAndDropHook.InstallHook(); UnityDragAndDropHook.OnDroppedFiles += onDragDrop; shortcutManager.current.OpenFile += openImage; }
public static void StartDragAndDrop() { dragAndDropHook.OnDroppedFiles += OnFilesDragDropped; dragAndDropHook.InstallHook(); }