Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Object deleting, dont know why

Discussion in 'Scripting' started by ChuckieGreen, Feb 13, 2018.

  1. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    358
    Hi, so for some reason when my player touches a certain object with a collider2d the object gets deleted but I am 100% sure there is nothing in any scripts telling this to happen. Is there some way I can see what is causing this, console is not working obviously because i havent told it to print anything (considering i dont know why its deleting) is there some other way to see the cause of this deletion.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    When you say deleted, is it just disappearing from the screen or have you verified that it has disappeared from the hierarchy view as well?
     
  3. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    358
    It's being deleted from the screen and hierarchy
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd search for any Destroy calls. You're not going to see any logging for objects being destroyed unless you added the logging. I'd also start adding debug.log calls to try to figure out exactly when the object gets destroyed.
     
  5. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    358
    If i select everything in the hierarchy apart from player and the object that is getting deleted and make it not active (the small click box, think its called non active) that should stop all those objects from working, correct? ie- it should not have an affect on the player and object
     
  6. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    358
    OK so i searched for all destroy calls, nothing turned up useful. but then i found out i has to do with a collision box on my player, but the weird thing is, i deactivated everything in the hierarchy apart from player and the object. I also deactivated all the scripts on the player and the object and yet it is still getting deleted. :confused::mad:
     
  7. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    358
    ..........RigidBody :mad: so many hours wasted.

    Anyways, answer : the object never had a rigidbody