i m new at unity and just wanted to make a simple 2d game , and got stuck at scripting problems …
i have ball and car that car hit ball and get Goal when enter Net after that i want to Reset the ball at the same position the game started
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goal: MonoBehaviour
{
BallControl ball;
void Start()
{
ball.GetComponent<Transform>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
ball.transform.position = new Vector2(2.01f, 0.4f);
Debug.Log("GOAL");
}
}
and script for Ball is empty