Enums of Enum.RenderPriority

So out of curiosity, I’ve been trying to get more deep into the Luau programming language knowledge. And on the roblox wiki I found out about the “RenderPriority” enums of the RunService. Whick look like this:

RunService:BindToRenderStep("Something", Enum.RenderPriority.First.Value, delta)

But I saw that there is First and Last in the Enum.RenderPriority; not just first.

But can someone tell me please what do these mean?

Greetings!

RenderStepped is an event that fires every frame prior to rendering. A frame is a unit during which tasks are performed by the task scheduler in particular order. Input registration is first, followed by tasks bound to RenderStepped, later follows replication, resuming of wait-states, then physics simulation and so forth.

Out of the famous three events - RenderStepped, Stepped and Heartbeat, the first one is relatively sensitive and may significantly impact the client’s performance, especially if heavy and demanding operations are performed before the screen drawing.

Now, the difference between RenderStepped and :BindToRenderStep() is, the latter gives us the option to specify priority, therefore we can decide where in order our additional task should be executed, while RenderStepped doesn’t come with such guarantees.

Here is every value in Enum.RenderPriority at the time of writing:

(Source: RenderPriority | Roblox Creator Documentation)

Apparently there are 2001 places in order (much more then we would ever need), and Enum.RenderPriority.First.Value simply means no bound operation is going to run before the given task.

(Analogy: Z-index when working with GUIs.)

Good luck!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.