Transform Object

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

You may throw away your Start method since it makes no sense because you don’t store the transform reference retrieved.

Next, you shoudl check if that Collider2D collision parameter actually is a collider of ball.For this, use simple test

if(ReferenceEquals(ball.gameObject, collision.gameObject))

And if check passed, you shoud completely reset ball rigid body by setting its velocity, angular velocity to zeroes and disable it. Then you may change ball transform position. After position has changed, next frame activate rigidbody back,