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

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.

Related

how can I make a player hidden by terrain always visible?

I am making a 3D isometric game, in my game, there is a lot of holes and the player can go into them, but the problem is when he goes into one of them he becomes invisible, I can,t move the camera it will change the concept I tried using shader like the one in this video but it makes the entire terrain transparent and glitchy (I am using unity terrain) so I am stuck and I need Idea how to make the layer visible inside the hole
What you're asking can be achieved in multiple ways, depending on your render pipeline and requirements.
If you're working with the Universal Render Pipeline (URP), you could create a Forward Renderer asset and create a custom render pass whenever your player is occluded by terrain.
You could assign a new Layer to the player, such as "Player", then select or deselect said mask from the Filters > Layer Mask properties of the Forward Render Data. Then assign the same or a custom material for when the player is occluded by terrain.
Alternatively, you could create either a cutout or a dither shader using Shader Graph, on which there are many tutorials
Camera GameObjects give you the option to select what layer you want them to "see" (render) using the culling mask. Think of layers as grouping GameObjects and giving that group a name.
You can have multiple cameras at the same time each one with a different name and different layer to render, or even change the viewing layer of a single camera depending on changes happening in the game.
Assign a layer tag in each of the terrain elements in your scene and have the camera render them accordingly and "cull" the rest.
Very helpful documentation on layers and camera culling mask.

Why do certain sprites ,look as if they're further back in the window?

I am learning how to make games using unity, i have used free sprite packs from unity's store.
i have selected each individual sprite and changed its z position to 0, but when the game runs it looks completely different to how it looks in the editing window.
please help.
Here is a video I recorded.
https://youtu.be/2hb9m01PQBk
Are your sprites on a prefab, or children of another game object? The Transform of the parent object affects the transform of all children.
It looks like this is a camera problem. Your camera is set to perspective, it is possible to do parallax backgrounds with a perspective camera and you may have already accomodated for it, but that is the first thing I would check.
You can modify this by going to your Main Camera and selecting Orthographic from the Projection drop-down menu.

Unity prefab clone is not visible in runtime

I have two prefabs which have sprite renderer,collider,rigidbody2D.
I instantiate 20 of their clone separately and transform in runtime. The clone are created in object panel still it in active state but not visible in both game and scene I need help.am a begginer
There could be many reasons for this
Object out of view:Your game object could be placed outside the view frustrum(not in view of the camera)
game Object inactive:May be some of the attributes are inactive thus the visual aspect of it is not visible try dragging the prefab on the screen outside debug mode
Out of canvas:May be you have a UI element outside the canvas
there may be soo many reasons for it if you could put some screenshots or something to help us with your problem may be we can pin point it

Clickable and Rotatable models using Unity and ARToolkit

Can the 3D models used with the markers be made clickable and rotate able using Unity3D engine and ARToolkit unity. Basically in the AR desktop application we are making , we want to implement this functionality on the 3D models as well. Kindly need help in this matter. ThankYou.
The only issue you could find is that the Transformation of the AR Tracked Object changes based on the visual information.
If you simply use that as a base object and put any other models as children of that one, you can modify their position and rotation in the same way you would do for any other situation.
So, as you see, the Marker scene has nothing but an AR Tracked Object, this is the object that will be updated with the pose of the marker.
Then, the Cube is a child of this object. If you modify the localPosition or localRotation of the cube it will work as you want it.
The Cube is a child of the Marker scene, its global position and rotation will be a combination of the position and rotation of its parent with its local position and rotation (this is standard 3DEngine / SceneGraph behaviour).

can't interact (in game view) with objects displayed by secondary camera - Unity

I have two cameras that occupy different spaces in the Game view. The problem is that I can interact with my object shown by the main camera, but when I move this object (in scene view) to make it appear in the visual field of the second camera, the object is displayed in Game view but I can't interact with it (the object is a scroll Rect btw) through Game view. Seems to have a very simple solution but I couldn't find it.
Here are the parameters of both cameras:
Main Camera:
Pretty sure you can only interact with the current MainCamera in Unity.
If you could explain what you're trying to achieve with 2 cameras maybe we can help you find a better solution.