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

New key makes Unity lag #15

Open
Defozo opened this issue Apr 1, 2020 · 2 comments
Open

New key makes Unity lag #15

Defozo opened this issue Apr 1, 2020 · 2 comments

Comments

@Defozo
Copy link

Defozo commented Apr 1, 2020

After adding new key Unity lags. The lag stops after making key unique and not null.

@Defozo Defozo changed the title Null key after adding a new key makes Unity lag New key makes Unity lag Apr 1, 2020
@rainbowcreatures
Copy link

rainbowcreatures commented Nov 3, 2020

Yeah, each time you add a new property (string in my case), it is a duplicate key based on the previous entry. Which triggers a warning about duplicate keys, which makes the whole component go crazy - it keeps on reloading. That makes it impossible to add a new key to multiple prefabs at once, because the reload lag gets too much, and you can't click inside.

Because I'm still new in Unity, I found a quick workaround for my case, I'm setting the new key to empty string right after adding. That avoids the warning and thus the crazy reloads.

		if(buttonAction == Action.Add)
		{
			keyArrayProperty.InsertArrayElementAtIndex(buttonActionIndex);
// My workaround 
			SerializedProperty newProp = keyArrayProperty.GetArrayElementAtIndex(buttonActionIndex);
			newProp.stringValue = "";

@azixMcAze
Copy link
Owner

Hi, I could not reproduce a big lag in the editor.
I tried adding an entry to a SerializableDictionnary in 100 GameObjects and while there was a small lag when editing the fields, it was still pretty usable.

Which version of unity are you using ? Have you tried with the version in the master branch ?

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