This happens on component creation and/or when assigning a custom sleep/wake test.
Despite these implying this shouldn't be the case, very likely for performance reasons, given how many offscreen entities in the world can be scheduling these tasks:
function Sleeper:OnEntitySleep() self:StopTesting() end function Sleeper:OnEntityWake() self:StartTesting() end
This can simply be addressed by adding a check like this, maybe with an extra one if you do want offscreen sleeping to be a thing for some entities.
function Sleeper:StartTesting(time) if self.inst:IsAsleep() then return end if self.isasleep then self:SetTest(ShouldWakeUp, time) else self:SetTest(ShouldSleep) end end
Steps to Reproduce
- Spawn an entity with a sleeper component offscreen.
- Notice how it'll have a sleep/wake test task scheduled.
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now