- Home /
Scene Load Issues
So I realize this is a common question and have covered numerous posts trying to solve this myself. I have built several scenes and am attempting to get them linked together based off collisions with set objects. Regardless of how I try to change things around I cant get the object collision to load another scene.Below is my code.
var myLevel : String;
function OnCollisionEnter (myCollision : Collision) { if(myCollision.gameObject.name == "Warp"){ Application.LoadLevel(1); } }
I have made sure that the object is a ridgidbody non-kinematic
I have made sure that both my character and the object have colliders set with "is trigger"
Made sure that they are on the same layer.
Made sure that the scenes are included under Build Settings
Any help would be appreciated.
Is this behavior attached to your character?, since you're asking for an external collider with the name of "Warp". Be sure this behavior is attached to your character and not to your "Warp" object. Also (and just to be logical) be sure the collision game object name is actually "Warp".
Answer by silverdreamx · Nov 12, 2012 at 08:07 AM
I am not sure if this helps, but instead of doing string checks like
myCollision.gameObject.name == "Warp"
you should probably do it this way
myCollision.gameObject.name.CompareTo("Warp") == 0
Check out the documentation for more details. Hope this is useful!