- Home /
Working Fine Then Get: No Cameras Rendering after destroying GameObjects
I'm very new Unity and can't seem to find a solution to my problem. Everything works as intended then after a few clicks (between 0 and 10) I get "Display One, No Cameras Rendering"
I am using the simple 1 x 1 3D cubes repeated and have loaded in the FPSController as a character to interact with the world.
I have the start of a very basic 3d voxel world.
Here is my code:
public var width = 128;
public var depth = 128;
public var heightScale = 20;
public var detailScale = 25.0f;
public var grassBlock : GameObject;
public var stoneBlock : GameObject;
public var snowBlock : GameObject;
function Start () {
var seed = Network.time * 10;
for(var z = 0; z < width; z++){
for(var x = 0; x < depth; x++){
var y = Mathf.PerlinNoise((x+seed)/detailScale, (z+seed)/detailScale) * heightScale;
var blockPos = new Vector3(x,y,z);
if(y > 15){
Instantiate(snowBlock, blockPos, Quaternion.identity);
} else if(y > 5){
Instantiate(grassBlock, blockPos, Quaternion.identity);
} else {
Instantiate(stoneBlock, blockPos, Quaternion.identity);
}
}
}
}
function Update () {
// On mouse click
if(Input.GetMouseButtonDown(0)){
var cam : Transform = Camera.main.transform;
var ray = new Ray(cam.position, cam.forward);
var hit : RaycastHit;
if(Physics.Raycast (ray, hit, 500))
Destroy(hit.collider.gameObject);
}
}
Answer by Piyush_Pandey · May 02, 2017 at 11:18 AM
"Display One, No Cameras Rendering" comes when there is not a single object which has a camera component attached to it in a scene {there should be atleast one whether in editor or play mode}.
You might be destroying objects along with the camera. Please check for that.
There is a Camera on the FPSController by default. It sometimes allows me to delete multiple blocks before I revive that error, I can't seem to figure it out.
Answer by Marceta · May 31, 2017 at 12:36 PM
Check my answer on unity forum: https://forum.unity3d.com/threads/no-camera-rendering-message-with-5-4-0p1.425533/#post-2967704
Your answer
Follow this Question
Related Questions
Problem With Raycasthit Angle 0 Answers
Playing particle on 1 instance of cloned prefab 0 Answers
Multiple hit detection with Raycasting? 2 Answers
Using Raycast Normal to match surface rotation to instantiated gameobject? EXAMPLE GIF Included 0 Answers
Physics.Raycast doesn't hit anything even though Debug.DrawRay works 1 Answer