Git Product home page Git Product logo

uniwindowcontroller's Introduction

UniWindowController

Unified window controller for macOS and Windows
Abbreviation:UniWinC

license

README

Overview

This is a library for apps built for Windows / macOS standalone with Unity.
This library controls transparency, borderless, position, size, etc. of its own window.
And it allows also accept file and folder drops.

uniwinc
https://twitter.com/i/status/1314440790945361920

Demo

You can find some sample builts on the Release page.

Installation

If you use the UPM, you can also perform version upgrades from UPM.

A. Using the Unity Package Manager (UPM)

  1. Open [Package Manager] from the [Window] menu of the Unity Editor.
  2. Select [+] and then select [Add package from git URL...].
    image
  3. Enter https://github.com/kirurobo/UniWindowController.git#upm and [Add].
    image

B. Using an UnityPackage

  1. Download an .unitypackage file from the Release page.
  2. Import the asset in the Unity Editor.

Use in your Unity project

  1. Add the UniWindowController prefab in the Runtime/Prefabs to your scene.
  2. Select the UniWindowController placed scene, and watch the inspector.
  • Fix the Player Settings appropriately (the green button will change all settings at once)
  • Adjust the settings such as IsTransparent to your liking
  1. Add DragMoveCanvas prefab in the Runtime/Prefabs if you want to move the window by mouse dragging.
  • An EventSystem is required for this to work. If it is not present in your scene, add UI → Event System.
  1. Build for PC / Mac standalone
  2. Launch the build

Limitations

  • Transparency is not available on the Unity Editor. Please build and try it.
    • It works for topmost, moving windows, etc., but I do not recommend closing the game view or changing the docking arrangement while it is running. In the meantime, the window will reacquire when the focus is shifted to the game view.
  • The proper support for touch operations has not yet been determined.
    • On Windows, if you change the TransparentType from Alpha to ColorKey, you will lose the beautiful translucency, but the touch operation will be natural.
  • Multiple windows are not supported.
  • This has not been fully tested and there may be unstable behavior.

See also Issues for known issues.

System requirements

  • Unity: 2019 4.31f1 or later
    • Scripting Runtime: .NET 4.x or later
  • OS: Windows 10, Windows 11 or macOS

Development environment is Unity 2020.4.30f1, Windows 11 / macOS 13.3

Additional information

About the hit test

When the window is successfully made transparent, it looks as if it is a non-rectangular window.
However, this is only an appearance, and the window actually exists as a rectangular window.
Therefore, by looking directly under the mouse cursor, if it is transparent, the mouse operation is passed to the window below (click-through), and if it is opaque, the mouse operation is returned to normal, If it is opaque, it returns to normal.

Two types of hit tests are available. (You can also choose to disable the automatic hit test and control it yourself or not.)

Name Method Note
Opacity Check transparency Matches appearance and is natural, but heavy processing
Raycast Check colider Lightweight, but requires coliders

The Raycast method is recommended in terms of performance, but if you forget colider, you will not be able to touch the screen, so the default is Opacity.

Also, note that touch operation may feel uncomfortable because you cannot see the color under your finger in advance.
Since we have not found the best solution for this, I'm sorry to say that touch support has been put on the back burner.

About the transparency method (Seceltable only on Windows)

One way to support touch operation is to select monochromatic transparency for layered windows.
If this is selected, semi-transparency cannot be expressed and performance will be reduced, but since the hit test is left to Windows, it should match your senses for touch operation.

Name Description Note
Alpha Reflects transparency of rendering results This is standard
ColorKey Only one color with matching RGB is transparent Poor performance, but touch is natural

C# scripting

This is something that can be manipulated from other scripts in Unity.
Specifications are not finalized and are subject to change.

UniWindowController.cs

This is the main script. The following properties can be manipulated from other scripts. (Other properties may be added.)

Name Type Description
isTransparent bool Set/unset for transparent (non-rectangular) windows
isTopmost bool Always set/unset to topmost
isZoomed bool Maximize/unmaximize the window. Also, get the current state
isHitTestEnabled bool Enables/disables the automatic hit test. If enabled, isClickThrough will automatically change depending on the mouse cursor position.
isClickThrough bool Sets/unset the click-through state.
windowPosition Vector2 Allows you to get/set the window position. The lower left corner of the main monitor is the origin and the coordinate system is positive upward, and the lower left corner of the window is the coordinate system.
windowSize Vector2 You can get/set the window size.

UniWindowMoveHandler.cs

If you attach this script to a UI element (which will be the Raycast Target), you can move the window by dragging that UI element. For example, it is assumed to be attached to an image with a handle that says, "You can move by grabbing here.

Within the prefab called DragMoveCanvas, we use a Panel that covers the entire transparent screen. By setting the Layer to "Ignore Raycast", the automatic hit test will be excluded even if the panel is a Raycast.
This allows dragging anywhere on the screen.
However, other UI operations will take precedence over dragging. (This is due to the smaller Sort Order in DragMoveCanvas.)

Source folder hierarchy

If you just want to use this library, you can download .unitypackage in Release and do not need to clone this repository.
If you want to see/build the source, please refer to this.

  • UniWinC
    • This is a Unity project.
    • It already contains built DLLs and bundles.
    • The contents of this project are in the release as the .unitypackage.
  • VisualStudio
    • There is a solution to generate LibUniWinC.dll for Windows x86 and x64.
    • Building with Release will overwrite the DLL under the Unity folder.
    • A Windows Forms app project for testing is also included.
  • Xcode
    • There is a project to generate LibUniWinC.bundle for macOS.
    • Building it will overwrite the .bundle under the Unity folder.

Acknowledgements

I would like to thank them.

uniwindowcontroller's People

Contributors

kirurobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uniwindowcontroller's Issues

Live2Dとともに使用するとDragMoveCanvasが正常に動作しない

Live2Dを利用したプロジェクトで画像のようにシーン上に配置し、DragMoveCanvasのソート順を-99から100に変更して実行したのですが、正常にドラッグできませんでした。
その他、空のGameObjectにUniWindowDragMove.csを当ててみましたが変わりませんでした。
image

Cannot show above top menu bar and Dock in macOS

I set isTopmost = True but the application window always appears behind top menu bar and Dock in macOS.
Making it full screen disables transparency.

How can I make it appear above everything and transparent?

Unityエディタでもプレビューしたい

ビルドしないと確認できないのはハードルが高いので、エディタ上でも結果をみたい。

ゲームビューを直接透過させるのは、いくつものUnityバージョンや設定を試しても無理そうでしたので、操作はできない見た目だけの別ウィンドウを生成する形になりそうです。
本来の仕組みとは全然別にウィンドウを用意しなければならないため、実現には時間がかかりそうです。

モニタ一覧を取得できるようにする

マルチモニタ環境で、モニタごとの位置、サイズを取得できるようにする。
OSの最大化の代わりに、指定したモニタに自動フィットすることを考えている。

指定したモニタにフィットさせる機能を追加

モニタを指定してその全画面にフィットする機能を追加する。
OSの最大化はウィンドウ状態の変化を伴うことと、macOS で仮想画面の追加を招くため、その代わりとして検討中。

Linux版について

難しいとは思いますが、もしLinuxに対応可能であれば対応して頂きたいです。
よろしくお願い致します。

isClickThrough on Mac crashes the application

With the following code, it crashes.

If I remove _window.isClickThrough = true; it will work just fine.

#if !UNITY_EDITOR && !UNITY_WEBGL && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
using System;
using Kirurobo;
#endif
using UnityEngine;

namespace Scripts.Platforms
{
    public class TransparentWindow : MonoBehaviour
    {
    
#if !UNITY_EDITOR && !UNITY_WEBGL
        private UniWindowController _window;

        private void Start()
        {
            try
            {
                _window = gameObject.AddComponent<UniWindowController>();
                _window.isHitTestEnabled = false;
                _window.isClickThrough = true;
                _window.isTransparent = true;
                _window.isTopmost = true;
                _window.autoSwitchCameraBackground = true;
                _window.forceWindowed = true;
                _window.currentCamera = Camera.main;
                _window.shouldFitMonitor = true;
            }
            catch (Exception exception)
            {
                Debug.Log(exception.Message);
            }
        }
        private void Update()
        {
            _window.isTopmost = true;
        }
#endif
    }
}
Mono path[0] = '/Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Resources/Data/Managed'
Mono config path = '/Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/MonoBleedingEdge/etc'
[Physics::Module] Initialized MultithreadedJobDispatcher with 7 workers.
Initialize engine version: 2023.2.3f1 (21747dafc6ee)
[Subsystems] Discovering subsystems at path /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Resources/Data/UnitySubsystems
GfxDevice: creating device client; kGfxThreadingModeThreaded
 preferred device: Apple M1 Pro (high power)
Metal devices available: 1
0: Apple M1 Pro (high power)
Using device Apple M1 Pro (high power)
Initializing Metal device caps: Apple M1 Pro
Begin MonoManager ReloadAssembly
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
icall.c:1842:
- Loaded All Assemblies, in  0.364 seconds
icall.c:1842:
icall.c:1842:
- Finished resetting the current domain, in  0.012 seconds
UnloadTime: 2.718833 ms

=================================================================
        Native Crash Reporting
=================================================================
Got a term while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
        0x11b87659a - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_breakpoint_clean_code
        0x11b81c922 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_unity_backtrace_from_context
        0x11b798997 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_jit_set_domain
        0x7ff8149b85ed - /usr/lib/system/libsystem_platform.dylib : _sigtramp
        0x0 - Unknown
        0x12b767ec0 - Unknown
        0x127c790c9 - Unknown
        0x11b79bbae - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_get_runtime_build_info
        0x11b94faf4 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_runtime_invoke
        0x11b94fa58 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/libmonobdwgc-2.0.dylib : mono_runtime_invoke
        0x10ab1db59 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10ab0b9b2 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10aafe445 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10aafec40 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10aaff5d9 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10a75e774 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10a9082cd - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10a90831b - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10a9085c6 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _ZdaPvRKSt9nothrow_t
        0x10b4d2481 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _Z10PlayerMainiPPKc
        0x10b4d22e0 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _Z10PlayerMainiPPKc
        0x7ff81588e8f6 - /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation : __NSFireTimer
        0x7ff814a7fcb2 - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
        0x7ff814a7f82f - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRunLoopDoTimer
        0x7ff814a7f44a - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRunLoopDoTimers
        0x7ff814a65948 - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRunLoopRun
        0x7ff814a64a4c - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : CFRunLoopRunSpecific
        0x7ff81e996fcd - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : RunCurrentEventLoopInMode
        0x7ff81e996dde - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : ReceiveNextEventCommon
        0x7ff81e996b38 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _BlockUntilNextEventMatchingListInModeWithFilter
        0x7ff817a567a0 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : _DPSNextEvent
        0x7ff817a5564a - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
        0x7ff817a47cb8 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication run]
        0x7ff817a1bed2 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : NSApplicationMain
        0x10b4d1ee4 - /Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/Frameworks/UnityPlayer.dylib : _Z10PlayerMainiPPKc
        0x20051d41f - Unknown

=================================================================
        Telemetry Dumper:
=================================================================
Pkilling 0x12987686912x from 0x8595960448x
Pkilling 0x12970242048x from 0x8595960448x
Pkilling 0x12971315200x from 0x8595960448x
Entering thread summarizer pause from 0x8595960448x
Finished thread summarizer pause from 0x8595960448x.
Failed to create breadcrumb file (null)/crash_hash_0x6927d0389
Could not exec mono-hang-watchdog, expected on path '/Users/xxx/projects/myproject/src-tauri/target/debug/bin/osx/overlay.app/Contents/MonoBleedingEdge/etc/../bin/mono-hang-watchdog' (errno 2)

Waiting for dumping threads to resume

=================================================================
        External Debugger Dump:
=================================================================

=================================================================
        Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x108bfc9fc):0x108bfc9ec  00 00 48 8d 35 eb e1 ff ff e8 44 9e 00 00 eb c6  ..H.5.....D.....
0x108bfc9fc  0f 0b 66 90 55 48 89 e5 31 ff 84 d2 40 0f 95 c7  ..f.UH..1...@...
0x108bfca0c  5d e9 be 3b 00 00 66 66 66 66 66 2e 0f 1f 84 00  ]..;..fffff.....
0x108bfca1c  00 00 00 00 55 48 89 e5 5d e9 b6 4e 00 00 66 0f  ....UH..]..N..f.

=================================================================
        Managed Stacktrace:
=================================================================
          at <unknown> <0xffffffff>
          at LibUniWinC:SetClickThrough <0x0006f>
          at Kirurobo.UniWinCore:EnableClickThrough <0x00022>
          at Kirurobo.UniWindowController:SetClickThrough <0x0003a>
          at Kirurobo.UniWindowController:set_isClickThrough <0x00022>
          at Scripts.Platforms.TransparentWindow:Start <0x00082>
          at System.Object:runtime_invoke_void__this__ <0x00088>
=================================================================
Obtained 32 stack frames.
#0  0x00000108bfc9fc in $s10LibUniWinCAAC15setClickThrough13isTransparentySb_tFZTo
#1  0x0000012b767ec0 in  (wrapper managed-to-native) Kirurobo.UniWinCore/LibUniWinC:SetClickThrough (bool) [{0x7fcbcd94af08} + 0x70]  (0x12b767e50 0x12b767f3b) [0x11b4edd20 - Unity Root Domain]
#2  0x00000127c790c9 in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) [{0x7fcbce41bbe0} + 0x89]  (0x127c79040 0x127c79163) [0x11b4edd20 - Unity Root Domain]
#3  0x0000011b79bbae in mono_get_runtime_build_info
#4  0x0000011b94faf4 in mono_runtime_invoke
#5  0x0000011b94fa58 in mono_runtime_invoke
#6  0x0000010ab1db59 in operator delete[](void*, std::nothrow_t const&)
#7  0x0000010ab0b9b2 in operator delete[](void*, std::nothrow_t const&)
#8  0x0000010aafe445 in operator delete[](void*, std::nothrow_t const&)
#9  0x0000010aafec40 in operator delete[](void*, std::nothrow_t const&)
#10 0x0000010aaff5d9 in operator delete[](void*, std::nothrow_t const&)
#11 0x0000010a75e774 in operator delete[](void*, std::nothrow_t const&)
#12 0x0000010a9082cd in operator delete[](void*, std::nothrow_t const&)
#13 0x0000010a90831b in operator delete[](void*, std::nothrow_t const&)
#14 0x0000010a9085c6 in operator delete[](void*, std::nothrow_t const&)
#15 0x0000010b4d2481 in PlayerMain(int, char const**)
#16 0x0000010b4d22e0 in PlayerMain(int, char const**)
#17 0x007ff81588e8f6 in __NSFireTimer
#18 0x007ff814a7fcb2 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#19 0x007ff814a7f82f in __CFRunLoopDoTimer
#20 0x007ff814a7f44a in __CFRunLoopDoTimers
#21 0x007ff814a65948 in __CFRunLoopRun
#22 0x007ff814a64a4c in CFRunLoopRunSpecific
#23 0x007ff81e996fcd in RunCurrentEventLoopInMode
#24 0x007ff81e996dde in ReceiveNextEventCommon
#25 0x007ff81e996b38 in _BlockUntilNextEventMatchingListInModeWithFilter
#26 0x007ff817a567a0 in _DPSNextEvent
#27 0x007ff817a5564a in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
#28 0x007ff817a47cb8 in -[NSApplication run]
#29 0x007ff817a1bed2 in NSApplicationMain
#30 0x0000010b4d1ee4 in PlayerMain(int, char const**)
#31 0x0000020051d41f in (Unknown)

レンダリングにUniversal RPを使うとIsTransparentをtrueにしたときに背景が黒くなる

環境

macOS Monterey 12.5
Unity 2020.3.37f1
Universal RP 10.9.0
UniWinC 0.8.4

再現方法

Project Settings > Graphics > Scriptable Render Pipeline SettingsにUniversalRenderPipelineAssetを設定する。
使用したPipelineAssetはAssets > Create > Rendering > Universal Render Pipeline > Pipeline Asset (Forward Renderer)で生成されたものをそのまま使用。

症状

付属サンプルコードのUiSampleで検証

機能 動作の可否 動作状況
IsTransparent trueにすると背景が黒一色になる
AlphaValue 問題なし
IsTopmost 問題なし
IsBottommost 問題なし
IsZoomed 問題なし
ShouldFitmonitor 問題なし
AllowDropFiles 🔺 HitTestがOpacityの場合、黒背景にも判定が出てファイルドロップが可能になる
HitTest (Raycast) 黒背景には判定なし
HitTest (Opacity) 黒背景にも判定あり
ColorPicker 黒背景にカーソルを合わせるとAlpha:100%で黒が取得される
DragMoveCanvas 🔺 HitTestがOpacityの場合、黒背景にも判定が出てドラッグが可能になる

対処法

  1. Scriptable Render Pipeline Settingsに何も設定せず、Built-in RPを使用する
  2. UniversalRenderPipelineAssetのInspector > Quality > HDRについているチェックを外す (参考コメント)

When closing down my Unity made application with Application.Quit() the application sometimes crashes. Only happens on Mac not Windows.

My standalone application crashes most often when closing it after only I have been running it for a short time. If it has been running for half an hour or so then it is much less likely to crash.

The crash only happens on my mac, not on my windows computer.

Btw, thank you for making such an excellent project.

The crash report was too long so I've attached it as a pdf.
Crash Report 15 July 2024.pdf

Mac のセーブダイアログでファイル種類を指定した際にエラーが出る

Mac の NSSavePanel で accessoryView を設定すると下記のようなエラーが出てしまい、ダイアログを開けない。
ファイル種類を指定せず accessoryView を使わない場合は出ない。

環境

  • MacBook Air M1 2020
  • macOS Sonoma 14.4.1
  • Xcode 15.3

エラー内容

image

Could not advance an Open/Save panel to run phase due to error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated from this process." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated from this process.}

Exception occurred during attempt to advance an Open/Save panel to run phase: Couldn’t communicate with a helper application.

Couldn’t communicate with a helper application.

Picked color

Hello. I am using your Controller, thank you very much for such a tool. I want to create a desktop pet and often in such applications characters can sit on window elements, I tried to reproduce this effect. Unity API for reading pixel color (Texture2D.GetPixel) works only inside the game window. If your application is a transparent window, then the API will not be able to read colors outside of it. I ask you to help in trying to find a solution and possibly update your Controller.

Work on Window10 , but MacOS is not work (*recently*).

2021/7/1 Test Video: https://drive.google.com/file/d/1dE4MKL1ChKYsEFFu-m8l_BFyt4jKRY-u/view?usp=sharing

Environment:
MacOS 12
Unity 2019.4.24f1

plugin:
InGameConsoleDebug
UniWindowController (import by unitypackage)

some information may help:
2021/4/18 is working (MacOS 11)
2021/7/1 is not working (MacOS 11,12)

notice the test video,
when IsTransparent is true
We can see the desktop, but turn black in moment
and the selection function is working

guess that is a display problem.

sorry for my gramma.

開発環境を Unity 2020 に移行する

Windows Unity2018のIL2CPPではStringBuilderがnullptrとして渡ってしまうようで、ファイルダイアログが使用不可。

Unity 2019以降ならば利用可能なようだが、Unity 2019も2022年6月でサポート終了となるため、Unity 2020 以降を前提とするように開発環境を変更する。

isMovableオプションを追加

複数のissueを立ててしまい申し訳ありません。
現在、DragMoveCanvasの有効・無効化をSetActiveで制御しているのですが、setActiveの処理が重いせいかUniWindowMoveHandle.csの82行目でスタックトレースエラーが発生し、終了してしまうようです。
isMovableオプションを追加することでsetActiveを使わずに処理できると思いますので、ご一考のほどよろしくお願い致します。

Apple SiliconのMacにてUnityのEditor上で動かそうとするとErrorとなる

以下のような事象に遭遇しましたのでご報告です。

事象

Apple SiliconのMacにてUnityのEdtor上で動かそうとするとErrorとなります。
エラーは以下のようにDllがみつからないとなります。

DllNotFoundException: LibUniWinC assembly:<unknown assembly> type:<unknown type> member:(null)
Kirurobo.UniWinCore.AttachMyWindow () (at Assets/Kirurobo/UniWindowController/Runtime/Scripts/LowLevel/UniWinCore.cs:453)
Kirurobo.UniWindowController.UpdateTargetWindow () (at Assets/Kirurobo/UniWindowController/Runtime/Scripts/UniWindowController.cs:769)
Kirurobo.UniWindowController.Update () (at Assets/Kirurobo/UniWindowController/Runtime/Scripts/UniWindowController.cs:484)

実行モジュールを作成した場合は、正常に動作しました。
UnityのEditor上で実行した場合のみのエラーとなります。

回避策

Intel CPU用のUnityを使えばエラーは出なくなります。

確認環境

PC: M1 Mac
Unity: 2023.2.20f1(Silicon) , 2022.3.11f1(Silicon)
(なお、2323.2.20f1(Intel)ではでは正常に動きました)

その他

LibUniWinCのファイルを lipo -infoで確認したところ、確かにx86_64とarm64が含まれているため、何故、エラーとなるのかよくわかりませんでした。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.