I has a cube in my scene and i added a UI canvas which has a image in it. I just simply want to rotate my cube object when my mouse moves over the image and stop the rotation when my mouse moves out of the image?
Previously in older version of unity i was able able to do this by mouse enter and exit function but i have no idea with the new UI of new version.
Please help
The easiest way is to use the Event Trigger Component. The component can call functions / change variables based on ui events.
The events you should take a look at are PointerEnter and Pointer exit.
http://docs.unity3d.com/ScriptReference/EventSystems.EventTrigger.html
There is a way to get the vents directly in your script but its not so easy that i would recommend it for the beginning.
http://docs.unity3d.com/ScriptReference/EventSystems.IPointerEnterHandler.html
http://docs.unity3d.com/ScriptReference/EventSystems.IPointerExitHandler.html
for the example how the unity button uses the interfaces to functin you can take a look here
https://bitbucket.org/Unity-Technologies/ui/src/a5f41955ad119e1708b79f10154009c984992769/UnityEngine.UI/UI/Core/Button.cs?at=5.2&fileviewer=file-view-default