Importing the CrossPlatformInput package adds a menu item to Unity, "CrossPlatformInput", which allows you to enable or disable the CrossPlatformInput in the editor. You must enable the CrossPlatformInput in order to see the control rigs in the editor, and to start using Unity Remote to control your game.
The CrossPlatformInput sample assets contains two main sections.
1) The folder of prefabs provide a variety of ready-to-use "MobileControlRigs". Each control rig is suitable for a different purpose, and each implements the touch or tilt-based equivalent of some of the default standalone axes or buttons. These are ready to drop into your scene, and to use them you simply need to read the axes via the CrossPlatformInput class, rather than Unity's regular Input class.
2) The set of scripts provided are the scripts we used to put together the control rigs prefabs. They provide a simplified way of reading basic mobile input, such as tilt, taps and swipe gestures. They are designed so that various mobile controls can be read in the same way as regular Unity axes and buttons. You can use these scripts to build your own MobileControlRigs.
For example the Car control rig feeds the tilt input of the mobile device to the "Horizontal" axis, and has an accelerator and brake touch button which are fed as a pair into the "Vertical" axis. These are virtual equivalents of the real "Horizontal" and "Vertical" axes defined in Unity's Input Manager.
Therefore when you read CrossPlatformInput.GetAxis("Horizontal"), you will either get the "real" input value - if your build target is non-mobile, or the value from the mobile control rig - if your build target is set to a mobile platform.
The CrossPlatformInput scripts and prefabs are provided together as an example of how you can implement a cross-platform control solution in Unity. They also allow us to provide our other sample scenes in a form that can be published as standalone or to mobile targets with no modification.
To use the CrossPlatformInput, you need to drop a "Mobile Control Rig" into your scene (or create your own), and then make calls to CrossPlatformInput functions, referring to the axes and buttons that the Rig implements.
When reading input from the CrossPlatformInput class, the values returned will be taken either from Unity's Input Manager settings, or from the mobile-specific controls set up, depending on which build target you have selected.
The CrossPlatformInput class is designed to be called instead of Unity's own Input class, and so mirrors certain parts of the Input API - specifically the functions relating to Axes and Buttons:
GetAxis, GetAxisRaw
GetButton, GetButtonDown, GetButtonUp
Notes for coders:
This package sets two compiler define symbols. One is always set automatically, the other is optionally set from a menu item.
Importing the "CrossPlatformInput" package will automatically add a compiler define symbol, "CROSS_PLATFORM_INPUT". This enables the CrossPlatformInput functions defined in some of the other Sample Asset packages (such as the Characters, Planes, etc). Without this symbol defined, those packages use Unity's regular Input class, which means they can be imported alone and still work without the CrossPlatformInput package.
The optional define (which is set by default, but can be disabled using the "Mobile Input" menu), is "MOBILE_INPUT". This causes the MobileControlRigs to become active when a mobile build target is selected. It also enables certain mobile-specific control nuances in some of the packages, which make more sense when the character or vehicle is being controlled using mobile input (such as auto-leveling the character's look direction). This define is optional because some developers prefer to use standalone input methods instead of the Unity Remote app, when testing mobile apps in the editor's play mode.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 1、该资源内项目代码都是经过测试运行成功,功能正常的情况下才上传的,请放心下载使用。 2、适用人群:主要针对计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、数学、电子信息等)的同学或企业员工下载使用,具有较高的学习借鉴价值。 3、不仅适合小白学习实战练习,也可作为大作业、课程设计、毕设项目、初期项目立项演示等,欢迎下载,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
基于赛车的多人网络在线游戏完整源码.zip (988个子文件)
new terrain.asset 6.87MB
terrain.asset 2.12MB
body_s.BMP 1MB
wheel_s.BMP 257KB
polysplatting.cginc 5KB
CrossPlatformInputManager.cs 6KB
ProtectCameraFromWallClip.cs 6KB
AutoCam.cs 6KB
CrossPlatformInputInitialize.cs 5KB
FreeLookCam.cs 5KB
VirtualInput.cs 5KB
TiltInput.cs 4KB
TouchPad.cs 4KB
PlayerCar.cs 3KB
AbstractTargetFollower.cs 3KB
MobileInput.cs 3KB
TargetFieldOfView.cs 3KB
Joystick.cs 3KB
MouseLook.cs 3KB
LookatTarget.cs 3KB
AxisTouchButton.cs 2KB
StandaloneInput.cs 2KB
MobileControlRig.cs 2KB
HandHeldCam.cs 1KB
ButtonHandler.cs 872B
PivotBasedCameraRig.cs 787B
MainSenceController.cs 723B
MainUIController.cs 494B
InputAxisScrollbar.cs 336B
Car Cubemap.cubemap 24MB
MissionCntrl_Cubemap.cubemap 1.5MB
sunset cubemap.cubemap 98KB
blue sky cubemap.cubemap 98KB
Mesh.dae 4.12MB
Road_Assembly_FBX.fbx 7.18MB
gtr35.FBX 2MB
Road_Coll.fbx 1.48MB
tire_set.fbx 1.35MB
MissionControl_FBX_v2.fbx 1.17MB
Sea_Rock_FBX02.FBX 1.01MB
electricalTower_set.fbx 609KB
Gallery_FBX.fbx 514KB
Pine_Main.fbx 353KB
Wall Tunnel.FBX 318KB
Wall Curve.FBX 276KB
FuelTank_FBX.fbx 233KB
oildrum_set.fbx 184KB
Mission_Control_Fence_FBX.fbx 173KB
Wall Tunnel02a.FBX 159KB
roadsign.fbx 134KB
Mission_Control_LightPoleCutDown_FBX.fbx 128KB
CoastRoad_FBX.fbx 112KB
one_part.fbx 102KB
part_two.fbx 89KB
part_five.fbx 87KB
Coastline FBX.FBX 80KB
part_thirght.fbx 80KB
part_four.fbx 79KB
Tree_Generic.fbx 69KB
Tunnel Sun Screen.fbx 69KB
BridgeSupport_FBX.fbx 53KB
Sea_Rock_FBX01.fbx 52KB
Parkinglot_FBX.FBX 41KB
Water_FBX.FBX 39KB
LightPole_FBX.fbx 37KB
50mm Zoom.flare 5KB
Sun.flare 4KB
50mm Zoom.flare 3KB
Halogen Bulb.flare 3KB
Small Flare.flare 2KB
GUISkin.guiskin 99KB
DirtPathTexture01.jpg 918KB
body_n.jpg 830KB
grass.jpg 550KB
pebble_gravel_seam6.jpg 418KB
RoughDirtTexture01.jpg 416KB
Grass01.jpg 348KB
grass.jpg 341KB
wheel_n.jpg 259KB
StoneTexture01.jpg 242KB
StoneTexture02.jpg 242KB
GravelTexture01.jpg 144KB
asphalt.jpg 124KB
Bluesky Front.jpg 96KB
Bluesky Up.jpg 95KB
Bluesky Left.jpg 87KB
Bluesky Right.jpg 81KB
Bluesky Back.jpg 78KB
Sunset Up.jpg 66KB
Sunset Front.jpg 64KB
Sunset Left.jpg 56KB
Sunset Right.jpg 50KB
Sunset Back.jpg 50KB
sand.jpg 44KB
water512.jpg 36KB
water512_bump.jpg 36KB
Sunset Down.jpg 306B
Bluesky Down.jpg 306B
AICar_Script.js 7KB
WheelFriction_Script.js 6KB
共 988 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
龙年行大运
- 粉丝: 1002
- 资源: 3854
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功