VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.UI.AVR_Canvas.anchor_to_transform ( Transform  t)
inline

Anchor this canvas to a given transform. Effectively the same as calling transform.SetParent(...)

Parameters
tTransform the canvas will be parented to

Definition at line 104 of file AVR_Canvas.cs.

105  {
106  if(t==null) {
107  // We need to do this circus each time we parent to world because something doesnt work. I seriously can't figure out what, but either way, performance impact should be close to nothing.
108  Vector3 tmp = this.transform.position;
109  this.transform.SetParent(null, true);
110  transform.position = tmp;
111  }
112  else{
113  this.transform.SetParent(t, true);
114  }
115  }