Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: alexh0101 on September 02, 2014, 02:44:43 PM

Title: How do I use NGUIMath.OverlayPosition?
Post by: alexh0101 on September 02, 2014, 02:44:43 PM
I've been trying to understand how to use it but there is no example in the documentation:

I'm making a scoring label (with a Tween Position) that is spawned above an Enemy gameObject when the enemy is destroyed.
But the "from" and "to" parameters seem to be in World coordinates where was my prefab have local coordinates.

I know I'm supposed to use AddChild() but how can I add a child to a gameObject I'm about to destroy? Any alternative to Instantiate()?

Also I tried to do something like:

  1. scoringPrefab.transform.position = NGUIMath.OverlayPosition(
  2.                                          scoringPrefab.transform,
  3.                                          enemyInstance.transform,
  4.                                          theCamera,
  5.                                          theCamera) ;

But I get the error: : 'OverlayPosition' is not a member of 'NGUIMath'.

What can I do to make this work?

Thanks in advance
Title: Re: How do I use NGUIMath.OverlayPosition?
Post by: ArenMook on September 03, 2014, 11:12:47 AM
transform.OverlayPosition

It's an extension method, not a function.