I'm trying to make a 2d platformed. In it the player can shoot a projectile. I've been following a tutorial where they make it so the bullet makes a clone of itself. I want it so the bullet can teleport to the player and move (so that only 1 can be on screen at a time.) But he has it so the bullet clones itself instead. I THINK the problem is in line 15, but I'm not sure what to do. Any help would be great!
here's the video for context
Add comment
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttack : MonoBehaviour
{
public Transform firePosition;
public GameObject projectile;
// Update is called once per frame
void Update()
{
if (Input.GetButton("Fire1"))
{
Instantiate(projectile, firePosition.position, firePosition.rotation);
}
}
}
here's the video for context
Add comment
Last edited by a moderator: