Author Topic: How do I use NGUIMath.OverlayPosition?  (Read 3201 times)

alexh0101

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 30
    • View Profile
How do I use NGUIMath.OverlayPosition?
« 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
« Last Edit: September 02, 2014, 05:29:37 PM by alexh0101 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How do I use NGUIMath.OverlayPosition?
« Reply #1 on: September 03, 2014, 11:12:47 AM »
transform.OverlayPosition

It's an extension method, not a function.