Getting this error while working through a tutorial, new to programming, could use some help. Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Paddle : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
public void Init(bool isRightPaddle) {
Vector2 pos = Vector2.zero;
if (isRightPaddle)
{
// Place paddle on the right of screen
pos = new Vector2(gameManager.topRight.x, 0);
}
else
{
// Place paddle on the left of screen
pos = new Vector2(gameManager.bottomLeft.x, 0);
}
//update this paddleâs position
transform.position = pos;
}
{
}
}
// Update is called once per frame
void Update()
{
}
}
Second Script;
also having issues with the âInitâ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gameManager : MonoBehaviour
{
public ball ball;
public Paddle paddle;
public static Vector2 bottomLeft;
public static Vector2 topRight;
// Start is called before the first frame update
void Start()
{ // convert screenâs pixel coordinate into games coordinate
bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
topRight = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));
// Create Ball
Instantiate(ball);
// Create 2 paddles
Paddle paddleLeft = Instantiate(paddle) as Paddle;
Paddle paddleRight = Instantiate(paddle) as Paddle;
paddleLeft.Init(True);
paddleRight.Init(True);
}
// Update is called once per frame
void Update()
{
}
}