- Home /
Spawn Script not working on iPhone?
So I have the script below. It works fine when i test it on my game, on my computer. But when I put it on an actual Iphone it stops spawning completely.
#pragma strict
//Attach to empty object, in front of barrel
var projectile : Rigidbody;
var speed = 20;
var fireRate = .5;
var mySound : AudioClip;
function React () {
InvokeRepeating("Fire",1,fireRate);
}
function Fire()
{
audio.PlayOneShot(mySound);
var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity =
transform.TransformDirection(transform.forward * speed);
Physics.IgnoreCollision( instantiatedProjectile. collider,
transform.root.collider );
Physics.IgnoreCollision(gameObject.FindWithTag("Whatever").transform.collider , this.collider);
}
script 2
this code triggers it.
#pragma strict
function OnCollisionEnter(col : Collision) {
if(col.gameObject.name == "Gun"){
gameObject.Find("SpawnPoint").SendMessage("React");
}
}
absolutely not enough information to find a problem. insert Debug.Log() to every point of code that can fail to working and see the log file. after that you should find a place where error raises and if you will still need an explain about error, ask here giving us more details
Or try the debugger. You can attach it to the iPhone game while it is running.
In build settings activate script debugging. When the project has started running: in $$anonymous$$onoDevelop do Attach To Process - the iPhone game should appear in the list of applications.
Sorry I replied to quickly - when you do Run > Attach To Process you get a list - it will include something starting with iphone.
In $$anonymous$$onoDevelop.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Does UNity iPHOne work 1.7 work with the new iPhone 4 os? 1 Answer
Facebook SDK and ADColony Compatible in iOS? 2 Answers
Make objects easier to select 1 Answer
Linking Native toolkit 1 Answer