Transform.Translate don't work on mobile Android
Hi guys, problem is so simple...I'm using the Standard Asset ThirdPersonController and I make it shoot bullets. I have a Transform child (FirePoint) used as bullet spawn point and able to keep forward well oriented. Bullet is a Prefab with a script attached that control few things, like setup local forward and translate. In Editor it works as intended (and expected)...good! On mobile bullet is instantiated BUT...don't translate, it remains on spawn point...SO NOICE! Any tips???? What's up????
[SerializeField] private int ammoDamage;
[SerializeField] private float ammoSpeed;
[SerializeField] private float lifetime;
private Shoot shootScript;
private Vector3 direction;
// Start is called before the first frame update
void Start()
{
Destroy(gameObject, lifetime);
shootScript = GameObject.FindGameObjectWithTag("Player").GetComponent<Shoot>();
direction = transform.InverseTransformDirection(shootScript.FirePoint.forward); // OK EDITOR
}
// Update is called once per frame
void Update()
{
transform.Translate(direction * ammoSpeed * Time.deltaTime, Space.Self);
}
Comment