Parallel Luau and plugins - Actors not executing

Reproduction Steps

Uploading: repro.rbxm…

If you create an Actor as part of a plugin, and attach a script, the script will execute correctly when the plugin is first loaded, but will not execute if the plugin clones the actor.

eg: something like this:

Eg: a single script in the plugin that clones an actor like so

local actor = script.Parent.Actor:Clone()

actor.Parent = script.Parent

Expected Behavior

Actor Scripts, when cloned as part of a plugin, execute

Actual Behavior

Actor Scripts, when cloned as part of a plugin, do not execute.

Issue Area: Engine
Issue Type: Other
Impact: Low
Frequency: Constantly

2 Likes

@MrChickenRocket, I’d like to investigate this issue, but I can’t seem to access the attachment (repro.rbxm). Could you try uploading that file again so I can take a look? Thanks!

3 Likes

Expected output:

  Hello I am mainscript - MainScript:1
  Mainscript cloned Actor1 many times, but only the one shipped with the plugin executes... - MainScript:9
  Hello I am Actor1 - ActorScript:1

repro.rbxm (1.5 KB)

(To test, rightclick save the folder as a local plugin)

2 Likes

Hi @MrChickenRobot, I can see the same issue you have reported. At the moment, this is a limitation related to how plugin scripts are handled. Internally we have different code paths for plugin scripts, and at the moment we are unable to handle running scripts that are added/cloned after the plugin is loaded. The actual limitation is true for all plugin scripts (not just scripts which are descendants of actors).

This limitation is something we would like to address in the future, so that plugin script behavior is more consistent with how other scripts work in the engine. However, we haven’t currently scheduled, or committed to, this work yet.

Could you help us better understand how important this use case is to you? I am presuming this is being done to improve performance via parallel execution of scripts.

Oh, thankyou for checking.

It was for my Radiosity Lighting plugin linked here:

The use case was dynamically spawning a whole bunch of actors to handle processing of all the lights in the scene, often thousands. One actor per light was a very elegant way of handling state and communication.

I can work around it by having a fixed number of actors when the plug-in initializes, but that means that I have to split the workload up myself and process a bunch of lights in serial in each one. Much less elegant, but I think there would be a real upper limit to actors anyhow so maybe it’s not such a bad thing.

Hi, just following this up.
I reworked the plugin I wrote to use actors that are there when the plugin initializes (16 of them!).

I think I encountered a bug! This only works when this feature in studio is enabled!?

image

Link to the plugin in question here:
LampLight.rbxmx (369.7 KB)

Maybe this resolves it? I am hopeful!