Hello Friends, I was wondering if someone could help me with a script of a character that when is spawn starts moving and shooting inifintly and instanlty without any key inputs... I would really appreciate your effort. Thank you.
Code (CSharp): public Vector2 mySpeed; private RigidBody2D rb; private bool alive; void Awake () { rb = gameObject.AddComponent<RigidBody2D> () as RidigBody2D; rb.bodyType = RigidBodyType2D.Kinematic; } void Start () { alive = true; rb.velocity = mySpeed; ShootInfinitely (); } IEnumerator ShootInfinitely () { while (alive) { // put your shooting code in here } } void OnDestroy () { alive = false; }