c# - Converting Input.GetAxis to touch screen -


i created pong game in unity using c#. works on computer work on windows phone. believe have change input.getaxis kind touch control don't know how do

i'll post code here paddle. other paddle ai.

public float paddlespeed = 1; public vector3 playerpos;  void update () {     float ypos = gameobject.transform.position.y + (input.getaxis ("vertical") * paddlespeed);     playerpos = new vector3 (-315, mathf.clamp (ypos, -148,148),0);     gameobject.transform.position = playerpos; } 

you might need add conditional compiler directives. see page:

http://docs.unity3d.com/manual/platformdependentcompilation.html

so:

#if unity_wp8    // touch code windows phone 8 #else     // other platform #endif 

for touch input should go @bart's comment.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -