Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Call component Init after one heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Oct 11, 2020
1 parent 49d5571 commit bf195d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Knit/Util/Component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ function Component:_instanceAdded(instance)
self._instancesToObjects[instance] = obj
table.insert(self._objects, obj)
if (self._hasInit) then
obj:Init()
Thread.Spawn(function()
if (self._instancesToObjects[instance] ~= obj) then return end
obj:Init()
end)
end
self.Added:Fire(obj)
return obj
Expand Down
2 changes: 1 addition & 1 deletion src/Knit/Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.9-alpha
0.0.10-alpha

0 comments on commit bf195d7

Please sign in to comment.