- Home /
Will Multiple Billboarding Sprites Kill My Game Performance ?
I'm using a quite simple method of Turning my quest givers icons to always face the player. Basically an empty object with a sprite attached above the NPC's head. (this is my code)
public class IconBillboard : MonoBehaviour
{
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
transform.LookAt(transform.position + Camera.main.transform.rotation * Vector3.forward, Camera.main.transform.rotation * Vector3.up);
}
}
However, it just occurred to me that In some scenes I could have 20-30 quest givers. Will this have a significant (if any) impact on my games performance? If so is there a more efficient way of doing this? Like maybe only turning those sprites that are currently visible to the player?
Thanks for any help.
This shoudl be fine, just try it.
Somethign you could do is make a billboard manager that loops through all of them.
void Update()
{
foreach(GameObject billboard in billboards)
{
billboard.transform.LookAt(billboard.transform.position + Camera.main.transform.rotation * Vector3.forward, Camera.main.transform.rotation * Vector3.up);
}
}
Your answer
Follow this Question
Related Questions
[Performance] RenderForwardAlpha performance issue on Android with Unity 5.3.0f4 0 Answers
4.6 -> 5.0 Dramatic Performance Loss - No batching? 1 Answer
Apparent FPS cap on high refresh rate monitors 0 Answers
Unity 2D Sprite Packer and Packing tags taking effect immediately after setting up? 1 Answer