snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.63k stars 290 forks source link

Move To Front does not work #869

Closed iwanPlays closed 4 years ago

iwanPlays commented 4 years ago

Portrait - MoveToFront does not work.

To Reproduce Add two characters (c1, c2) and Show c1, then c2 at same stage position (e.g. Left). Use Portrait - MoveToFront block to move c1 to the front.

Result c1 remains in the background. c2 is in the front.

Expected behavior c1 is in the front

Screenshots characters in stage canvas While the game is playing, the gameObject Stage > Canvas has character holders as children. These character holders have portraits as children.

The current code rearranges the children of the character holder objects. Instead the code should rearrange the character holders.

Versions & Platform (please complete the following information):

iwanPlays commented 4 years ago

The solution is to add another .parent to each of the two parts of line 393 in Portrait Controller

options.character.State.portraitImage.transform.SetSiblingIndex(options.character.State.portraitImage.transform.parent.childCount);

becomes

options.character.State.portraitImage.transform.parent.SetSiblingIndex(options.character.State.portraitImage.transform.parent.parent.childCount);