So I was creating an enemy boss for my game that will spawn enemies(minions) every X seconds and then I converted my enemy into an prefab and then selected it (didn’t drag it on the scene) and when I tried to assign the components it doesn’t work! It shows Type mismatch. If this is a unity thing then what do I do? How will I assign the components into my enemy prefab? It uses Animator, AudioSource Components which I need to assign. I couldn’t finish my project because of this. Quick Answers will be appreciated
Are you trying to assign scene objects to a non-scene prefab? References can’t be made in that direction.
Yes, what do I do now?
Don’t try to reference scene objects to a prefab. You probably need to rethink your approach, such as hooking up scene reference at runtime after the object is instantiated.
Damn. I didn’t get it “hooking up scene reference at runtime”? Im noob
Assets can only reference other assets, not objects in the scene.
If an object is spawning this prefab then you can assign the references there, and then pass them to the object after it’s spawned. I describe how to do this here.
If the prefab is placed in the scene already and you’re not spawning it, then you’ll need to assign the references as overrides to that instance that you’ve placed in the scene.