Auto increment name when duplicating instance

I am setting up a path of nodes that are named “NodeX”. I do this by setting up the first node then press Ctrl + D and move the next node into position, then repeat. Now I have to go back and rename each node so they can be ordered.

When I press Ctrl + D, studio should check if the last characters of the instance name are numbers and if they are then increment it by one. This would reduce the amount of time I have to spend setting up this path. It should be an option that can be disabled in studio settings, “Auto increment instance names”

image

local function IncrementName(Name: string): string
	local Value = tonumber(Name:match("%d+$"))
	
	if (Value) then
		return (Name:gsub("%d+$", Value + 1))
	end
	
	return Name
end
5 Likes

You could easily make a plugin for this. It is not a crucial engine feature, more quality of life

2 Likes

This isn’t always desired behavior. If you have a script that searches for all parts named “Lava” (bad practice to use names instead of tags but people do it anyway) and gives them lava behavior, you’ll have to rename a lava brick every time you clone it.

If I’m not mistaken, this is a feature that can be perfectly implemented with a plugin - write some code that uses a plugin action to clone the selection and increment the names, then unbind the original Duplicate action and bind the plugin action to Ctrl+D.

3 Likes

It would only increment if the last characters in a string are numbers. If you just have a part named Lava and duplicate it, it wouldnt change the name at all. Only if it was named Lava1

No thanks, I already find Blender’s and Photoshop’s copy paste behavior very annoying.

1 Like

No offense but this feature request doesn’t really make any sense

It’s a plugin you can write yourself with like 5 lines of code , and this would frustrate more people than it’d help

“duplicate” - should be an identical duplicate , hence the name