Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
fw:unity3d:plugins [2014/04/24 10:47] alfred |
fw:unity3d:plugins [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 70: | Línea 70: | ||
| To create an interface you will need to do ''Main Menu -> NGUI -> Create -> 2D UI''. It will create a new camera which you should put into a new layer. | To create an interface you will need to do ''Main Menu -> NGUI -> Create -> 2D UI''. It will create a new camera which you should put into a new layer. | ||
| + | You will add widgets to the scene, then attach a label script, a button script, etc. | ||
| ==== Atlas ==== | ==== Atlas ==== | ||
| An atlas is an image file which contains several other subimages that can be rotated and disorganized to optimize space. It's used as unique texture\image for game elements, it's generated a text file which is attached to the atlas to indicate image coordinates and orientation. It improves the performance in the graphics engine when use it as a simple texture for several elements. | An atlas is an image file which contains several other subimages that can be rotated and disorganized to optimize space. It's used as unique texture\image for game elements, it's generated a text file which is attached to the atlas to indicate image coordinates and orientation. It improves the performance in the graphics engine when use it as a simple texture for several elements. | ||
| Línea 79: | Línea 80: | ||
| ==== How to... ==== | ==== How to... ==== | ||
| - | === Make a === | + | === Make a label follow a GameObject === |
| + | Being in the GameObject script... \\ | ||
| + | Being the guiCamera the NGUI camera... \\ | ||
| + | Being the continueLabelPosition variable for margins in the image... \\ | ||
| + | <code csharp> | ||
| + | Vector3 pos = Camera.main.WorldToViewportPoint(transform.position); | ||
| + | theLabel.transform.position = guiCamera.ViewportToWorldPoint(pos + continueLabelPosition); | ||
| + | pos = theLabel.transform.localPosition; | ||
| + | pos.x = Mathf.RoundToInt(pos.x); | ||
| + | pos.y = Mathf.RoundToInt(pos.y); | ||
| + | pos.z = 0f; | ||
| + | theLabel.transform.localPosition = pos; | ||
| + | theLabel.text = (GameManager.instance.continueTimeLeft-1).ToString(); | ||
| + | </code> | ||