Author Topic: UIFollowtarget is shifted  (Read 2985 times)

spektron

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UIFollowtarget is shifted
« on: August 08, 2014, 01:00:20 PM »
Hi,
I try to explain what happens at runtime:
+ I have a gameObject that at start spawns a NGUI element centered on UIRoot
+ the NGUI element is sprite with a label as child
+ both the spawned obj and its child are save in a variable
+ the spawned obj is issued a target to follow
+ in the prefab of NGUI element, in the uifollowscript, I already had the game camera point to a prefab of the camera ingame.

Everythng works except that I dont see it ingame, but if I check the scene tab, the element is there, following and all, but shifted outside of the borders of the ui camera.

Any idea?
thanks

spektron

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UIFollowtarget is shifted
« Reply #1 on: August 08, 2014, 02:55:31 PM »
Ok, I understand that I saved the NGUI prefab with the gameCamera value referring to the camera prefab, while ingame the UIFollowTarget script needs the instance of the camera prefab.

Is there a script to assign the correct camera at runtime, or tell the script to search for the proper one (in the cs it does actually search for a camera)?
I'm also using playmaker, so any help in that direction would be even better.


spektron

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UIFollowtarget is shifted
« Reply #2 on: August 08, 2014, 03:40:20 PM »
Solved by making a proper script.

Thanks ;)