1)、 英国游戏工作室inkle是用于游戏开发的开源发布脚本语言“ink”,
可以在 Unity中工作。
https://www.inklestudios.com/ink/
https://github.com/inkle/ink
iDE : https://github.com/inkle/inky/releases
2)、【数据/物理复习】 抛物线 , 根据目标距离,自动调整目标的仰角。
初始速度: V0
投射仰角: θ
距离 : L
Luncher.cs
public GameObject Bullet;
public float _Velocity_0;
float _gravity = 9.8f;//重力加速度
void Update(){
//================================
Vector2 pos = transform.position;
pos.x += 0.1f * Input.GetAxisRaw("Horizontal");
transform.position = pos;
//================================================
//空格发射子弹
if (Input.GetKeyDown(KeyCode.Space)) {
//发射位置
Vector2 LuncherPos = transform.position;
//目标位置
Vector2 TargetPos = GameObject.Find("Target").transform.position;
//获得的距离L
float L = Vector2.Distance(LuncherPos, TargetPos);
//Asin 计算
float AsinX = (L * _gravity) / (_Velocity_0 * _Velocity_0);
if (AsinX >= 1) AsinX = 1.0f;
//θ计算
float _theta = 0.5f * Mathf.Asin(AsinX);
// 目标可能在自己的反方向
if (LuncherPos.x > TargetPos.x) _theta = Mathf.PI - 0.5f * Mathf.Asin(AsinX);
//获取子弹实例,给发射角和初始速度
GameObject Bullet_obj = (GameObject)Instantiate(Bullet, transform.position, transform.rotation);
BulletSc bullet_cs = Bullet_obj.GetComponent<BulletSc>();
bullet_cs.Velocity_0 = _Velocity_0;
bullet_cs.theta = _theta;
}
}
BulletSc.cs
public float Velocity_0, theta;
Rigidbody2D rid2d;
void Start() {
//Rigidbody
rid2d = GetComponent<Rigidbody2D>();
Vector2 bulletV = rid2d.velocity;
bulletV.x = Velocity_0 * Mathf.Cos(theta);
bulletV.y = Velocity_0 * Mathf.Sin(theta);
rid2d.velocity = bulletV;
}
2、 我之前看到过文章介绍 使用Flutter 做游戏。 前端时间看到Unity弄出UIWidgets。
UIWidgets是一个可以独立使用的 Unity Package (https://github.com/UnityTech/UIWidgets)。它将Flutter(https://flutter.io/)的App框架与Unity渲染引擎相结合,让您可以在Unity编辑器中使用一套代码构建出可以同时在PC、网页及移动设备上运行的原生应用。此外,您还可以在您的3D游戏或者Unity编辑器插件中用它来构建复杂的UI层,替换UGUI和IMGUI。
- https://connect-cdn-china2.unity.com/20190328/videos/575ec689-8277-46f4-8097-e37e9773db48_Unity_UIWidgets_20190327.mp4
- https://github.com/UnityTech/UIWidgets/blob/master/README-ZH.md
- https://github.com/UnityTech/UIWidgets
Unity2019 文档中包含三种UI方式的介绍“
3、 Unity 2019.1中添加Denoise 大大减少光照贴图的烘烤时间
http://tsubakit1.hateblo.jp/entry/2019/04/16/233017
Progressive Lightmapper是一种基于光线跟踪的光照贴图。如果采样率很高,光照贴图将非常正确地烘焙,但需要很长时间。另一方面,减少采样数量将显着改善烘烤时间,但光照图将充满噪音。
Optix AI Denoiser
Optix公司AI降噪 ,Nvidia的机器学习是像噪声去除系统的基础。论文在这里https://research.nvidia.com/publication/interactive-reconstruction-monte-carlo-image-sequences-using-recurrent-denoising https://developer.nvidia.com/optix-denoiser
尝试使用 :Window > Renderer > Lightmap
在Direct Sample和Indirect Samples,Environment Sample并尝试烤大幅减少的数量。
项目 |
改变之前 |
改变之后 |
直接样品 |
32 |
1 |
间接样本 |
512 |
8 |
环境样本 |
256 |
8 |
这将显着减少烘烤时间。
真变得超快 ~~~~~
4、 Unity 2019.1 发布:
可以查看新特性Features都包含哪些。 例如:
- Android:为Screen.safeArea增加了Android缺口/切入支持
- Android:添加了仅脚本修补功能,其中仅将与脚本相关的更改发送到设备而不是重新打包apk文件。
- 编辑器:将SceneVis控件添加到编辑器层次结构中,以控制GameObjects的场景可见性
- 编辑器:控制台:为控制台条目列表添加了基于文本的过滤
- 时间轴:为轨道级动画添加了API支持
- 时间线:在时间轴上添加了信号和标记
- UI Elements:现在可以使用样式和uss对背景图像进行着色
- UI Elements:UIElements API发布 - 实验性的
- 编辑器:Exposed ProjectWindowUtil.CreateScriptAssetFromTemplateFile,允许编辑器脚本从模板文件创建新的基于文本的资源,其方式与使用内置C#脚本模板的方式类似。
- 编辑:添加GameObjectUtility.GetMonoBehavioursWithMissingScriptCount和GameObjectUtility.RemoveMonoBehavioursWithMissingScript,以便能够从游戏对象中删除缺少脚本的MonoBehaviours。
- 编辑器:添加了CompilationPipeline.compilationStarted和CompilationPipeline.compilationFinished事件,用于编译开始并在编辑器中完成。
- Memory Profiler:添加了UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot.Convert来处理从MemoryProfiler.PackedMemorysnapshot对象到UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot文件的转换。
- Profiler:Exposed UnityEditor.Profiling.HierarchyFrameDataView API,允许以分层方式访问CPU Profiler数据
- Profiler:用于连接播放器(来自Profiler或控制台窗口)的编辑器GUI现在已公开。它位于UnityEditor.Experimental.Networking.PlayerConnection下,其中EditorGUIUtility.GetAttachToPlayerState(EditorWindow parentWindow)将获得使用EditorGUILayout / EditorGUI.AttachToPlayerDropdown绘制它的连接状态。
5、 Unity 出的Windows包.exe 会包含 标题栏。
简单的方式是创建快捷方式, 然后属性中添加 一个命令。 -popupwindow
6、 编辑器很多时候需要搜索功能: 最好可以类似于Unity 自带的 Hierarchy 和 Project 面板中自带的搜索功能。
或者是这种点击圆圈弹出的功能。
搜索发现 SearchField 、 SearchWindow
https://docs.unity3d.com/ScriptReference/IMGUI.Controls.SearchField.html 这个帖子就是封装的这个API : https://forum.unity.com/threads/editor-ui-search-field-with-autocomplete-on-github.533252/
https://docs.unity3d.com/ScriptReference/Experimental.GraphView.SearchWindow.html 这个实验API 没有查到如何使用!!!
点击圆圈弹窗口, 可以使用这个API :
7、 在不使用VSTU的情况下修改Unity中从Unity生成的sln / csproj文件
AssetPostprocessor的OnGeneratedSlnSolution使用。 (它没有写在文档中,但是自2016.2以来已添加此事件功能。)
using UnityEditor;
public class SolutionFileFixer : AssetPostprocessor
{
private static string OnGeneratedSlnSolution(string path, string content)
{
var solutionGuid = "solution的GUID";
var projectGuid = "project的GUID";
var projectName = "项目名称";
var projectPath = "csproj路径";
var add =
$"Project(\"{solutionGuid}\") = \"{projectName}\", \"{projectPath}\", \"{projectGuid}\",\"{Environment.NewLine}EndProject";
// 添加到最后
var newContent = content.Replace($"EndProject{Environment.NewLine}Global",
$"EndProject{Environment.NewLine}{add}{Environment.NewLine}Global");
return newContent;
}
}
让我们试着抹去Boo.Lang。
private static string OnGeneratedCSProject(string path, string content)
{
var document = XDocument.Parse(content);
document.Root.Descendants()
.Where(x => x.Name.LocalName == "Reference")
.Where(x => (string) x.Attribute("Include") == "Boo.Lang")
.Remove();
return document.Declaration + Environment.NewLine + document.Root;
}
8、 【Unity(C#)】方便的ReorderableList, 制作更方便用的snippet代码段功能
ReorderableList 是Unity早就推出的编辑功能。 顾名思义,您可以在Inspector上创建一个可以自由重新排列的列表。如果您拖动到另一个位置, 列表编号将自动替换。
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
public class TestReorder : MonoBehaviour
{
[SerializeField]
[HideInInspector]
public GameObject[] test_Obj;
#if UNITY_EDITOR
[CustomEditor(typeof(TestReorder))]
public class ExampleInspector : Editor
{
ReorderableList reorderableList;
void OnEnable()
{
SerializedProperty prop = serializedObject.FindProperty("test_Obj");
reorderableList = new ReorderableList(serializedObject, prop);
reorderableList.drawElementCallback = (rect, index, isActive, isFocused) =>
{
SerializedProperty element = prop.GetArrayElementAtIndex(index);
rect.height -= 4;
rect.y += 2;
EditorGUI.PropertyField(rect, element);
};
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
reorderableList.DoLayoutList();
ser