- Home /
Prefab Instancing
I'm trying to build a script that appends a volume(cube)once you enter the next volume and then destroys the volume that you've left. I'm somewhat new to Javascript so the more help I can get would be great!
So it would look something like: [X][P][ ][ ] Then the next iteration would be: [X][X][P][ ][ ]
X=destroyed prefab P=prefab that player is within [ ]=empty volumes
Answer by DaveA · Mar 22, 2012 at 09:44 PM
The volume would have a Box Collider on it, set to 'is trigger' and script would implement OnTriggerExit() which would call Destroy(gameObject);
Answer by xichael · Mar 22, 2012 at 10:44 PM
Ok, so it's building a gridlike structure, and the volumes can be appended in any direction except backwards, would I use vectors to define which direction the "rules" say that I can append certain volumes to certain volumes?
You should either ask a separate question, or edit your original question, or comment on an answer. Don't answer with another question, it looks like you're getting answered to the rest of us.
How you append them is up to you.
Ahh okay, this was my first "Question", I see how it works now.
Your answer
Follow this Question
Related Questions
Prefabs and variables 1 Answer
Unity fire1 prefab in code 2 Answers
How to access script variables attached to a prefab at runtime in Javascript? 2 Answers
Random Script Failure 1 Answer