Hi, everyone, I don't know if I'm being silly, but I can't get this to work. I basically want to change the spin rotation type depending on if the player is dragging on the screen or not (excluding when the pointer is over himself). Problem is, no matter how I do it the camera doesn't react at all... I've tried attaching it to a field in the inspector, tried searching it by script/name, but nothing, so I'm wondering if I'm casting it wrong or if there's something else I need to do to get to the camera... also, in case it's important, I have 3 cameras, but only one is a third person camera. Also I'm using Mouse and Keyboard/direct control. And, Here is a basic example of the code (but I'm actually using raycasts, and other stuff):
using AC;
public GameCameraThirdPerson CloseUpCam;
void Awake()
{
CloseUpCam = FindObjectOfType<GameCameraThirdPerson>();
}
void OnMouseDrag()
{
if (CloseUpCam.spinLock != RotationLock.Locked)
// I've tried without the conditionals but same, also I want them because th code will be in a loop
{
CloseUpCam.spinLock = RotationLock.Locked;
}
}
void OnMouseUp()
{
if (CloseUpCam.spinLock != RotationLock.Limited)
{
CloseUpCam.spinLock = RotationLock.Limited;
}
}
Anyways, has anyone had to do this before who can give me an idea? As always, any advice will be greatly appreciated.
Comments
Try writing a simple OnGUI function to display buttons that manually change the spinLock variable, to test that they actually respond properly. Assuming they do, the problem will then be narrowed down to the OnMouseDrag/Up functions not getting called.