10.27Unity事件、场景烘焙、Render Texture

1.Unity的几种事件用法

①event

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
using UnityEngine.Events;

public class CollisinEvent : UnityEvent<GameObject, GameObject> { }

public class HelloWorld:MonoBehaviour
{
    CollisinEvent collisinEvent = new CollisinEvent();
    private void OnCollisionEnter(Collision collision)
    {
       collisinEvent.Invoke(gameObject, collision.gameObject);
    }

    public  void AddEvent(UnityAction<GameObject, GameObject> action)
    {
        collisinEvent.AddListener(action);
    }
}

 这种用法可以用在rpg游戏的主角上,在主角上挂一个event,在将要碰撞的object上调用主角Addevent方法添加事件

②UnityAction

    public UnityAction<int, string> action = ((int a, string b) =>
    {
        Debug.Log("1111111");
    });
③Action

Action<int> action2;
 action2 += (int a) => { }; 

关于UnityAction和Action的区别

https://blog.csdn.net/qq_34244317/article/details/79823613https://blog.csdn.net/qq_34244317/article/details/798236132.场景烘焙

把物体模型放进了场景里之后, 引擎会计算光线,光线照到你的物体的表面形成反光和阴影。 如果不烘焙, 游戏运行的时候,这些反光和阴影都是由显卡和CPU计算出来的。你烘焙之后,这些反光和阴影都记录到了你的模型里,变成了新的贴图了,运行的时候,显卡和CPU不需要进行对环境光效果的运算了。

3.Render Texture

Unity3D中的RenderTexture详解_御坂御坂001的博客-CSDN博客文章目录RenderTexture是什么什么是server-sider的texture?什么是FrameBufferObject?这有什么用?渲染到RenderTexture的几种方式从rendertex获取结果其他的一些问题RenderTexture是什么在U3D中有一种特殊的Texture类型,叫做RenderTexture,它本质上一句话是将一个FrameBufferObjecrt连接到...https://blog.csdn.net/qq_34562355/article/details/91881523

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值