[update] dynamic canvas sorting order#102
Conversation
|
I'm actually happy about the current implementation. User may initially have a canvas with Sorting Order 0. This script sets FileBrowser's Sorting Order to 1. Then if user instantiates another canvas with Sorting Order 2, it will be rendered above the FileBrowser. But if FileBrowser's Sorting Order remains as 2020, this issue won't occur. In the case that the fixed Sorting Order doesn't suffice, it's possible to either edit the prefab or put the FileBrowser prefab in the scene and modify it from there (but that instance must be deactivated manually in Start). |
|
OK, I get you~ I will give you another PR. |
|
你担心的下一个面板会拦住 SFB,因此设置了固定值 2016,但是我认为固定的还是不太好: 因为你不能保证用户不会用到大于 2016 的 renderOrder,因此:
以下为 gpt 翻译/ translate by gpt below: You are concerned that the next panel will block SFB, so you set a fixed value of 2016, but I think it is still not ideal: Because you cannot guarantee that users will not use a renderOrder greater than 2016, so:
|
|
As you said though, it unfortunately can't be guaranteed. It always depends on the user's project. User's next canvas might have 3000 Sorting Order. Or user's current canvas might have 100 Sorting Order but they may want it to be displayed above everything, including SFB. With the current solution, SFB would have 100+2016=2116 Sorting Order and be rendered above that canvas. User then would have to set their canvas' sorting order to something greater than 2116 by code. I think that's actually more problematic than the current problem. |
|
是的,用户的需求千奇百怪,直接手动设置作为对于这款受众众多的插件来说算得上是一个最佳解~ |
|
那希望你可以在参数中加一个 renderOrder的可选参数,默认值就是你设定的2016,这样方便用户使用 |
|
How about this code:
|
是的,我也是意识到了 Instance 是私有的,然后,还得查找 Canvas ,而这一切通过你的 Show 函数就可以轻易传递进去,然后,使用 Option 参数的好处是,用户的任何调用代码没有丝毫变化。 当然,如果 rendererorder 赋值动作是一个非常罕见的操作,那么,可以不考虑加入上面的改善。 |
|
Yeah I believe it's a very rare operation. So my cleanest solution right now is the |
No description provided.