|
im trying to get a gameobject to spawn using these 2 scripts (my trigger script) function Update () { //if(Input.GetKeyDown(t)) ToggleTrigger(); } and (my send message/spawn script) var sendToObject: GameObject; var correctObject: GameObject; //this is the only object we allow to trigger the event var targetFunction: String; // the name of the function to call var prefab: Transform; function OnTriggerEnter (object : Collider) { function OnTriggerExit (object : Collider) { my issue is that my game runs with no errors but my prefab is NOT spawned, ive checked http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html & http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs.html sections of unity for help and but to no real avail can any one help me?
(comments are locked)
|
|
The thing is, you don't have braces around that if. It should do the Instantiate-method regardless of what hits it. Are you sure your colliders are set correctly for the trigger events to happen?
(comments are locked)
|
|
I cannot see the targetFunction method anywhere. Try reading through this i have read you link, but i don't understand how it is relevant to my script. i'm not trying to create a damage system but to spawn an object once the player passes into the trigger, are you telling me i need to re-work this part of my script? if(object == correctObject.collider) }
Feb 07 '12 at 04:23 PM
Greatalastor
(comments are locked)
|
