|
I have a few pickups in a game of mine that...disappear. I have them set up in the scene, and you can see them in the game right away. They disappear (almost) immediately, though, and are removed from the hierarchy in the middle of game play. The two pickups have separate scripts: Script 1: Script 2: Edit: changed name of collision.
(comments are locked)
|
The question has been closed Jun 11 '12 at 11:19 PM by You! for the following reason:
Problem resolved without definite reason.
|
[WRONG : The objects are removed from the hierarchy] The way you handle the collision is a little confusing, what is MainM ? Anyway, your pickups are probably going through the ground. By modifying the position.y, you're only modifying the matrix, not the physic, so it won't collide with the ground. Use a rigidbody, the gravity is applied by default. [/WRONG] Ok, second shot : use prints before or after the Destroy. My guess is there is a collision at the start, you need to figure out why and with what. If it still wrong, I'll move my answer to the comments so you can be unanswered. ...The objects are removed in the hierarchy... Also, I now see the many misspellings in my question. My internet connection was slowing to a stop... I was lucky to get the question submitted... I'll fix any errors. Edit: "MainM" is the name of the main character in the game. I don't have a specific reason why I named the one collision after that character...
Jun 11 '12 at 07:20 PM
You!
Oupsi right, I forgot that part. I changed my answer.
Jun 11 '12 at 07:23 PM
Berenger
The prints do not show...so the destroy function within the script isn't causing it. I also removed the gravity portion of the script and will use a rigidbody (since I need it for collisions anyway). Edit: I found only two other scripts with a Destroy function, with both referencing the objects they are attached to. These scripts are not attached to the objects that are being referenced in this question...
Jun 11 '12 at 07:33 PM
You!
(comments are locked)
|
