DOTS 优化 之 ScriptableObjects

本文介绍了DOTS优化中的ScriptableObject使用,它作为数据容器可以减少Unity项目内存使用,避免Prefab实例化时的数据复制。ScriptableObject不能附加到GameObject上,而是作为Assets保存。主要用途包括Editor会话中保存数据和作为运行时资源。创建ScriptableObject子类,并通过CreateAssetMenu创建实例,然后在其他脚本中引用以读取和使用数据。
摘要由CSDN通过智能技术生成

DOTS 优化 之 ScriptableObjects

ScriptableObject

A ScriptableObject is a data container that you can use to save large amounts of data, independent of class instances. One of the main use cases for ScriptableObjects is to reduce your Project’s memory usage by avoiding copies of values. This is useful if your Project has a Prefab
 that stores unchanging data in attached MonoBehaviour scripts
.

Every time you instantiate that Prefab, it will get its own copy of that data. Instead of using the method, and storing duplicated data, you can use a ScriptableObject to store the data and then access it by reference from all of the Prefabs. This mean

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值