Runservice:UnbindfromRenderStep doesn't raise an error when called on a non-existent function

In my game I am making use of RunService:BindToRenderStep, but while messing around with it, I found that UnbindFromRenderStep doesn’t raise an error when called on a non-existent function, even though it says otherwise on the dev wiki?
These two seperate code samples should raise this error, but do not.

local RunService = game:GetService("RunService")
RunService:UnbindFromRenderStep("f")

RunService:BindToRenderStep("t", 2, function()
	RunService:UnbindFromRenderStep("t")
end)
wait(1)
RunService:UnbindFromRenderStep("t")

Does anyone know why this is? I’m using UnbindFromRenderStepped in different threads so I’m afraid in some cases I will call it on an already unbound function, and I want to make sure this doesn’t raise an error.
I could use pcall but I don’t want to do that either if I don’t have to.

If the docs say it should throw an error, I’d write your code as if it might. That way you won’t have to change it later if they decide to “fix it” and make it throw.

I’d also say that it seems weird that you’re not sure if you’re unbinding an already-bound function. I would make it more clear who’s in charge of a single connection.

1 Like