- Home /
Area Unlocking
Hi All!
I am fairly new to the Unity 3D scene and I am currently attempting to limit the areas in which the player is allowed to go. This is so that when the player completes a mini-challenge, a new area of the map is available for them to go to. It is all part of the same terrain. Basically, I want the player to search the available terrain for an object, when they find it, lots of enemies will be spawned and will target the player. The next objective for the player is to reach the safe-zone to complete the level.
I am familiar with Application.LoadLevel("string") however, I do not want it to load another scene altogether, I just want it to be like some box colliders have been removed so the player can then walk where they once were.
What is the best technique in your opinion to achieve this?
Any help would be much appreciated.
Kind Regards
Melissa
Answer by Kag359six · Mar 29, 2012 at 08:28 PM
well, in terms of performance you might want to either make it a seperate scene, or use occlusion culling. But if you really want it to be in the same scene, you can simply remove the collider through scripting by using Destroy(object.GetComponent(BoxCollider)). Im not sure if that syntax is right with the box collider part, but its something like that.
Answer by Melissa_Goddard · Mar 29, 2012 at 08:38 PM
Thanks very much for the replies guys!
So if I'm right in what you're saying is to create an empty game object and assign a box collider to it or a piece of terrain perhaps with a gate, and when the object has been picked up, it is possible to access the Box collider and destroy it during game-play? If so that is excellent.
So for performance it is better to create lots of small scenes rather than larger scenes?
Kind Regards
Melissa
Please use the 'add new comment' button to comment on other answers. Use 'Answer' only if you are really answering your own question.
Yes you can access the box collider and destroy it but you might want to just disable it: http://unity3d.com/support/documentation/ScriptReference/Collider-enabled.html
Your answer

Follow this Question
Related Questions
physics.OverlapSphere colliders 1 Answer
Colliders, triggers and modelling a level 0 Answers
Level Creation, Prefabs and Colliders 2 Answers
Implementing Level ID 0 Answers