So what exactly would the method for executing this script be AngryGerman?
1. Attach the script to the container of your options (draggable contents). I will call my container "TestContainer"
2. CAll TestContainer.Recenter(ObjectToCenterOn);
Is that it? I'm trying to do something similar and would love your help.
@Donkey:
1.)
CenterOnChild is on the same GO in the Hierarchy as the UIGrid which is a child of the GO that contains the DraggablePanel, so:
DraggablePanel
|
-> UIGrid
UICenterOnChild
2.)
call Recenter(yourGO) with a reference to UICenterOnChild
e.g.: centerOnChild.Recenter(yourGO); (or adjusted to Aren's suggestion)
Why not just do gameObject.transform.position? CenterOnChild goes to a position, does it not?
@Aren: you mean passing in a GO's position, rather than a GO as a whole if I understand you correctly? Would work too, but then I have to type (go.transform.position) for every call to Recenter(). I can save myself that by passing the whole GO and dig down into the position inside the function
