帮助,我正在尝试在图像面板上添加放大/缩小收缩手势,我该怎么做呢?我正在使用Unity 5,目前我只在UI图像组件上显示静态图像,我想在那里添加放大/缩小手势,我该怎么做呢?
我确实使用蒙版和滚动条来滚动文本,我可以对缩放手势做类似的事情吗?
PS:目前我的图像看起来很模糊,是不是因为我调整了它的大小?我需要更大分辨率的图像吗?我对部署到google store的文件大小有一些担忧。
请帮帮忙,这是我的第一个unity项目...
发布于 2016-01-13 06:56:42
你可以查看这个视频:https://unity3d.com/ru/learn/tutorials/modules/beginner/platform-specific/pinch-zoom主要思想是你应该使用Input类,而不是滚动元素。
为了避免图像模糊,你应该使用分辨率更高的纹理。在纹理设置中禁用mipmap也会有所帮助。
发布于 2018-09-21 13:50:00
以下是我的解决方案:
void Update() {
Zoom(Input.GetAxis("Mouse ScrollWheel"));
}
void Zoom(float increment) {
currentScale += increment;
if (currentScale >= maxScale) {
currentScale = maxScale;
} else if (currentScale <= minScale) {
currentScale = minScale;
}
imageToZoom.rectTransform.localScale = new Vector2(currentScale,
currentScale);
}https://stackoverflow.com/questions/34740905
复制相似问题