Problems with Plugins, Selection, and ChangeHistoryService

Here are a handful of bugs/unexpected behaviors that impair/frustrate me when I use Roblox Studio.


Undo recursively selects descendants of changed instances

First of all, undo can cause huge lag spikes because it recursively selects all of the descendants of the changed instances.

The lag is likely caused by the explorer unfolding, as well as core plugins that serialize the selection to a table using Selection:Get(), then iterate through the entire selection; You can find these plugins by enabling “Show Hidden Objects in Explorer” and selecting CSGDictionaryService which throws an error:

There have been numerous bug reports and complaints related to this issue:
https://devforum.roblox.com/t/list-things-that-trigger-you-in-development/32594/77

First of all, core plugins should not get or iterate through the game’s selection until the developer activates the plugin; if the plugin’s behavior is often used by devs (like the UI editor), then it should at least be possible to disable the plugin. An additional Selection.Count or Selection:Count() API would solve this too, so plugins can instead ignore selections that are unreasonably large without initializing the table with Selection:Get().

This same attention to performance should be always be applied if plugins need to listen to events like DescendantAdded and DescendantRemoving on services; This can easily be done by only connecting to these events when needed, and only after the plugin is activated. Core plugins hopefully don’t do this in the first place.


Undo/redo will delete/recreate preview parts created by plugins

Undo currently deletes my non-Archivable parts that were created via plugin, which is very frustrating when I need to generate previews or visualizations based on other instances. Redo also tries to restore these non-Archivable parts that were deleted via plugin; I can circumvent this by calling :Destroy() on the part, but redo will just spam the output instead:


This problem is magnified by the recursive-selection problem, where the lag can completely freeze studio in cases with thousands of parts.


Use cases affected by this problems

  • Triangle terrain plugins will have their generated WedgeParts unexpectedly removed/recreated.
  • Model instancing plugins will have thousands of parts selected when undoing which causes massive lag spikes. This lag can freeze studio resulting in lost work.
  • Foliage editor plugins that display foliage animations will have the previews unexpectedly removed/recreated.
  • Building plugins that create advanced visualizations using parts will have the visualization unexpectedly removed/recreated when undo/redoing.

My current use case

I’m currently developing a tree/foliage system that enables me to create extremely detailed models that are optimized using a per-branch LoD (level of detail) system. Studio freezes every time I use undo after previewing the full-LoD model. I often need to do this to compare changes I’ve made.


The final model won’t have nearly this many parts, but I need to know what the final model will look like before I go through the process of creating LoD’s. I’m developing this system to enable animal/pet interactivity for thousands of trees in my game Shard Seekers.

When I finally manage to deselect after a few minutes, studio will continue having lag spikes until I restart due to a LegacyLock process:

These problems have caused me to seriously consider making my own studio tools with their own undo/redo system.

13 Likes

This problem has been occurring for the longest time now, probably since 2016.

Selecting the children of a deleted parent upon undoing or redoing something should never happen.

I also see that Roblox’s problem of spamming a warning or an error message repeatedly into console still hasn’t been fixed - that’s an issue in of itself.

There’s literally no reason to spam messages in the console unless you’re intentionally wanting to crash a game or harm it’s performance severely.

2 Likes

I just lost progress on the cedar tree I was working on due to this :confused:

This is likely caused by the force-selection bug, as well as core-plugins that iterate through my entire selection and run complex tests.

I need to use thousands of parts while modeling so I can see how changing a small twig affects the entire tree before I start making LODs.

This is what the trees look like in-game:

2 Likes

First I’d like to thanks to @24RightAngles for resolving most of these problems by making ChangeHistoryService ignore non-Archivable instances. I’m able to develop really powerful studio tools for my game thanks to this.

However, I’m still having occasional problems with LegacyLock while developing my game. It seems to happen when many instances are destroyed/created (It almost always happens when I jump to a new location and my studio map streaming system loads and unloads tens of thousands of non-Archivable parts.) It makes studio unusable and I usually need to restart it, but sometimes it resolves when I reparent groups of workspace instances by dragging them in explorer, and sometimes it simply goes away on its own after a minute.


2 Likes

I’m still having problems with LegacyLock making studio very laggy after selecting an instance with many descendants (35k parts in this case):