Incontrol

Unity插件 · 01-28 · 214 人浏览

0.导入上面插件,出错后再上面一排incontrol导航栏,安装step inputmanager settings
1.hierahy面板,右键 incontrol-manager,出现incontrol物体
2.选中incontrol incontrol manager 右键 incontrol touch manager
3.添加按钮,选中incontrol,在touch manager scrpt

 create button control 设置颜色等等

offset 设置偏移
4.删掉原有摄像机的cameria中 culiling mask 中的ui图层
5.创建摇杆 选中incontrol,在touch manager scrpt
create stick control 设置颜色等等
ring 设置背景圆盘
konb 设置圆盘上面内容
don't destroy on load 勾上后 切换场景也不会消失

//得到摇杆向量
Vector2 dir = InputManager.ActiveDevice.LeftStick.Vector;
if (dir.x != 0 || dir.y != 0)
{

 ani.SetFloat("movevalue", dir.magnitude);
 ani.SetFloat("lookX", dir.x);
 ani.SetFloat("lookY", dir.y);

}
else
{

 ani.SetFloat("movevalue", -1);

}

transform.Translate(dir 1.5f Time.deltaTime);

    if (InputManager.ActiveDevice.Action1.WasPressed)
    {
        print("按下了A");
    }
    if (InputManager.ActiveDevice.Action1.WasReleased)
    {
        print("松开了A");
    }
    if (InputManager.ActiveDevice.Action2.WasPressed)
    {
        print("按下了B");
    }



    //隐藏UI
    //TouchManager.ControlsEnabled = false;

j1.jpg
j2.jpg
j3.jpg

Theme Jasmine by Kent Liao