Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

CanvasRenderer.OnTransformChanged

Discussion in 'UGUI & TextMesh Pro' started by Daybreaker32, Jun 30, 2015.

  1. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
    can anyone explain what does CanvasRenderer.OnTransformChanged mean?



    i'm on 5.0.1f1 and afraid to upgrade to newer version.
    is this a bug or has been fixed on the newer version?
     
  2. AwDogsGo2Heaven

    AwDogsGo2Heaven

    Joined:
    Jan 17, 2014
    Posts:
    102
    Anytime you change the position of something in a UI, it has to adjust the Rect Transforms for any of its children so an event is thrown. I believe that's it for.
     
    Daybreaker32 likes this.
  3. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
    I do have a screen space - camera canvas as a child of a moving camera though.
    did you get that from the docs or did you know any writing about this?
     
  4. AwDogsGo2Heaven

    AwDogsGo2Heaven

    Joined:
    Jan 17, 2014
    Posts:
    102
    I didn't get it from docs, just my own observations. I haven't tested it with a moving camera, but I know if I move a parent of a rect, I will see that call, and the more children I have, the more overhead it seems to create. I imagine if your moving your canvas around with a camera its probably calling that all the way down the chain. I'm not really sure what the solution is as far as making it more efficient, I saw somewhere in the forums about using 'anchoredPosition' on the rect instead of position but I didn't get any noticeable performance benefit from that.
     
  5. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
    Hmm.. Looks like I've got some restructuring to do.
    Something like this should be in the docs, right? Like, UI best practice or something.

    Thank you then.
     
  6. Skflowne

    Skflowne

    Joined:
    Apr 6, 2014
    Posts:
    14
    I'm also getting a lot of overhead from this function because I have a long scroll list with quite a lot of elements, did you figure out a way to make it less heavy ?

    Maybe removing layout groups or content size fitters would help ?
     
  7. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
    We've got quite different problem.
    In my case, I've just got to freeze my canvas' (and it's parent's) position.

    Could you try to limit the showed listed items and hide (deactivate) the rest?