Unity2D: Prefab not working with animator - unity3d

I have a prefab that is instantiate in using my spawning script. I also have a game over panel that slide down (this is done by animation) once the player dies. The problem I'm having is that the needs to be game over panel attach to the prefab in the inspector window for the game over panel to work. This image explains everything. Please help

in Unity you can't assign scene objects to prefabs because prefabs must be usable within all your scenes, so if a scene object was assignable to a prefab then the prefab couldn't be used in another scene.

Related

When I load New Scene With SteamVR_LoadLevel All Controllers Freezing

Hey i am working on VR application with unity. I have got some scenes in my project. Everythings are fine first scenes. There is a level i am using a "Player" prefab and when i start a load new scene with SteamVR_LoadLevel .Begin function, next scene loading finely and my HMD running good but the controllers freeze. I am CameraRig in next scene and i destroy Player [SteamVR] gameobject before scene with checkbox (unchecked) inside of inspector.
I was try Unity SceneManagement, or other things but i can not find a solution. By the way if i run that scene directly, every controller working fine.
Waiting your answers thank you.
I can not find solution on this problem but i change my GameObjects. I think if you use Player prefab previous scene and if you use CameraRig inside next scene then controllers freezing. Because vr action setup not same (or broken) for CameraRig. When i realized this situation, i change my CameraRig object to Player prefab. If you accept, this is my solution.

How to add a Tilemap to a prefab?

I have a Bomb prefab that gets dinamically added to the center of a 2D tile on keypress via a BombSpawner script. When the bomb explodes, I want it to affect multiple tiles in my Ground tilemap.
The explosion is inside the BombController script which is part of my Bomb prefab. I tried accessing the tilemap by adding it manually to the prefab:
public Tilemap tilemap;
But it doesn't work. I can only drag and drop the tilemap to the Bomb when it's in the scene, not to the prefab.
Is there a way to access the Ground tilemap inside the BombController script?
So, This is what is normal in unity when you are working with prefabs. You can only assign components/scripts anywhere in prefab if that component/script is a part of the prefab itself.
If component/script is in your scene hierarchy but not in the prefab. In your case, it was Tilemap object. which was in your scene hierarchy but was not the part of your prefab. Even if you edit the prefab directly in the scene view(Don't get confused with prefab editor which looks as same as scene view). and save the prefab the BombController.tilemap will always be null(None). Something Like
have you tried importing this library from unity
using UnityEngine.Tilemaps;
and then do that variable
public Tilemap tilemap;
enter image description here

Unity, I can't make a Prefab out of a Tilemap

When I try to create a prefab this happens:
I select the tilemap
I create the prefab by dragging it down
I open the prefab and nothing works
There is no way to edit it through its tile palette editor and it has only a tile.
I see this also when I try to instantiate a tilemap (both from a prefab or an already ingame gameobject)
How can I fix?

Cant drag global gameObject into new unity nested prefab system

Im just starting to use the new Unity nested prefab workflow (or what ever you call it) in Unity 2018.3
So how it works is when you want to edit a prefab, you select it then click on the arrow. When you do this it erases everything from the hierarchy window and then you only have that prefab visible until your done editing it, you click save and then its back to the original hierarchy that was there before you started editing.
This is all fine, but the problem is what if i want to drag a game object from my scene into the prefab im editing is now impossible because as soon as you start editing the prefab, it removes your scene and only shows the contents of the prefab. So you cant drag anything from your scene into the prefab any more because its gone for the duration of the editing.
I dont know if im making myself clear or not.... But basically im saying while editing the prefab, only the contents of the prefab is visible, your scene is not visible, so you cant drag any object from your scene into the prefab anymore.
Anybody knows how to get around this? Right now i want to drag a gameObject from my scene into a prefab im editing to make a reference to a global object, but while editing the prefab my scene is not visible, so i cant do it.
Thank
Just create a copy of your prefab in Hierarchy and make you required changes to that copy once done, drag and drop that copy on you prefab and it will be updated.
When dropping the copy on your prefab you can either create a new prefab or update the original one.
Editing a prefab can be done in multiple ways. To achieve what you want, you should drag an instance of the prefab into your scene where your "other" gameobject is. Ensure that the prefab instance is blue, so that you know that it is still connected to the prefab.
Now, drag your "other" gameobject onto the prefab instance, so that it becomes a child of it. Now you should be able to apply prefab changes through the inspector.
Do note, if you cannot change the position in the hierarchy of the "other" gameobject onto a prefab from within the scene view. If you want to change the position, you should open the prefab scene after applying changes.

Can not see game objects after change their layer in reference prefab in Unity

I'm creating a 2d game using Unity and get the following problem. When I change the layer of some game object in its reference prefab, I can not see that game object in the scene window.
In Unity, cameras can view one or more layers simultaneously. If you have created a new layer, be sure that at least one of your cameras is set to render it. You may have placed your object on a layer which is not currently being rendered on any of your scene's cameras.
Maybe you have set some layers as invisible. You can check visible layers in a popup list "Layers" at top right corner of Unity Editor window.