Pergunta

In a game, as far as camera controlling scripts, would you have one "camera control script" that handles all the cameras, or a script for each individual camera (player camera, cutscene cameras etc).

I'm just trying to figure out the proper way to handle scripting in unity that will keep things simple in the long run as well as be memory efficient.

Camera actions would be following the player for the player camera, or panning around a cutscene or staying still for a different cutscene

Foi útil?

Solução

It really depends on the scenario/work flow/production pipe, it really doesn't matter which way you organise it but if you are less comfortable with scripting I would say putting it all in one file is probably the best way to deal with it at the moment.

I would normally say that if you plan to reuse segments of code its generally a good thing to keep things modular i.e. one class per script.

EDIT: To your specific problem, I would have a system in which you switch between one (or more) camera/s that translates between scripted points i.e. stored vector3 variables (for static cameras and cinematic) and the main camera which has the movement script associated with it. This way you minimise the amount of cameras you are using in your scene and you can reuse the static cameras as many times as you need to.

A tidy way to deal with the data storing might be to use an array of structs that can store all the data you need, i.e the cameras position, rotation, FOV etc

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top