当前位置:网站首页>Production of unity scalable map
Production of unity scalable map
2022-06-11 04:21:00 【Sea moon】
framework
Use Scroll View load Image
Content And Image Initial size vs Panel Agreement , Then zoom through the code

Code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MapPanelManager : MonoBehaviour
{
public Slider scaleSlider;
public RectTransform contentOfMap;
public void SetMapScale(Slider slider)
{
float scaleFactor = slider.value;
contentOfMap.localScale = new Vector3(scaleFactor, scaleFactor, 1);
}
public void OnEnable()
{
scaleSlider.value = contentOfMap.localScale.x;
contentOfMap.sizeDelta = contentOfMap.transform.GetChild(0).GetComponent<RectTransform>().sizeDelta;
}
}notes : Load picture to Scroll View Of Content Medium to display , To achieve the effect of dragging and dropping , First of all, let Content The initial size of is the same as the picture , In this way, you can ensure that every part of the picture can be seen after dragging . Here, it is automatically set by code Content size .
effect

边栏推荐
- Market prospect analysis and Research Report of single photon counting detector in 2022
- Market prospect analysis and Research Report of electronic pelletizing counter in 2022
- Given a project, how will you conduct performance testing?
- JVM (1): introduction, structure, operation and lifecycle
- Market prospect analysis and Research Report of surround packing machine in 2022
- 给你一个项目,你将如何开展性能测试工作?
- Feature selection algorithm based on bare bones particleswarm optimization
- JVM(2):内存结构、类的加载过程
- 超简单 CameraX 人脸识别效果封装
- 司马炎爷爷 告诉你什么叫做内卷!
猜你喜欢

Zhongang Mining: fluorochemical industry is the main consumption field of fluorite

Watson K's Secret Diary

Unity 编辑器扩展 保存位置

Esp32 development -lvgl display picture

Embedded basic interface-i2s

The future has come and the 5g advanced era has begun

Guanghetong LTE Cat4 module l716 is upgraded to provide affordable and universal wireless applications for the IOT industry
![[server data recovery] data recovery case of RAID5 crash of buddy storage](/img/c4/681c542310f05192bd14757965ef0d.png)
[server data recovery] data recovery case of RAID5 crash of buddy storage

Guanghetong successfully won the bidding for China Unicom Yanfei CAT1 customized module with the largest share

零时科技 | Discover 闪电贷攻击事件分析
随机推荐
App live broadcast source code, platform login page and password modification page
How to check whether domain name resolution is effective?
数据类型的转换和条件控制语句
The live broadcast helped Hangzhou e-commerce Unicorn impact the listing, and the ledger system restructured the new pattern of e-commerce transactions
Analysis of zero time technology | discover lightning loan attack
[CF571E] Geometric Progressions——数论、质因数分解
Market prospect analysis and Research Report of Ethernet scanner in 2022
SQL optimization
Seven easy-to-use decorators
Data type conversion and conditional control statements
Vulkan-官方示例解读-RayTracing
Eth relay interface
[激光器原理与应用-2]:国内激光器重点品牌
L'avenir est venu, l'ère 5G - Advanced s'ouvre
Explain in detail the structure and working principle of the crystal oscillator
June 10, 2022: Captain Shu crosses a sweet potato field from north to South (m long from north to South and N wide from east to West). The sweet potato field is divided into 1x1 squares. He can start
Guanghetong successfully won the bidding for China Unicom Yanfei CAT1 customized module with the largest share
golang泛型:generics
A - Eddy's AC puzzle (C language)
JVM (3): classloader classification and parental delegation mechanism