unity

Unity 2017版本安卓打包配置

匿名 (未验证) 提交于 2019-12-03 00:37:01
我的版本是Unity2017.2,按照Unity5的教程去配置SDK和JDK的话会报错。折腾两天试遍各种方法后总结出来一套简单又不报错的。 重点:以下链接需要一些工具来打开,你懂的。 一、下载安装SDK https://developer.android.com/studio/ 2、运行exe来安装androidstudio和SDK 一路确认直到这个页面,表示安装成功 3、Unity2017有bug,需要我们手动修改sdk 打开以下链接下载tools_r25.2.3 Windows: https://www.youtube.com/redirect?q=https%3A%2F%2Fdl.google.com%2Fandroid%2Frepository%2Ftools_r25.2.3-windows.zip&v=1yLDxIMuRlo&redir_token=NOw39CshQ7L2-N9gxSEDkxzn_nN8MTUyMTI5NDM0OEAxNTIxMjA3OTQ4&event=video_description Mac: https://www.youtube.com/redirect?q=https%3A%2F%2Fdl.google.com%2Fandroid%2Frepository%2Ftools_r25.2.3-macosx.zip&v=1yLDxIMuRlo

Unity3D摄像机跟随人物

匿名 (未验证) 提交于 2019-12-03 00:37:01
本篇文章和大家介绍的是 摄像机跟随人物, 这里的视角主要是从人物的背后跟随的。 首先新建一个C#脚本,命名为MyFollow,然后把以下代码粘贴进去,保存: 1 using UnityEngine ; 2 using System . Collections ; 3 public class MyFollow : MonoBehaviour 4 { 5 public float distanceAway = 5 ; // distance from the back of the craft 6 public float distanceUp = 2 ; // distance above the craft 7 public float smooth = 3 ; // how smooth the camera movement is 8 private GameObject hovercraft ; // to store the hovercraft 9 private Vector3 targetPosition ; // the position the camera is trying to be in 10 Transform follow ; 11 void Start () { 12 follow = GameObject . FindWithTag (

【Unity UI性能分析工具】Unity UI Profiling Tools

匿名 (未验证) 提交于 2019-12-03 00:37:01
Unity UI Profiling Tools 版本检查: 5.3 难度: 高级 The external tools provide method-level CPUprofiling with millisecond (or better) resolution, as well as detaileddraw-call and shader profiling. Instructions for setting up and using theabove tools lie beyond the scope of this guide. Note that the XCode FrameDebugger and Instruments are only usable on IL2CPP builds for Apple platforms,and therefore can currently only be used to profile iOS builds. Unity Profiler The primary use for the Unity Profiler isto perform comparative profiling: enabling and disabling elements of a UI whilethe Unity Profiler is

Unity接入高德SDK实现定位

匿名 (未验证) 提交于 2019-12-03 00:36:02
三.编写主函数 public class MainActivity extends UnityPlayerActivity { //声明mLocationClient对象 public AMapLocationClient mLocationClient = null; public AMapLocationClientOption mLocationOption = null; private String LocationInfo; private String ErrorInfo=""; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } //获取定位信息 public String[] GetInfo() { String[] a=new String[2]; a[0]=this.LocationInfo; a[1]=this.ErrorInfo; startLocation(); return a; } protected void onStart() { super.onStart(); } private void startLocation() { this.mLocationClient = new AMapLocationClient

Unity 常见必然函数02 Start、FixedUpdate、Update、LateUpdate 简介

匿名 (未验证) 提交于 2019-12-03 00:36:02
//场景加载好 开始的时候执行一次 (用来初始化数据) 一定会在Update系列函数前面 void Start() { } //固定的刷新率 0.02s 执行一次 主要用来执行物理模拟的脚本 void FixedUpdate() { } //每一帧刷新一次 void Update() { } void LateUpdate() { } 执行效果: 文章来源: Unity 常见必然函数02 Start、FixedUpdate、Update、LateUpdate 简介

Unity网格合并_材质合并

匿名 (未验证) 提交于 2019-12-03 00:34:01
https://blog.csdn.net/dardgen2015/article/details/51517860 很多时候我们需要把具有相同shader的材质球合并,从而减少drawcall的产生。 比如九龙战里面,一个人物带有10个部位,10个部位各自来自不同的fbx文件,加上身体,就有11个材质球,占上11个drawcall。如果主城里面跑着10个角色,光人物就占了110个drawcall!所以这种时候材质球合并是必须的。 (下图为九龙战里面的多部位换装效果) 材质球合并,分以下几步走,首先我们讨论普通的MeshRenderer的材质球合并,然后再讨论SkinnedMeshRenderer的材质球合并。 普通的MeshRenderer的材质球合并: 1.合并所有材质球所携带的贴图,新建一个材质球,并把合并好的贴图赋予新的材质球。 2.记录下每个被合并的贴图所处于新贴图的Rect,用一个Rect[]数组存下来。 3.合并网格,并把需要合并的各个网格的uv,根据第2步得到的Rect[]刷一遍。 4.把新的材质球赋予合并好的网格,此时就只占有1个drawcall了。 下面是关键代码: [csharp] view plain copy true, true); 合并前的drawcall: 合并后的drawcall: 合并好的网格: 合并好的贴图:

Unity 升级到2018之后出现TargetException: Non-static method requires a target.错误的问题

匿名 (未验证) 提交于 2019-12-03 00:33:02
在Unity升级到2018之后,发现工程出现了一个这样的错误: TargetException: Non-static method requires a target. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <e1a80661d61443feb3dbdaac88eeb776>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <e1a80661d61443feb3dbdaac88eeb776>:0) UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethod (System.Reflection.MethodInfo method) (at C:/buildslave/unity/build/Editor/Mono

Unity3D基础UI框架

匿名 (未验证) 提交于 2019-12-03 00:32:02
之前学了刘国柱老师的UI框架加上我自己的理解做了一个UI框架正好可以使用 http://www.cnblogs.com/LiuGuozhu/ 受益颇深 基本UI框架的类图就是这样了 大体是根据MVC加上我的魔改而成的框架,至少我自己暂时觉得还是思路挺清晰的 Panel的切换是使用的Canvas Group的更改透明度,在加上使用 此方法来更改显示顺序和显隐的 其中的界面反向切换是使用的栈后入先出的特性 反向切换是指一个窗口弹出小窗口后,父窗口的Raycast需要取消,下面贴上核心代码 using System.Collections; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UIManager :MonoBehaviour { /// <summary> /// 单例模式: /// 1.定义一个静态的对象 在外界访问 内部构造 /// 2.构造方法私有化 /// </summary> #region 单例模式 private static UIManager _instance; public static UIManager Instance { get { if (_instance == null) {

unity合并网格

匿名 (未验证) 提交于 2019-12-03 00:32:02
using UnityEngine; using System.Collections; using System.Collections.Generic; public class CombineMeshes : MonoBehaviour { void Start() { //获取MeshRender; MeshRenderer[] meshRenders = GetComponentsInChildren<MeshRenderer>(); //材质; Material[] mats = new Material[meshRenders.Length]; for (int i = 0; i < meshRenders.Length; i++) { mats[i] = meshRenders[i].sharedMaterial; } //合并Mesh; MeshFilter[] meshFilters = GetComponentsInChildren<MeshFilter>(); CombineInstance[] combine = new CombineInstance[meshFilters.Length]; for (int i = 0; i < meshFilters.Length; i++) { combine[i].mesh = meshFilters[i]