![]() ![]() Other than Apple’s MFi controller specification, there is no standard for how controllers should work, or what controls they should have and how those behave. ![]() Sometimes they work partially or not at all. Every controller seems to behave slightly different on every platform. ![]() If (Input.touchSupported & atform != RuntimePlatform.If you know anything about controllers and cross-platform support, you know that finding consistent, functional behavior is a fool’s errand. In the Update loop we’ll want to check if we should handle touch or mouse controls, and we’ll define two empty functions (for now) that we can call in either case: In any case, this is all we’ll need in our Awake function, and we’re ready for some actual logic. You could also replace this with cam = Camera.main but I prefer to use GetComponent in case you ever add another camera to your game or remove the MainCamera tag from your camera. This should be familiar to you if you’ve used Unity before, we’re simply grabbing the Camera component of the GameObject. Next up we have the Awake function where we’ll grab a reference to the camera: This property, unlike the lastPanPosition, is only applicable in touch-mode, and is not used for mouse controls.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |