I'm trying to recreate family fortunes (Feud in America) and I'm trying to make a spotlight that follows the mouse. The code for the spot to follow the mouse works fine but I'm having trouble changing the freeform light which is supposed to be the beam leading up to the spot. I found some code in the Unity documentation so i know its possible but i just can't get it to work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow : MonoBehaviour
{
public GameObject Spot;
public GameObject Beam;
public Vector3 screenPos;
public Vector3 worldPos;
public void SetShapePath(Vector2[] path)
{
new Vector2(-10, 0);
new Vector2(Spot.transform.position.x - 1, Spot.transform.position.y);
new Vector2(Spot.transform.position.x + 1, Spot.transform.position.y);
SetShapePath(path);
}
private void Update()
{
screenPos = Input.mousePosition;
worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Spot.transform.position = new Vector3(worldPos.x, worldPos.y, worldPos.z + 10);
}
}
The unity console is returning no errors so I struggle to see why it's not working, I'm assuming it's to do with I haven't assigned the Vector2's properly or the freeform light isn't using them. Some help would be appreciated, ideally before mid-December, thanks.
P.S The finished game will be uploaded to Itch when it's done.