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

GUID not generating automatically #6

Open
BurritoBushido opened this issue May 7, 2023 · 2 comments
Open

GUID not generating automatically #6

BurritoBushido opened this issue May 7, 2023 · 2 comments

Comments

@BurritoBushido
Copy link

Installed manually from package.

I have a prefab with a class inheriting GUID. Guids are never generated automatically. Context menu functions work. Prefab instances never generate new guids either, they inherit whatever is in the field for the prefab asset.

@andreiagmu
Copy link
Contributor

I'm also having this issue, when instantiating prefabs in-game or duplicating prefab instances in-editor.

Currently, it seems GUIDs are only auto-generated for pre-existing scene instances.
They aren't auto-generated for dynamically instanced prefabs in-game (i.e.: GameObject.Instantiate(); dragging a prefab to the Scene View), or for duplicated prefab instances in-editor (i.e.: Ctrl+D).

@Xriuk
Copy link
Member

Xriuk commented Oct 13, 2024

Hello, sorry for the very late reply but this repo is not actively monitored. When you inherit GUID from a custom class if you override the Reset method you should call the parent implementation with base.Reset() to generate Guids on instantiation.

Prefab instances should generate guids if the asset guid is set to auto, if you are having problems with that you can give use more details on that and we can take a look at it.

Runtime-generated instances (via GameObject.Instantiate()) should not auto-generate guids because (I guess) Reset() is never called on those, you could generate it yourself after instantiating by calling GenerateGUID(). The same should apply for duplicated prefabs (which is a problem we also had), but the latest commit should have fixed that (it had a missing assembly error so you may not have tried it yet). While dragging a prefab to the scene view should regularly work, if the prefab asset has the guid set to auto (see paragraph above).

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

3 participants