随笔分类 - Unity
摘要:【Unity加载二进制数据】 The first step is to save your binary data file with the ".bytes" extension. Unity will treat this file as a TextAsset. As a TextAsset the file can be included when you build your Ass...
阅读全文
摘要:检查有问题的Prefab发现,某个GameObject上出现了2组MeshRenderer和MeshFilter,去掉多余的一组,该问题解决。 The problem was that one of the enemies had 2 renders attached to the same gameobject. After removing one of them, the problem w...
阅读全文
摘要:前言: 本文不是讲地形编辑器的使用,而是主要讲解:(1)地形相关知识(2)使用代码创建地形(3)使用AnimationCurve创建曲面地形(4)使用photoshop绘制地形表面,即SplatAlphaMap(5)使用代码为地形添加树 本讲结构: 一:地形的基础知识(1)地形编辑器的不足(2)地形结构(3)地形与SplatAlpha 二:动态创建地形(1)动态创建简单平面地形(2)动态创建凹...
阅读全文
摘要:直接获取TerrainData进行修改即可 using System.Collections; using UnityEngine; using UnityEditor; public class DynamicCreateTerrain : MonoBehaviour { public TerrainData terrainData; private float[,] heig...
阅读全文
摘要:String.Format 方法的几种定义: String.Format (String, Object) 将指定的 String 中的格式项替换为指定的 Object 实例的值的文本等效项。String.Format (String, Object[]) 将指定 String 中的格式项替换为指定数组中相应 Object 实例的值的文本等效项。String.Format (IFormatPro...
阅读全文
摘要:Rigidbody with multiple colliders adding colliders changes the center of mass and rotation behaviour of a rigidbody. To set those manualy to the center of the object use:void Start(){ rigidbody = G...
阅读全文
摘要:Xcode 10 Archive Unity5.x 导出工程时电脑卡死。解决办法:Targets - Build Settings - Debug Information Format 设置成DWARF。对比Unity4.7.2导出工程,可以发现此版本的导出工程不会导致Archive 时电脑卡死!
阅读全文
摘要:引言 Unity 官方从 Unity 2017.1 版本开始,开源了引擎和编辑器的C#源码(源码地址:UnityCsReference),但核心的 C/C++ 部分源码并未开源。 编译环境 网上主要的源码有两个版本 Unity 4.3.1f1 和 Unity 4.7.1f1 ,但其实基本都是 4.3.1 的版本,这里以 Unity 4.3 为例进行源码编译,但编译之前需要安装一些工具软件: ...
阅读全文
摘要:Unity shader error: “Too many texture interpolators would be used for ForwardBase pass” 解决方法:CGPROGRAM 下加一行:#pragma target 4.0示例如下: Ref: https://www.cnblogs.com/alps/p/7101092.html
阅读全文
摘要:Build application in Unity 2017.20f3 用Unity2017/2018编译iPhone版本出现以下错误: ETC1(or DXT1) compressed textures are not supported when publishing to iPhone Pa
阅读全文
摘要:Unity 4.7 导出工程在XCode 10.1上编译报错,而在XCode 9.3上是可以正常编译运行的。原因是Unity4.7所依赖的头文件和库文件在XCode10上没有了,解决办法如下,把XCode9.3目录下的相应文件或者目录拷贝到XCode10.1的对应目录下:1) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO...
阅读全文
摘要:Unity 4.7 导出工程在XCode9/10上报错 validateRenderPassDescriptor:644: failed assertion `Texture at colorAttachment[0] has usage (0x01) which doesn't specify MTLTextureUsageRenderTarget (0x04)'报错发生时线程栈帧如下,发生在与...
阅读全文
摘要:Select the top level node called Unity-iPhone in the left tree view (the one with the blue item). Select Automatically manage signing Select your team (now the error message should appear) Go to ...
阅读全文
摘要:升级MAC OS到10.13, 10.14系统后,出现UNITY工程无法加载资源的情况: Unity项目中Asset目录显示为空! 解决办法一: 打开Launchpad中的磁盘工具 (也就是实用工具下的“磁盘工具”) 新建一分区,名称大小任意,格式为MAC OS 扩展(日志式) 将unity工程移至新分区 OK,工程已经可以正常加载了 解决办法二: 1. 升级Unity版本 (如Unit...
阅读全文
摘要:属性 方法 UNITY_EDITOR #define directive for calling Unity Editor scripts from your game code. UNITY_EDITOR_WIN #define directive for Editor code on Windows. UNITY_EDITOR_OSX #define directive for E...
阅读全文
摘要:Author Error: Shader warning in 'Custom/ShowAnimation': Not enough temporary registers, needs 9 (compiling for flash) at line 17 Fixed: Add “#pragma target 3.0” into the shader Error & Fixed: Uni...
阅读全文
摘要:I created a full white texture with 4x4 size. Unity requires that compressed texture size should be at least 4x4. This will cause some artifact on some Android device, and the frame rate was very slow...
阅读全文
摘要:Author: http://www.cnblogs.com/open-coder/p/3898159.html The light mapping effects between PC and Mobile become very incosistant just as following: Wi...
阅读全文
摘要:Here are something that need to take care of when you work with Unity3D: 1) It seems Unity3D could could work better with Maya than 3D Max. Expecially when you do normal mapping, mirror models; (mat...
阅读全文
摘要:I have been using Unity3D to make game for half one year. I began to lean Unity3D with some books, online articles, forums, documents and Google. However although there are many helps, but for some pr...
阅读全文