hecomi / uWindowCapture

This allows you to use Windows Graphics Capture / PrintWindow / BitBlt in Windows to capture multiple windows individually and easily use them as Texture2D in Unity.
https://tips.hecomi.com/entry/2021/04/30/230322
MIT License
505 stars 81 forks source link

'uWindowCapture' could not be found (are you missing a using directive or an assembly reference?) #41

Closed jasonhbartlett closed 2 years ago

jasonhbartlett commented 2 years ago

Hello, I added uWindowCapture package via UPM git url. I'm wanting to reference the classes from the uWindowCapture namespace in my own scripts but after adding the #using uWindowCapture; I'm getting the following error:

error CS0246: The type or namespace name 'uWindowCapture' could not be found (are you missing a using directive or an assembly reference?)

jasonhbartlett commented 2 years ago

I don't know if perhaps this is due to duplicate assembly names where the plugins are named uWindowCapture and the ASDF file in Runtime folder is also named uWindowCapture.

I notice in the uDesktopDuplication package, you have named the ASDF in the runtime folder uDesktopDuplication.Runtime

Perhaps renaming the ASDF to uWindowCapture.Runtime will fix it, but I cannot do that as it's part of the package.

jasonhbartlett commented 2 years ago

@hecomi Can you confirm this issue isn't something on my end? I will take suggestions if you have any.

hecomi commented 2 years ago

Please try to check this and click "Regenerate project filters" in Edit > Preferences > External Tools:

image
jasonhbartlett commented 2 years ago

Hi @hecomi , Doing that by itself doesn't seem to work. But by also changing the uWindowCapture.asmdef "autoReferenced":true, and then Re-importing it - Then it DOES work.

Same for the Samples. I have to set Auto Referenced to True and re-import, then I am able to reference the public methods.

Did you not want the asmdef file for uWindowCapture to be auto referenced? I notice uDesktopDuplication asmdef file has auto referenced set to True. I had no problem with that package regarding the references. What is the difference between the 2 packages regarding references?

Edit: Just FYI - If I just set Auto Referenced to True and re-import, this solves the issue. Don't need to checkmark added for RegistryPackages.

hecomi commented 2 years ago

Thanks for the report, it is a mistake that Auto Referenced is false. I'll check it when I have time on the weekend.

hecomi commented 2 years ago

This problem was fixed in v1.1.2: