the following code does not execute at all, its attached to the player control module (custom fps controller)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SelectionManager : MonoBehaviour
{
[SerializeField] private Material HighlightMaterial;
void Start()
{
}
private void Update()
{
var ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2f, Screen.height / 2f));
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 6f))
{
var selection = hit.transform;
var selectionRenderer = selection.GetComponent();
if (selectionRenderer != null)
{
selectionRenderer.material = HighlightMaterial;
}
}
}
}