unity-game-engine

Unity Type Mismatch For Prefabs


I have a couple of prefabs with some public variables but when I assign a component to one of them (by clicking at the circle on the right) it says type mismatch however, when I spawn the prefab and assign the component it works.

I tried changing the variable that didn't work by a game object and then use GetComponent to get the component but it said type mismatch again and it only accepted other prefabs.

By the way, the problem started happening when I changed the player's layer


Solution

  • as far I understand, I would suggest you:

    This should work. Lemme know if not works.