I am using AC with a First Person camera and at some point, I want to be able to switch cameras using Playmaker.
Switching cameras from within an AC ActionList works fine (using Cameras - Switch), but the Playmaker action "Set Main Camera" doesn't work (probably because of using the first person camera in AC).
I was thinking of creating an AC ActionList with a GameObject parameter and a Cameras-Switch action inside which I could call from Playmaker, but I can't seem to figure out how to pass the GameObject onto AC from PM (when using the Send Message Action, with the ActionList as the GameObject and using the Interact method, if I specify the camera as the Parameter, it doesn't seem to be passed onto the AC ActionList).
As AC has no GameObject type variables, I can't either share a global variable with PM which could contain the camera and then just call the ActionList from PM to switch the camera.
Any ideas on how to go about this? Any way in which PM can pass object parameters back to AC?
Comments
actionList.GetParameter (0).SetValue (myGameObject);
Where "0" is the ID of the GameObject parameter, and "myGameObject" is your new value. Calling this before Interact will set the value when next run.
However, it should be possible to still have AC's MainCamera disable in favour of the PM one. What exactly happens when "Set Main Camera" is run?
However, when I stop the game and then restart it, I can't move anymore and the console displays "Starting a non-First Person game with a locked cursor - is this correct?".
Any Settings Manager option you want to change during gameplay will need to be set to its default value in its ActionList on start game asset, which is also defined in the Settings Manager. You can see this noted in the "Movement methods" chapter of the Manual (Section 2.2).
It would be difficult to "mix" the two movement methods like that - first-person spin rotation works by rotating the player, not the camera - so this would conflict with any movement due to clicking. You could, however, write a custom first-person camera script that spins itself (not the player's root), and this would be independent of the straight-to-cursor movement (which I'd suspect would be set as the default).
Custom cameras can be added by adding the "Basic Camera" + Unity Camera components onto an object with your own script. It will then be visible to your Manager / Action fields. Since it won't be the AC first-person camera, you'll need to assign it manually during gameplay using the "Camera: Switch" Action. To attach it as a child object of the Player, which is normally spawned at runtime, you can just leave the player object in the scene file so that you can modify it as necessary.