I’m trying to add billboards to my game, but I’m having a problem! My game supports a splitscreen mode too, therefore I have up to 4 cameras. In such a case how do I make the billboards face the cameras?
Since the Update method is only called once a frame (which in this case is obviously not enough), I’d need something like OnPreRender to change the rotation. But to use that, I’d have to attach EVERY billboard to EACH camera, which I’d like to avoid!
Any suggestions?
As long as the billboards are not too complex wouldn't it be possible to simply put each one for each player on a layer that an opposing camera can not see? I am not sure how efficient this is and it definitely is not, but if your billboards are very simple this should not cause to much trouble. Of course for something like an iphone game I am assuming this is out of the question.
EDIT: To clarify I am not suggesting to use this in any kind of a final build or in any situation where it is avoidable as it just feels like a pretty lazy solution overall, and it is terribly inefficient, but for a quick fix on a test build that will be fixed up later.
Just do your billboard code in MonoBehaviour.OnWillRenderObject. It is called for every camera just before it is rendered. Camera.current holds the camera on duty.
You can use the Particle system to create billboards: they always face the camera currently being rendered. Take a look at this article.