prefab instancing-works in editor not working on build

hello,
we are having hard time with a weird problem. we are instancing some objects on some objects.transforms.

when we test it in editor it works well but after the build nothing gets instanced nor we can`t see the prefabs anywhere.

i have made the simplest scene with this script below and it still not showing in the build.

var cube : Transform;
function Start () {
    for (var y = 0; y < 5; y++) {
        for (var x = 0; x < 5; x++) {
            var cube = Instantiate(cube, Vector3 (x, y, 0), Quaternion.identity);
        }
    }
} 

// simple copy paste from documentation

no errors in the log, and no problems with the prefabs as i have tested.

any help would be appreciated.

This may not be the problem, but try taking out the var cube =. That cube variable may be getting confused with the cube variable you declared at the top of your program. Just something to try if you haven’t already.

thanks for the fast reply. i have tried it now but it is still not working only in the build.

Hi, i have kind of the same problem, Im following the FPS tutorial so I created a prefab sphere and asigned it as projectil in the inspector. (i want to shoot spheres)

I Used this code:

var projectile : Rigidbody;
var speed = 20;

function Update()
	{
	if( Input.GetButtonDown( "Fire1" ) )
		{
		var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation );

		instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );

		Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider );
		}
	}

(It is the code from the tutorial)

And created a launcher and assigned it the code, so i can child the launcher to the camera…

It works perfect on Unity and doesn´t give any errors in the console…

But when i make the build either on pc or web it doesnt creates the instances… ¿?

any help please

Now i´ve made an even more simple code for testing this in a new scene and still getting the same error:

Just created a cilinder, made it a prefab, gave it some physics, asigned this small script.

My Code:

var cilindro : Rigidbody;

function Update () {
	if (Input.GetKey("f"))
		{
		var InstanciaCilindro = Instantiate (cilindro);
		}

}

Working on editor, not working on build…

HELP!!!

I’ve just tested something similar with Plane and cube objects and it appears to work fine with that as a prefab. I am doing this in OSX so this may be a windows only issue. I’ll do some more testing and see if I can narrow it down to other objects too

What happens if you declare the object to instantiate as a game object instead of a rigidbody?

var cilindro : GameObject;

function Update () {
   if (Input.GetKey("f"))
      {
      var InstanciaCilindro = Instantiate (cilindro);
      }

}

Still not working, I just created a Cube and give it some phisycs to make it fall, everytime y press f on Unity it blows if i do it outside It doesn´t… :frowning:

Thanx Joe but still needing help