Lukas
ERROR CS0111
Assets\Scrips\SelectionManager.cs(9,18): error CS0111: Type 'SelectionManager' already defines a member called 'Start' with the same parameter types
What am i doing wrong?
using UnityEngine;
public class SelectionManager : MonoBehaviour
{
public GameObject interaction_Info_UI;
Text interaction_text;
private void Start()
{
interaction_text = interaction_Info_UI.GetComponent<Text>();
}
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
var selectionTransform = hit.transform;
if (selectionTransform.GetComponent<InteractableObject>())
{
interaction_text.text = selectionTransform.GetComponent<InteractableObject>().GetItemName();
interaction_Info_UI.SetActive(true);
}
else
{
interaction_Info_UI.SetActive(false);
}
}
}
}
using UnityEngine;
public class SelectionManager : MonoBehaviour
{
public GameObject interaction_Info_UI;
Text interaction_text;
private void Start()
{
interaction_text = interaction_Info_UI.GetComponent<Text>();
}
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
var selectionTransform = hit.transform;
if (selectionTransform.GetComponent<InteractableObject>())
{
interaction_text.text = selectionTransform.GetComponent<InteractableObject>().GetItemName();
interaction_Info_UI.SetActive(true);
}
else
{
interaction_Info_UI.SetActive(false);
}
}
}
}
30 replies