• 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 /
  • Help Room /
This question was closed Dec 08, 2015 at 10:37 PM by Bunny83 for the following reason:

Question is off-topic or not relevant

avatar image
-2
Question by Tritofic · Dec 08, 2015 at 11:53 AM · movedlletc

Can I make my cursor move using Unity in Source games?

I play a game called CS:GO and I was wondering if it was possible to move my cursor within the game. CS:GO is made by valve and runs on the Source engine. At the minute, I am able to move my cursor through code while window focus is on Unity or Google Chrome. I do have "Run In Background" checked.

Here is my current code:

 using UnityEngine;
 using System.Collections;
 using System.Drawing;
 using System.Runtime.InteropServices;
 
 public class MouseControl : MonoBehaviour {
 
     [DllImport("user32.dll")]
     public static extern bool SetCursorPos(int X, int Y);
     [DllImport("user32.dll")]
     public static extern bool GetCursorPos(out Point pos);
 
     Point cursorPos;
 
     // Use this for initialization
     void Start () {
         cursorPos = new Point();
         GetCursorPos(out cursorPos);
         Invoke("moveMouse", 3);
     }
 
     void moveMouse() {
         SetCursorPos(cursorPos.X, cursorPos.Y + 150);
     }
 }
 



I have not yet compiled this, but I don't think that is the problem.

Thanks in advance, and I am really sorry if this is just a noob question.

Comment
Add comment · Show 2
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 Tritofic · Dec 08, 2015 at 10:06 PM 0
Share

Has anyone found anything about this? I would really like to know.

avatar image Bunny83 · Dec 08, 2015 at 10:41 PM 0
Share

This question has nothing to do with Unity. You're using a windows API function which has no relation to game development with Unity. It also seems you try to manipulate other game applications in order to automate something or to cheat in that game. If that's the intention you're completely wrong here.

  • Closed.

0 Replies

  • Sort: 

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

DLL found in editor but not in build version 2 Answers

Unity 5.5x external dll issue on build after updade from 5.3.x 1 Answer

Unity game freezes a few seconds after loading scene 2 Answers

create .dll file by c# scripting and read/write data in created file through c# scripting 0 Answers

Move Image to given position 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