2 replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
source | link

You say 'I am able to see the texture in the editor' - you do not say 'in the editor, I can see the texture when I run the game'.

While it is difficult to diagnose the exact problem, based off your provided description, it is important to remember that in a build, we will only see our game as it appears in the game view. In contrast, there are many situations where an element would be visible to the editor view, but not visible to the game view.


Ensuring the texture is visible to the game view ensures that the texture should be visible in a build. If you can not see it in the game build, this could help further diagnose the problem. This seems to be confirmed, through comments.

Its a the problem with my camera view – user1509674user1509674 Oct 7 '16 at 10:40


There are a couple of ways in which a camera may be set up to limit the display of the texture.

Position

If an object is not within your camera's field of view, it will not be rendered to the screen. It should be obvious that the texture needs to be in front of the camera, but there are other variables that effect whether the texture will be rendered, based off it's position relative to the camera.

  • Clipping plane: The camera's clipping plane determines both the closest and furthest distances to which the camera will render. Anything before the local Near distance or after the local Far distance does not get rendered by the camera. The camera has a gizmo to let you drag these distances in and out, via the inspector. It should be noted that a negative Near distance will allow you to include objects behind the camera, if this should ever be useful.

"As an example, if the camera is at position (0, 0, -10), and looks at an object at position (0, 0, 0), it will need a Far greater than 10 and a Near less than 10; as the object is 10 units away.

  • Size / Field of View: An orthographic camera will have a size, while a perspective camera will have a field of view. These values effectively do the same thing; they determine the size of the camera's view. In the case of perspective cameras, the camera's view becomes an angle; the further away you get, the wider the view. As such, the closer an object gets to the camera, the closer it needs to be to the cameras center view for it to be rendered.

A perspective camera views outwards at an angle. This has an effect on the display of objects.

Texture Rotation

It is important to note the rotation of the object containing your texture. Ideally, you want your texture to be facing the camera. Since a texture is 2D, it does not have a Z depth; if you face it away from the camera, at a 90 degree angle, it simply will not be visible.

The texture shrinks as the facing angle reaches 90 degrees, and eventually disappears.

Culling Mask

Lastly, it is possible that the camera is being told to cull the layer containing the texture. There are many reasons you may want to actually do this, but it is important to remember that a culled layer will not be rendered to that camera. Under the SpriteRenderer attached to your texture object, you will find a Sorting Layer. Ensure that this value is checked, on the camera, under CullingMask. Alternatively, ensure that the camera has it's CullingMask set to Everything.

Make sure that the camera has the same layer checked as the SpriteRenderer's Sorting Layer. Alternativley, ensure the camera has "Everything" checked. By default, a texture will use a Sorting Layer of "Default".

You say 'I am able to see the texture in the editor' - you do not say 'in the editor, I can see the texture when I run the game'.

While it is difficult to diagnose the exact problem, based off your provided description, it is important to remember that in a build, we will only see our game as it appears in the game view. In contrast, there are many situations where an element would be visible to the editor view, but not visible to the game view.


Ensuring the texture is visible to the game view ensures that the texture should be visible in a build. If you can not see it in the game build, this could help further diagnose the problem. This seems to be confirmed, through comments.

Its a the problem with my camera view – user1509674 Oct 7 '16 at 10:40


There are a couple of ways in which a camera may be set up to limit the display of the texture.

Position

If an object is not within your camera's field of view, it will not be rendered to the screen. It should be obvious that the texture needs to be in front of the camera, but there are other variables that effect whether the texture will be rendered, based off it's position relative to the camera.

  • Clipping plane: The camera's clipping plane determines both the closest and furthest distances to which the camera will render. Anything before the local Near distance or after the local Far distance does not get rendered by the camera. The camera has a gizmo to let you drag these distances in and out, via the inspector. It should be noted that a negative Near distance will allow you to include objects behind the camera, if this should ever be useful.

"As an example, if the camera is at position (0, 0, -10), and looks at an object at position (0, 0, 0), it will need a Far greater than 10 and a Near less than 10; as the object is 10 units away.

  • Size / Field of View: An orthographic camera will have a size, while a perspective camera will have a field of view. These values effectively do the same thing; they determine the size of the camera's view. In the case of perspective cameras, the camera's view becomes an angle; the further away you get, the wider the view. As such, the closer an object gets to the camera, the closer it needs to be to the cameras center view for it to be rendered.

A perspective camera views outwards at an angle. This has an effect on the display of objects.

Texture Rotation

It is important to note the rotation of the object containing your texture. Ideally, you want your texture to be facing the camera. Since a texture is 2D, it does not have a Z depth; if you face it away from the camera, at a 90 degree angle, it simply will not be visible.

The texture shrinks as the facing angle reaches 90 degrees, and eventually disappears.

Culling Mask

Lastly, it is possible that the camera is being told to cull the layer containing the texture. There are many reasons you may want to actually do this, but it is important to remember that a culled layer will not be rendered to that camera. Under the SpriteRenderer attached to your texture object, you will find a Sorting Layer. Ensure that this value is checked, on the camera, under CullingMask. Alternatively, ensure that the camera has it's CullingMask set to Everything.

Make sure that the camera has the same layer checked as the SpriteRenderer's Sorting Layer. Alternativley, ensure the camera has "Everything" checked. By default, a texture will use a Sorting Layer of "Default".

You say 'I am able to see the texture in the editor' - you do not say 'in the editor, I can see the texture when I run the game'.

While it is difficult to diagnose the exact problem, based off your provided description, it is important to remember that in a build, we will only see our game as it appears in the game view. In contrast, there are many situations where an element would be visible to the editor view, but not visible to the game view.


Ensuring the texture is visible to the game view ensures that the texture should be visible in a build. If you can not see it in the game build, this could help further diagnose the problem. This seems to be confirmed, through comments.

Its a the problem with my camera view – user1509674 Oct 7 '16 at 10:40


There are a couple of ways in which a camera may be set up to limit the display of the texture.

Position

If an object is not within your camera's field of view, it will not be rendered to the screen. It should be obvious that the texture needs to be in front of the camera, but there are other variables that effect whether the texture will be rendered, based off it's position relative to the camera.

  • Clipping plane: The camera's clipping plane determines both the closest and furthest distances to which the camera will render. Anything before the local Near distance or after the local Far distance does not get rendered by the camera. The camera has a gizmo to let you drag these distances in and out, via the inspector. It should be noted that a negative Near distance will allow you to include objects behind the camera, if this should ever be useful.

"As an example, if the camera is at position (0, 0, -10), and looks at an object at position (0, 0, 0), it will need a Far greater than 10 and a Near less than 10; as the object is 10 units away.

  • Size / Field of View: An orthographic camera will have a size, while a perspective camera will have a field of view. These values effectively do the same thing; they determine the size of the camera's view. In the case of perspective cameras, the camera's view becomes an angle; the further away you get, the wider the view. As such, the closer an object gets to the camera, the closer it needs to be to the cameras center view for it to be rendered.

A perspective camera views outwards at an angle. This has an effect on the display of objects.

Texture Rotation

It is important to note the rotation of the object containing your texture. Ideally, you want your texture to be facing the camera. Since a texture is 2D, it does not have a Z depth; if you face it away from the camera, at a 90 degree angle, it simply will not be visible.

The texture shrinks as the facing angle reaches 90 degrees, and eventually disappears.

Culling Mask

Lastly, it is possible that the camera is being told to cull the layer containing the texture. There are many reasons you may want to actually do this, but it is important to remember that a culled layer will not be rendered to that camera. Under the SpriteRenderer attached to your texture object, you will find a Sorting Layer. Ensure that this value is checked, on the camera, under CullingMask. Alternatively, ensure that the camera has it's CullingMask set to Everything.

Make sure that the camera has the same layer checked as the SpriteRenderer's Sorting Layer. Alternativley, ensure the camera has "Everything" checked. By default, a texture will use a Sorting Layer of "Default".

1
source | link

You say 'I am able to see the texture in the editor' - you do not say 'in the editor, I can see the texture when I run the game'.

While it is difficult to diagnose the exact problem, based off your provided description, it is important to remember that in a build, we will only see our game as it appears in the game view. In contrast, there are many situations where an element would be visible to the editor view, but not visible to the game view.


Ensuring the texture is visible to the game view ensures that the texture should be visible in a build. If you can not see it in the game build, this could help further diagnose the problem. This seems to be confirmed, through comments.

Its a the problem with my camera view – user1509674 Oct 7 '16 at 10:40


There are a couple of ways in which a camera may be set up to limit the display of the texture.

Position

If an object is not within your camera's field of view, it will not be rendered to the screen. It should be obvious that the texture needs to be in front of the camera, but there are other variables that effect whether the texture will be rendered, based off it's position relative to the camera.

  • Clipping plane: The camera's clipping plane determines both the closest and furthest distances to which the camera will render. Anything before the local Near distance or after the local Far distance does not get rendered by the camera. The camera has a gizmo to let you drag these distances in and out, via the inspector. It should be noted that a negative Near distance will allow you to include objects behind the camera, if this should ever be useful.

"As an example, if the camera is at position (0, 0, -10), and looks at an object at position (0, 0, 0), it will need a Far greater than 10 and a Near less than 10; as the object is 10 units away.

  • Size / Field of View: An orthographic camera will have a size, while a perspective camera will have a field of view. These values effectively do the same thing; they determine the size of the camera's view. In the case of perspective cameras, the camera's view becomes an angle; the further away you get, the wider the view. As such, the closer an object gets to the camera, the closer it needs to be to the cameras center view for it to be rendered.

A perspective camera views outwards at an angle. This has an effect on the display of objects.

Texture Rotation

It is important to note the rotation of the object containing your texture. Ideally, you want your texture to be facing the camera. Since a texture is 2D, it does not have a Z depth; if you face it away from the camera, at a 90 degree angle, it simply will not be visible.

The texture shrinks as the facing angle reaches 90 degrees, and eventually disappears.

Culling Mask

Lastly, it is possible that the camera is being told to cull the layer containing the texture. There are many reasons you may want to actually do this, but it is important to remember that a culled layer will not be rendered to that camera. Under the SpriteRenderer attached to your texture object, you will find a Sorting Layer. Ensure that this value is checked, on the camera, under CullingMask. Alternatively, ensure that the camera has it's CullingMask set to Everything.

Make sure that the camera has the same layer checked as the SpriteRenderer's Sorting Layer. Alternativley, ensure the camera has "Everything" checked. By default, a texture will use a Sorting Layer of "Default".