It sort of works but apparently im missing a ";", which isn't the problem.
My Code: \/\/\/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInteract : MonoBehaviour
{
private Camera cam;
[SerializeField]
private float distance = 3f;
// Start is called before the first frame update
void Start()
{
*cam = Main Camera;* <<< // Help //
}
// Update is called once per frame
void Update()
{
// Create a ray at the center of the camera, shooting outwards.
Ray ray = new Ray(cam.transform.position, cam.transform.forward);
Debug.DrawRay(ray.origin, ray.direction * distance);
}
}
↧