Im using standard assets mobile cross platform controls. The jump button works, i don
t understand why Fire1 does not.
I duplicated the buttons and changed the name.
*Update
Shove the mobile UI into player folder, then throw it into the old prefab.
Now it works. Phew… I think it was not updating the old position when player moved.
Maybe there is another way around this, but for now this works.
I added a “on click button”
However when i use mobile inputs, the bullet does not shoot relative to the player
it shoots in one place and does not move with player. When i turn of mobile inputs, to just my keyboard it works fine and follows the player when he shoots
this is my code
if i send you my file can you help ?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : MonoBehaviour {
public Transform firePoint;
public GameObject bulletPrefab;
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
//void Shoot ()
public void Shoot ()
{
Instantiate (bulletPrefab, firePoint.position, firePoint.rotation);
}
}