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

ArgumentOutOfRangeException on Container.CollectChildren #241

Open
pkujhd opened this issue Dec 10, 2024 · 0 comments
Open

ArgumentOutOfRangeException on Container.CollectChildren #241

pkujhd opened this issue Dec 10, 2024 · 0 comments

Comments

@pkujhd
Copy link

pkujhd commented Dec 10, 2024

RichTextField/TextField在OnUpdate的时候触发了OnSizeChanged, 到上层需要BatchUpdate的节点执行SetRenderingOrder时,因为此时的_textChanged是true, 所以会在
Rect rect = child.GetBounds(initiator);
时触发EnsureSizeCorrect(),将所有的同级节点都移除,导致

            int count = _children.Count;
            for (int i = 0; i < count; i++)

count发生了变化,但是这里的值时旧的,会 throw OutOfRange Exception

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <31687ccd371e4dc6b0c23a1317cf9474>:0)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:945)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:970)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:970)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:970)
FairyGUI.Container.DoFairyBatching () (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:882)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:967)
FairyGUI.Container.CollectChildren (FairyGUI.Container initiator, System.Boolean outlineChanged) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:970)
FairyGUI.Container.DoFairyBatching () (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:882)
FairyGUI.Container.SetRenderingOrder (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:851)
FairyGUI.Container.Update (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:828)
FairyGUI.Container.Update (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:814)
FairyGUI.Container.Update (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:814)
FairyGUI.Container.Update (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:814)
FairyGUI.Container.Update (FairyGUI.UpdateContext context) (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Container.cs:814)
FairyGUI.Stage.InternalUpdate () (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/Stage.cs:768)
FairyGUI.StageEngine.LateUpdate () (at ./Library/PackageCache/fairygui/Runtime/Scripts/Core/StageEngine.cs:28)
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

1 participant