-
Notifications
You must be signed in to change notification settings - Fork 48
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
Unity editor become very slow if reorder List has large struct and large array elements. #12
Comments
I also noticed the same thing when these structs and array elements contain ScriptableObjects. Here are several tests I've done:
I've also noticed that if a ScriptableObject contains classes which contain ScriptableObjects, the classes' ScriptableObjects are not editable. Solution public class NonEditScriptableAttribute : PropertyAttribute { } And edited this in ReorderableArrayInspector.cs starting from #if EDIT_ALL_SCRIPTABLES
bool makeEditable = !iterProp.HasAttribute<NonEditScriptableAttribute>();
#else
bool makeEditable = iterProp.HasAttribute<EditScriptableAttribute>();
#endif The logic in play here is to set makeEditable to false if a field has the NonEditScriptable attribute. Add this attribute to any inner ScriptableObjects and you should notice that the lag is gone. I have not tested on large Lists of ScriptableObjects. Example: [SubjectNerd.Utilities.NonEditScriptable]
[Tooltip("A un-editable ScriptableObject")]
public MyScriptableObject myScriptableObject; Hope this helps! @LoS-Light @ChemiKhazi |
Thank you very much.
mages-gamedev <[email protected]>於 2019年2月20日 週三,22:48寫道:
… I also noticed the same thing.
Here are several tests I've done:
1. ScriptableObject containing other child ScriptableObject fields
will *lag* if both #LIST_ALL_ARRAYS and #EDIT_ALL_SCRIPTABLES are
uncommented
2. ScriptableObject containing other child ScriptableObject fields
will *not lag* if only #LIST_ALL_ARRAYS is uncommented
*Solution*
I made a new PropertyAttribute called NonEditScriptableProperty and added
the new header into any child ScriptableObject fields of a ScriptableObject
public class NonEditScriptableAttribute : PropertyAttribute { }
And edited this in ReorderableArrayInspector.cs starting from line 367:
#if EDIT_ALL_SCRIPTABLES
bool makeEditable = !iterProp.HasAttribute<NonEditScriptableAttribute>();
#else
bool makeEditable = iterProp.HasAttribute<EditScriptableAttribute>();
#endif
*Example:*
[SubjectNerd.Utilities.NonEditScriptable]
[Tooltip("A un-editable ScriptableObject")]public MyScriptableObject myScriptableObject;
Hope this helps! @LoS-Light <https://github.com/LoS-Light> @ChemiKhazi
<https://github.com/ChemiKhazi>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZKcNcPnf_PC89DKn25G34DntR23pclQks5vPWBIgaJpZM4Z0w74>
.
|
Unity editor is very slow if reorder List has large struct and large array elements.
The text was updated successfully, but these errors were encountered: