Search Unity

Having a worldspace GUI not rotate with its parent

Discussion in 'Immediate Mode GUI (IMGUI)' started by JtheSpaceC, Oct 14, 2014.

  1. JtheSpaceC

    JtheSpaceC

    Joined:
    Oct 5, 2014
    Posts:
    14
    Hi. So using the new Unity 4.6 Beta UI, I have a world space canvas on ships to display their health (top down). I want the UI element to ignore rotation so I have the following script:

    1. publicclass UI_nonRotate :MonoBehaviour{
    2. privateQuaternion rotation;
    3. voidAwake()
    4. {
    5. rotation = transform.rotation;
    6. }
    7. voidLateUpdate()
    8. {
    9. transform.rotation = rotation;
    10. }
    11. }
    Now this works, (FixedUpdate had it jittery) but I'm wondering is there a better way to be ignoring the rotations of a parent than always scripting for it. Is this type of scripting expensive, or is it the best way?
     
    Suminsky likes this.
unityunity