Recommended Posts

1 hour ago, stupid_chris said:

Other than that, is there any particular reason it seems to be recommended to anchor in the top left? Just as a convenience or does KSP handle it's Canvas in a specific way that makes this more convenient?

There's no particular reason to use a top-left anchor. If you set the anchor and pivot center to top-left (pivot x = 0, y = 1) then I suppose it's a little easier to position elements; x pixels to the right of the parent's left side, and -y pixels down from the top.

If you have a completely static UI, no option to resize the window, no dynamically changing elements or window size, then you can set the anchors to whatever you want. Top-left (or bottom-left) does make some sense for the top level of the UI window, since it makes it a little easier to position the window on screen (though you do run into potential problems with the UI loading off the screen on the right or the bottom, having some code to clamp the window position to the screen helps with this).

But for a dynamic UI there are lots of cases where you want other anchors. You might want elements that stick to different corners of your UI when you resize it. Or you want elements to expand to fill the window (using the blue anchor preset options). And there are other more complicated situations, like you want a label to be 1/3 of the way along a resizable bar, then you would need to manually set the anchors.

As I think I mentioned somewhere in the tutorial, the rect transform anchors are confusing and the best way to get a handle on them is just to fiddle around with them. This is also a situation where having your code run in the Unity editor is helpful. You could run all of the code needed to add a re-size handle to a window, then just play the scene in the editor and see how the different rect transform anchors behave, instead of having to run KSP every time you need to change something.

Share this post

Link to post
Share on other sites
Posted (edited)

I am follow all the steps but I did't have the .ksp file extension.

error img:

is my first mod and I have many difficulties, mainly because I can not use legacyUI.
Another thing that disturbs me is the lack of fluency in English.



Edited by Scout_Ro

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.