This allows you to easily pin your UI elements to nine positions on the user's screen: top left, top right, and so on. You can also customize the screen size to facilitate transplantation between multiple devices. this super simple C # extension script provides a method called "screenplacement.
After adding the script to the inverted project, you can easily place your content in one of the nine positions on the screen using screenplacement.
JS Code?
12345 |
// Place an object in the lower right corner of the screen: transform.ScreenPlacement(ScreenPosition.LowerRight); // Place an object to the bottom right corner of the screen, 60 pixels away from the right side of the screen, and 20 pixels away from the bottom: transform.ScreenPlacement(ScreenPosition.LowerRight, new
Vector2(60,20)); |
If you want to switch a camera to help display some content, you need to pass the screenposition to your camera to ensure that the content displayed in the camera can be accurately calculated.
JS Code?
12345 |
// Place an object in the lower-right corner of the screen. For more information, see myinterfacecamera: transform.ScreenPlacement(ScreenPosition.LowerRight, MyInterfaceCamera); // Place an object in the lower-right corner of the screen, 60 pixels away from the right side of the screen, and 20 pixels away from the bottom. For details, refer to myinterfacecamera: transform.ScreenPlacement(ScreenPosition.LowerRight, new
Vector2(60,20), MyInterfaceCamera); |
If you need this package, you can download it in my resource area.