Making the CameraRayCaster static or singleton?

should we make the CameraRayCaster as singleton better in long run? since it seems we won’t use any extra copy in the same scene

1 Like

Im wondering the i same thing. I believe so man. it seems like a more efficient way since in doing so registered classes dont have to look for the reference on Start. They can just call the instance of the singleton.

I would have thought the same thing, but inside the suggested reading, Game Programming Patterns, the chapter about Singletons basically says they are more trouble than the solutions they provide in many cases.

I am not much help past this, however. He mentions a ton of stuff like Globals, and using statics instead. I have looked to see how to implement those instead, but I got confused really fast.

Maybe someone else here can explain better than me?

-Nibernator

Privacy & Terms