Unity3d 周分享(16期 2019.5.1 )

选自过去1~2周 自己所看到外文内容:https://twitter.com/unity3d 和各种其他博客来源吧 

 

 

 

1)、 英国游戏工作室inkle是用于游戏开发的开源发布脚本语言“ink”,

可以在 Unity中工作。

https://www.inklestudios.com/ink/

https://assetstore.unity.com/packages/tools/integration/ink-unity-integration-60055

https://github.com/inkle/ink

https://applech2.com/archives/20180501-ink-the-powerful-scripting-language.html

iDE : https://github.com/inkle/inky/releases

 

 

 

2)、【数据/物理复习】 抛物线 , 根据目标距离,自动调整目标的仰角。

初始速度: V0

投射仰角: θ

距离 : L

 

 

 

 

https://ja.wikipedia.org/wiki/%E6%96%9C%E6%96%B9%E6%8A%95%E5%B0%84

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。

 

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 发布:

https://unity3d.com/cn/unity/beta/2019.1#release-notes

可以查看新特性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 :

https://docs.unity3d.com/ScriptReference/EditorGUIUtility.ShowObjectPicker.html

 

 

 

 

 

7、 在不使用VSTU的情况下修改Unity中从Unity生成的sln / csproj文件

https://qiita.com/toRisouP/items/6b0fc5eb97b0d7ce1499

 

AssetPostprocessor的OnGeneratedSlnSolution使用。 (它没有写在文档中,但是自2016.2以来已添加此事件功能。)

using UnityEditor;

public class SolutionFileFixer : Asset
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值