Hi all! Tried asking this on the Discord several days ago, but it seems to be dead? This forum is more active so I am posting here instead. Anyway, I am still sloowwwly working my way through learning AC and I have a question.
So I have two cameras in a scene. When my player moves across a trigger, the camera transitions to a different angle, and vice-versa. All well and good. What I'm wondering is if there's a way to check WHICH camera is being used at a given time? What I want is to check if the current camera is Camera A, then switch to Camera B if so (and vice versa).
Currently I make the check using a boolean that changes with the camera, but there are many places in the game that the camera can change and it's very messy to change the variable every time. It would be much easier and cleaner to just check which camera is being used. Is that possible?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
There isn't an "official" Action to do this, but you can incorporate a custom Action that does.
The currently active Camera is listed in the MainCamera's Inspector at runtime. Through script, this can be read with:
AC.KickStarter.mainCamera.attachedCamera;
(See the front page of the Scripting guide for a guide on how to access AC variables and components)
Here's a custom Action you can use to check if a given camera is active or not:
http://pasteall.org/1512358/csharp
Oh good! Scripting. I'll play around with that. THanks!
After spending some time figuring out how to add a custom action, this works like a charm! Thank you!
Hello! Sorry to hijack an old thread, but this is exactly a problem I am currently having. However, the code link no longer works, so I was wondering if you could provide access to the custom script again. Thanks to any who read this and can help out!
I believe this was it:
Thanks Chris, it works like a charm.