Skip to content

Commit

Permalink
adding an init method to EntityMonoBehaviour which is called after th…
Browse files Browse the repository at this point in the history
…e prefab is instantiated and the bootstrapper/entity references are set
  • Loading branch information
tbg10101 committed May 1, 2020
1 parent 98af01e commit 4ea1c97
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"com.10101software.dots.hybridsimulation": "file:../../..",
"com.unity.entities": "0.9.1-preview.15",
"com.unity.ide.rider": "1.2.1",
"com.unity.render-pipelines.universal": "8.0.1",
Expand All @@ -11,7 +12,6 @@
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.10101software.dots.hybridsimulation": "file:../../.."
"com.unity.modules.uielements": "1.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2020.1.0b6
m_EditorVersionWithRevision: 2020.1.0b6 (255abb3234f8)
m_EditorVersion: 2020.1.0b7
m_EditorVersionWithRevision: 2020.1.0b7 (6cfebb967dcd)
5 changes: 5 additions & 0 deletions Runtime/Scripts/MonoBehaviours/EntityMonoBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,10 @@ internal override void Destroy() {

base.Destroy();
}

/// <summary>
/// Called after the PrefabSpawnSystem instantiates the prefab.
/// </summary>
internal virtual void PostInstantiate() { }
}
}
2 changes: 2 additions & 0 deletions Runtime/Scripts/Systems/PrefabSpawnSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ protected override void OnUpdate() {
EntityManager.SetName(entity, instance.name);
#endif

instance.PostInstantiate();

ecb.RemoveComponent<InitComponentData>(entity);
ecb.AddComponent(entity, new GameObjectFlagComponentData());
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.10101software.dots.hybridsimulation",
"description": "A framework for using FixedUpdate in a simulation world which is linked to a GameObject-based presentation layer.",
"version": "0.3.2",
"version": "0.3.3",
"unity": "2020.1",
"displayName": "DOTS Hybrid Simulation Worlds",
"dependencies": {
Expand Down

0 comments on commit 4ea1c97

Please sign in to comment.