Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by michael 4 · May 12, 2011 at 02:31 PM · referencedllmouseposition

using system.windows.forms to set cursor position

I need to modify the cursor postion and "transport" from one location to the other.

this question mentioned to use System.Window.Forms

the problem is Im having a hard time referencing the dll in monodevelop. I clicked the edit referance button and checked the proper dll. I also added the using statement and used the proper

System.Windows.Forms.Cursor.Position command.

The project compiles correctly but when Unity compiles it I get the error

The type or namespace name Windows' does not exist in the namespaceSystem'. Are you missing an assembly reference?

Then when I come back to monodevelop System.Windows.Forms is no longer checked as an assembly referance and it no longer compiles.

Ive tried using save and build commands to save the settings, None seem to work, maby unity is actually incompatible with this assembly referance?

Im not using a webplayer, I know webplayers are incompatible with it.

Does anyone know what I might be doing wrong with setting up my referances, or possibly an alternate way to set the mouse cursor position?

Also note that this is for a special purpose program that I know for sure will always be used on a PC, so its ok if using system.windows namespace prevents it from being cross compatible.

Thanks

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CHPedersen · May 12, 2011 at 02:39 PM 0
Share

The namespace System.Windows.Forms encapsulates the Win32 Windowing system used primarily on Windows XP. I.e. it calls subsystem functions that creates windows and GUI elements for you in $$anonymous$$S Windows operating systems from XP and onwards, but ONLY on $$anonymous$$S Windows. Since the purpose of Unity is to provide a single framework for multiple platforms, using a platform specific windowing system seems to defeat that purpose... I could be wrong, though, I'm curious if more replies turn up.

avatar image michael 4 · May 12, 2011 at 02:47 PM 0
Share

Yes, you are correct and I try to avoid using OS functions and stick inside unity as much as possible. But my particular application requires me to set the mouse cursor position at the Operating system level since unity doesnt support that. I have read that it can be done with System.Windows.Forms.

$$anonymous$$aby what I read was incorrect though, I hope not.

avatar image michael 4 · May 13, 2011 at 12:31 AM 0
Share

additionally, it is known that my special purpose program will always be on a PC, so i dont need to worry about cross platform compatibility.

avatar image Joshua · May 17, 2011 at 09:03 PM 0
Share

I may be wrong, but I think you need pro for that to work. Do you?

avatar image michael 4 · Jun 06, 2011 at 07:50 PM 0
Share

Im not sure, But I have pro

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by michael 4 · May 17, 2011 at 09:27 PM

Just found out that adding system.windows.forms.dll to assets/plugins seems to do the trick.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Venryx · Mar 06, 2013 at 10:38 AM 0
Share

+1, neither the $$anonymous$$ono nor the $$anonymous$$S .NET's DLL of System.Windows.Forms is working for me. It says there is an "internal compiler error", when placed as an asset in my Unity project.

I'd like to find a DLL of it that works, so I can let the user rotate a first person camera without having the cursor always reset to the center by using Screen.lockCursor.

avatar image GTaveira · Oct 30, 2013 at 05:56 PM 0
Share

Although this trick did work in the Editor, it did not work for me when I tried to generate the Build. I always get the following error:

ArgumentException: The Assembly System.Deployment is referenced by System.Windows.Forms. But the dll is not allowed to be included or could not be found.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Add external DLL reference 1 Answer

Can't build error - dll is not allowed to be included or could not be found. 3 Answers

External dll: namespace recognized by mono, not by UT 2 Answers

Json.net - windows store phone 8.1 2 Answers

How to add UnityEngine.dll to VS? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges