com.elestrago.unity.entitas-redux 3.7.6 → 3.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/Core/Entity/Entity.cs +1 -0
- package/Core/Entity/EntityRef.cs +30 -0
- package/Core/Entity/EntityRef.cs.meta +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
## [3.7.7](https://gitlab.com/elestrago-pkg/entitas-redux/-/tags/3.7.7)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `EntityRef<TEntity>` for correct way to get entity reference
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Set `Entity.CreationIndex` to `-1` when entity is destroyed
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
5
17
|
## [3.7.6](https://gitlab.com/elestrago-pkg/entitas-redux/-/tags/3.7.6)
|
|
6
18
|
|
|
7
19
|
### Fixed
|
package/Core/Entity/Entity.cs
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
using EntitasRedux.Core.Libs;
|
|
2
|
+
|
|
3
|
+
namespace JCMG.EntitasRedux
|
|
4
|
+
{
|
|
5
|
+
public struct EntityRef<TEntity>
|
|
6
|
+
where TEntity : class, IEntity
|
|
7
|
+
{
|
|
8
|
+
private readonly TEntity _entity;
|
|
9
|
+
private readonly GenId _id;
|
|
10
|
+
|
|
11
|
+
public EntityRef(TEntity entity)
|
|
12
|
+
{
|
|
13
|
+
_entity = entity;
|
|
14
|
+
_id = entity.Id;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public bool IsValid => _entity != null && _entity.Id.Equals(_id);
|
|
18
|
+
|
|
19
|
+
public TEntity Entity => _entity;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
public static implicit operator EntityRef<TEntity>(TEntity entity) => new(entity);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static class EntityRefExtensions
|
|
26
|
+
{
|
|
27
|
+
public static EntityRef<TEntity> Ref<TEntity>(TEntity entity) where TEntity : class, IEntity
|
|
28
|
+
=> new(entity);
|
|
29
|
+
}
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.elestrago.unity.entitas-redux",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.7",
|
|
4
4
|
"displayName": "JCMG Entitas Redux",
|
|
5
5
|
"description": "Entitas Redux is an fast, accessible, and feature-rich ECS framework for Unity. It leverages code generation and an extensible plugin framework to make life easier for developers.",
|
|
6
6
|
"category": "Unity",
|