- Home /
How to Destroy Copies made during levelload?
Got another Noob Brain crusher here.
My end goal: Have trigger collide load new level and assign a previous level int to player (working) Have the player spawn in an according position based on that int (working)
I dont want to destroy my player on level load, so I have this script attached to my player
function Awake(){
DontDestroyOnLoad (this);
}
My problem is as I had already expected. When I return to a previously played scene. I have my non destroyed player (at appropriate location), and a player that spawns in where I originally started.
How do I go about destroying the unwanted player? Any help would be appreciated.
I Notice if I go to the newscene, back to the original.. there are 2 players.. but if I navigate both of them together back again to the second scene only two are there there is no 3rd player in the scene.. $$anonymous$$y thoughts.. If I do a menu scene or player select scene then when I start the game everything will be alright.. Let me see if this is a solution.. Sorry for posting b4 thinking.. still any suggestions would be boss!! Peace
Answer by OperationDogBird · Aug 21, 2012 at 10:19 PM
You should have a variable for the new position already, so instead of spawning a new player, just move the one you already have to that position.
Answer by Panik.Studios · Aug 22, 2012 at 12:55 AM
Yep that's the way I have it.. I just made a menu with he player and so the duplicate player is left at the menu. It's the best temporary fix I can think of.
add comments under the answers you want to respond to: don't make an answer to comment on another answer.
Well, my comment also has the answer in it So you should upvote to fix my $$anonymous$$arma. Down Voting is for when people post something that is either completely misleading or irrelevant.. I assumed people would see that reasoning when I switched that which was originally a comment to an answer. I didn't want to post several times to cut the moderators some slack since it was late and only one person was around. I accepted ODBs answer only cause he lead me to the realization of putting a character in a menu.. It's still an open ended question though.. because I dont want to have my character in the menu. Still it is an answer and the answer is obviously correct because I asked the question originally and found this to work (as a temporary solution). Which in my opinion gives you no right to up or down vote to begin with, and even if I did post an answer by mistake that was intended to be a comment.. It's not a reason to punish me.. You gotta not abuse your powers otherwise the $$anonymous$$arma system is no better then letting trolls post whatever they want.. I'm here being serious and I expect others to be also.. I want to roll up a newspaper and bonk you on the nose with it right now.. "Bad $$anonymous$$att Downey".
Not to mention the fact that this is Q&A and my question was not, when should I post a comment as opposed to an answer.. You were here just trying to cause problems not answer my question which already had an answer.. That's like trolling man. Or trolling for reasons to troll. Gotta behave!