- Home /
Problem solved
Gameobject not showing: I can see only canvas
I can't see my gameObject (a sphere) in the Game View when I run the scene.
I can see it through my game camera, wich I tried to put on UI layer, but it didn't work.
I dragged the script on Canvasm Raw Image, Game Camera, everything, with no results.
The script that contains the sphere code is "Animazione". The other one is not important
Here i put the code for just one sphere:
void Start()
{
sphere1 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
}
//m.persone[0].frames[count].Joints[1] gets the coordinates >> it works, it's not the problem
//k1 and k2 are just some scaling constant of Vector3 type
void Update()
{
double x = m.persone[0].frames[count].Joints[1].x;
double y = m.persone[0].frames[count].Joints[1].y;
double z = m.persone[0].frames[count].Joints[1].z;
sphere1.transform.position = new Vector3((float)x * 100, -(float)y * 100, (float)z * 100)+k1;
sphere1.transform.localScale = k2;
}
For those who're co$$anonymous$$g here from Google -- the problem isn't with your Camera. The problem is that your Canvas has a setting for "Render $$anonymous$$ode". Click your canvas in the Hierarchy, then in the Inspector find Canvas > Render $$anonymous$$ode > "Screen Space - Camera". Then make sure to set the "Render Camera" parameter to your camera object.
Another possible reason is that your Build Settings include a Scene that is not intentional. Check to make sure that you only include the scenes you want.