A UI interface (named: UI_A) is added to the game, and there are four buttons: UI_UP, UI_Left, UI_Down, UI_Right. When the four direction buttons are clicked, UI_A needs to move a given distance in the corresponding direction. . How can I get the attributes of UI_A so that the four buttons can move UI_A?
How to move added UI?
The plugin has to remember where the UI was previously placed, destroy the UI, then create it again. This is not ideal, but that's the best we can do with what facepunch has provided.
WhiteThunder
The plugin has to remember where the UI was previously placed, destroy the UI, then create it again. This is not ideal, but that's the best we can do with what facepunch has provided.
Is it because the relevant information of the UI cannot be directly obtained?
Both of the following reasons are relevant:
- There is no RPC call from the server to the client that can instruct a client to reposition an existing CUI element. Therefore, if you want to reposition an element, you must instruct the client to delete the existing element and construct a new one.
- There is no way for the server to query the client about which CUI elements it is showing. Therefore, the server must keep track or which elements it instructed each client to create/destroy.
WhiteThunder
Both of the following reasons are relevant:
- There is no RPC call from the server to the client that can instruct a client to reposition an existing CUI element. Therefore, if you want to reposition an element, you must instruct the client to delete the existing element and construct a new one.
- There is no way for the server to query the client about which CUI elements it is showing. Therefore, the server must keep track or which elements it instructed each client to create/destroy.
Thank you for your pointers, I understand. Next, I will destroy it in advance as you said before adding it.