-
Notifications
You must be signed in to change notification settings - Fork 40
Feature/extra checks and features #186
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
Conversation
|
I was wondering what's the purpose of the GUID generation. Wouldn't it be possible to just use an asset postprocessor to store the item's guid as soon as it is created? This would fix the issue of duplicating an asset also duplicating the guid. |
I remember having issues with the asset postprocessor in the past, where trying to serialize stuff at that stage was causing issues, but it could be definitly be one alternative. But Ideally I need something super reliable for this, it should never be invalid, and it should be changing around since would make the indirect references invalid, I will take a look more into a better alternative |
I definitely end up with zeroed guids quite often, so I don't think the current solution is super reliable either ^^. I think Weaver uses asset postprocessors, and we used them pretty effectively to automatically store lists of sprites |
Humm yeah maybe I didn't noticed that they are going missing that often because of the previous setup that always fixed itself. Do you have some reproduction steps that I could debug why they are going invalid? |
|
Couldn't reproduce it for some reason, I just notice it later when it gets fixed and I see the git diff. In any case, relying on the item or collection editor to fix things is not very reliable. |
|
It has been working like that from the past 5 years, so its definitly reliable enough, but I'm testing with the post processor if improves things in any way |
This pull request introduces several improvements and bug fixes to the ScriptableObject Collections system, focusing on code generation utilities, filename validation, and object identity management. The changes enhance usability in the Unity Editor, ensure safe asset naming, and improve the reliability of collection item comparisons.
Editor Utilities and Menu Improvements:
SOCollectionsContextMenuItems.csto generate all static access files and indirect access files for all collections, with proper validation to prevent execution during play mode.Filename Validation and Utilities:
IsValidFilenameandToValidFilenameextension methods inStringExtensions.csto ensure asset names are valid and safe for file creation, including handling Windows reserved names and extra invalid characters.ScriptableObjectCollection.AddNewto useToValidFilenamefor asset names, improving reliability of asset creation.ScriptableObjectCollectionItem Identity and Lifecycle:
GUIDproperty inScriptableObjectCollectionItemto a simple getter, and added anOnValidatemethod to ensure a valid GUID is generated in the Unity Editor. [1] [2]ScriptableObjectCollectionItemto use the item's GUID, improving object comparison and dictionary/set behavior. [1] [2]String Sanitization Enhancement:
Sanitizemethod inStringExtensions.csto treat any non-alphanumeric sequence as a word separator, resulting in safer and more consistent asset names.