I use C# scripting. And I need to assign to GameObjects script a different GameObject. Previously I did it just by dragging, but now I need it automatically be assigned. The problem is that I have like custom class “Skidmarks” and I get the following error - error CS0029: Cannot implicitly convert type UnityEngine.GameObject' to Skidmarks’
public Skidmarks skidmarks;
void Start() {
skidmarks = GameObject.FindGameObjectWithTag("Skidmarki");
}
A script as attached to a game object is called a Component. So you are attempting to get the ‘Skidmarks’ component from the game object with the name ‘Skidmarki’. Assuming you are certain the game object with the ‘Skidmarki’ tag exists you can do: