Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Add Option to rename gameobjects after Prefab name change #295

Open
justinwasilenko opened this issue Jun 14, 2022 · 1 comment

Comments

@justinwasilenko
Copy link

Would be nice to see after changing the name of a Prefab in the project view, to then change the names of all gameobjects using that prefab in the scene.

Something like this:
https://pastebin.com/DaiACbJU

@edwardrowe
Copy link
Contributor

Thanks for the suggestion - This is a nice script!

So the workflow you are needing to do right now is:

  1. Rename a prefab
  2. Select the objects in the scene with the old name and
  3. Revert them with menu item: Prefab/RevertName

I like the idea, but there are a few potential problems. Not sure if they are dealbreakers or not.

  1. Within Unity I don't believe it's possible to distinguish whether or not an instantiated prefab in the scene had its named changed from the prefab. So if someone deliberately changed the name, we can't tell. We also can't know if the user wants these renamed or not.
  2. Even if we could tell, maybe they've enumerated multiple instances with a suffix, such as Char_Hero (1). Should it change the common substring?
  3. These prefabs could be used in any scene. So just looking at the open scene isn't enough.

In these cases, I think I'd expect a user to fix them with the bulk renamer themselves. Simply because we can't know what the "right" way is to fix up the users assets. Here's an example: if you want to change Char_Hero to Batman in the project and the scene, I'd probably search my scene for "Char_Hero", and my project for "t:prefab Char_Hero", and just drag everything in and Replace "Char_Hero" with "Batman".

That said, I this gave me an idea for a feature that might allow this.

Custom script nodes - users could create functions that adhere to some signature and do anything, and you could put them in the rename pipeline on the left. In this case you don't need all that, you'd just need a callback when it's done. Which might be the way to go.

So I think I'd like to keep this Issue open until I have a chance to write up a design for Custom Script operations. But ultimately I'd probably close it in favor of custom scripts - and maybe ship with a few operations, including this one.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants