snapshotgames / cui_color_picker Goto Github PK
View Code? Open in Web Editor NEWColor Picker for Unity UI in a single script/prefab
License: MIT License
Color Picker for Unity UI in a single script/prefab
License: MIT License
This issue is due to how you are testing for the mouse position.
Here is the modification from my variant that corrected the problem
private static bool GetLocalMouse(RectTransform rt, out Vector2 result) { RectTransformUtility.ScreenPointToLocalPointInRectangle(rt, Input.mousePosition, Camera.main, out mousePosition); result.x = Mathf.Clamp(mousePosition.x, rt.rect.min.x, rt.rect.max.x); result.y = Mathf.Clamp(mousePosition.y, rt.rect.min.y, rt.rect.max.y); Debug.Log(rt.rect.Contains(mousePosition)); return rt.rect.Contains(mousePosition); }
Note I have also changed most of the code at this point to remove any local declrations to variables within funcitons that can be called on an update loop such as the GetLocalMouse function hince the new private static mousePosition that use as opposed to var mp as it was in your code branch.
Just want to say thanks. Works perfectly in Unity 2020.1.0f1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.