- Home /
instantiated objects are invisible although 2 meters big.
opening up an old project from 3.4
have 36 cubes instantiated visible in hierarchy.
cannot see any of the cubes!!! in mesh, game, scene view etc, although when i click on them it zooms to their position, but when i resize them and move them, they are still invisible.
Camera layer is set to defaut, distance is 0.2 to 1000 meters.
the cubes are 2 3 meters wide and even when 10 meters i cant see them.
if i drag the prefab straigh to heirarchy i can see it, but instantiate script doesnt see them.
shader is diffuse, box for the object is showing a nice colored material.
I just loaded another old game and converted it to 3.55, its a plane that shoots balls, the balls explode the bricks and the bricks bounce everywhere, but the balls are invisible!!! although they have physic and mesh, i dont see them any more.
here is the code
var speed = 15.0;
var rotspd = 10.0;
var bullitPrefab : Transform;
function Update ()
{
if ( Input.GetKey("mouse 1") )
{
constantForce.relativeForce = 15000 * Vector3.forward;
}
else
{
constantForce.relativeForce = Vector3.zero;
}
if(Input.GetButton("forwards"))
{
transform.eulerAngles.x += rotspd * Time.deltaTime * 7;
}
if(Input.GetButton("backwards"))
{
transform.eulerAngles.x += -rotspd * Time.deltaTime * 7;
}
if(Input.GetButton("left"))
{
transform.eulerAngles.y += -rotspd * Time.deltaTime * 7;
}
if(Input.GetButton("right"))
{
transform.eulerAngles.y += rotspd * Time.deltaTime * 7;
}
if(Input.GetButton("Fire1"))
{
var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint").transform.position, Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward *8000);
}
}
it's the standard Component>create other>cube etc mesh. Here is a screenshot, the spaceship has just fired 100 fireballs and the cubes are blowing all over but the fireballs are invisible. forgot to scroll down the texture view in inspector, although it shows up as a nice texture, and both programs worked fine in unity 3.4
Answer by Trithilon · Sep 05, 2012 at 08:41 PM
Are you sure the Mesh Renderer component Exists or is enabled? Are you sure your Camera is not INSIDE the meshes? If you have imported the meshes from a 3D Modelling package as .obj - the scale is awfully huge. You might have to scale them to VERY tiny levels... like 0.1 or even 0.01 types to be able to see them. Try reimporting the cubes/assets as FBX and see if this problem persists.
If all you want is a cube, Maybe you could try GameObject.CreatePrimitive(PrimitiveType.Cube);
If all fails.. post the code here.
thanks for the advice, its the standard unity cube as a prefab, in win7, updated u3.5, opened 2 projects they both instantiate invisible unity cubes now, were ok on winxp 10 months ago.
Change your Flame Shader to diffuse and see if it works. $$anonymous$$aybe you changed the shader's colour Alpha and made it invisible. (I see that you have a Particle Additive shader which responds to Alpha transperancy) For all I know, unity may not have compiled the older shaders correctly while upgrading the project. $$anonymous$$aybe try a new fresh material for the same.
From the screen shot it appears that there is a a $$anonymous$$eshFilter and a Skinned $$anonymous$$esh Renderer. That would be odd - either there should be a Skinned $$anonymous$$esh Render with a mesh and a bone or two, or a $$anonymous$$esh Filter and a $$anonymous$$esh Renderer.
Your answer
Follow this Question
Related Questions
Renderer on object disabled after level reload 1 Answer
Instantiate problem android 1 Answer
Instantiated models aren't visible. 1 Answer