zoukankan      html  css  js  c++  java
  • 学习笔记--2020年12月29日

    一.unity的专业版、个人版等差别

    unity官方网站有这些版本的对比,对这些区别的总结参加博客:https://www.jianshu.com/p/22b54c53ddff

    二.unity发布安卓和在真实安卓设备上调试安卓项目

    我使用的是unity2019.4的稳定个人版,因此版本有集成Android Studio等拓展,下载即可:

     安装勾选的模块,即可支持打包发布安卓。

    打开Edit > Preferences > External tools__,查看下载好的拓展是否安装到位。如果是自己额外安装的jdk和sdk等也在这里设置关联位置。

     在unity中File > BuidlingSetting中将当前项目的发布平台切换为安卓。

     完成后即可看到发布项目和发布并调试的按钮。

     

    在Android设备上安装unity remote,打开andriod设备的USB调试模式并使用数据线连接到电脑上。

     在发布游戏按钮的左边点击player setting,在Player选项中设置company等发布选项,在Editor选项中将Device切换为任意安卓设备,接下来就可以调试安卓项目了。

    在unity中点击开始游戏,Game窗口中的内容就会和安卓端安装的unity remote软件中的内容同步,打开unity remote,在安卓端的输入也会被unity同步获取,到此为止就可以在我们的安卓设备上调试unity的安卓项目了。

     三.Touch类常用的API

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class UnityTouchTest: MonoBehaviour
    {
        public Text text;
        public string textInfo;
    
        // Update is called once per frame
        void Update()
        {
            textInfo = "";
            //获取屏幕上的被触摸点的个数
            if(Input.touchCount > 0)
            {
                textInfo = "触摸点个数:" + Input.touchCount;
                //touches是一个用于存储所有触摸点的Touch数组
                Touch[] touch = Input.touches;
                foreach(Touch t in touch)
                {
                    //fingerId是当前触摸点在touches数组中的下标
                    //deltaPosition是触摸点的相对位移
                    //deltaTime是这次touch记录和上次touch记录的时间差
                    //tapCount点击次数,一般两次点击间隔的距离和时间都不大的情况下将这些点击视为同一个点击,点击次数tapCount累加
                    //phase是当前点击所处的阶段,返回值是一个TouchPhase枚举类型,有Began、Moved、Stationary、Ended、Canceled五种类型
                    textInfo += "
    " + "FingerId:" + t.fingerId + "  DeltaPosition:" + t.deltaPosition + "  DeltaTime:" + t.deltaTime + "  TapCount:" + t.tapCount + "  Phase:" + t.phase;
                }
            }
    
            text.text = textInfo;
        }
    }
  • 相关阅读:
    mongodb nodemailer
    mongodb session
    mongodb cookie
    mongodb multer
    mongodb operate update and delete
    mongodb find opearate
    echart
    Git学习
    PHP海补知识(11)-- 自定义exception
    ThinkPHP U方法
  • 原文地址:https://www.cnblogs.com/movin2333/p/14206995.html
Copyright © 2011-2022 走看看