Hi all,
I’m looking for a better way to do this with cinemachine.
I have multiple cameras, I want to enable one via clicking on a box and disable all the others. The script attached works, but if I have 20+ cameras it will be quite ridiculous and I don’t wanna be that guy.
Any help much appreciated!
Hi there,
I can think of two solutions for you:
- Store all your cameras in a list, then disable all your cameras and activate the camera you want.
- Store your current active camera in a variable and disable the previous.
But I think you should create a subgraph that takes in a parameter, the camera you want to activate, and does all the necessary stuff inside that subgraph.
Something like this:
Thank you for your reply!
I’m not familiar with Subgraphs, so I’ll check these out.
I actually figured this out, though, on my own …I did basically exactly as you said with the variables, but set them as scene variables. It works well.
Thanks again.
1 Like
Glad you figured this out yourself.
Just a warning though, you should be careful when using multiple subgraphs in parallel ( Incorrect output value with multiple Subgraph instances )
My advice for you is that once you are comfortable with the Unity API (method names), you should drop visual scripting and learn C#. You will be so much better in the long run (functionalities, resources, version control, LLM, debugging, performance, …)
1 Like
Thanks for the tips.
I’m a huge fan of visual scripting - I was completely lost in Unity until I found it. I use node based systems in other work (grasshopper, tyflow, 3ds max material editor) so it works well for me.
I don’t plan on becoming a game developer or anything and I’m only using Unity to create simple interactive experiences for ArchViz so I do hope to stick to visual scripting, but if I make the move into more complex territory I do suspect you’re right.