Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 David · Jan 16, 2010 at 08:46 PM · editortexturebuildmousescreen

Delta event out of Editor Problem

Hi,im using Event.Current.delta to move a texture arround the screen. The problem comes when i build the scene. Current delta goes crazy and doesnt stop never.

If i stop moving the mouse texture keeps mooving on the last direction.

Thanks

Comment
Add comment
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

4 Replies

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

Answer by David · Jan 18, 2010 at 02:24 PM

I go crazy using Delta to drag objetcs so i change textures my planes and now i have it done. The problem should be that delta coult be used out of Unity editor because on editor all works well.

Comment
Add comment · 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
0

Answer by Bampf · Jan 17, 2010 at 05:56 PM

We may need to see some code to answer this one. But my first guess would be that you are not checking the Event.type field. I think that your code in OnGUI is getting called at fixed intervals (to draw GUI elements, perhaps) and you are treating each one as if the mouse had moved. If so, try limiting your code to Event.type==EventType.MouseMove. But, you will need to draw your texture regardless- the question is whether to draw it at the same location as last time, or whether to move it to a new location.

Is this texture supposed to be acting like a mouse cursor? If so, you may not need the delta at all, just read the Input mousePosition, as described in: this answer.

Comment
Add comment · Show 1 · 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 Draco18s · Sep 08, 2011 at 09:14 PM 0
Share

This answer is bunk. The Event.current.delta values when the project is compiled are exactly the same as Event.mousePosition, it doesn't matter if you're checking the event type or not (I'm checking for $$anonymous$$ouseDrag events, specifically, and still see this issue).

Data gleaned from this thread: http://forum.unity3d.com/threads/63404-Event.delta-problem-of-Unity3

avatar image
0

Answer by CgShady · Nov 23, 2011 at 08:29 PM

Let me add to this. It works "out of the editor" on MacOSX platform, but not on Windows. My experience is the exact same as described above, I'm using the delta on a MouseDrag event, so I am checking the event type, and I'm using it to let the user zoom with a mouse drag with the right mouse button.

It works in both MacOSX and Windows versions of the editor, it works in the OSX compiled app. It just doesn't in the executable version on windows. I did some printing on the screen and can confirm that Event.current.delta == Event.mousePosition, but again only on windows compiled project. I tried to make my own mechanism to compute delta, storing previous value, etc.. And guess what, it works in the editor, but not in the compiled version. I feel there's some deeper bug on the event mechanism on windows builds.

Comment
Add comment · 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
0

Answer by CgShady · Nov 24, 2011 at 09:32 AM

All, I just found a workaround. I was using Event.current.delta.y to zoom in and out with the right mouse button.

As it doesn't work on Windows builds, I am now using Input.GetAxis("Mouse Y"). That works OK, I simply had to changed the sensitivity, as this one isn't given as a pixel delta, but seems to be using the mouse Dpi and speed settings.

Here's the code for reference :

 if (Event.current.type == EventType.MouseDrag && Event.current.button == 1)
     {
 //        Camera.main.fieldOfView += Event.current.delta.y/10;
         Camera.main.fieldOfView += Input.GetAxis("Mouse Y");
     }

Hope this helps !

Comment
Add comment · 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

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

2 People are following this question.

avatar image avatar image

Related Questions

Temporary textures or Materials in Editor removed in build 1 Answer

Serious Rendering Issue - editor vs build 3 Answers

How to draw a small circle on scene and moving it wherever mouse cursor moves 2 Answers

Distribute terrain in zones 3 Answers

Assign texture to shader bypassing material (in Unity Editor) 1 Answer


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