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

Level loading

Discussion in 'Scripting' started by Nightshade1, Apr 6, 2011.

  1. Nightshade1

    Nightshade1

    Joined:
    Feb 6, 2011
    Posts:
    95
    ok heres is what i want to do when i am within 2 meters of the block load level 2 can any 1 do that


    Visit my site
    tpantsnproductionst.tk
     
  2. Satoh

    Satoh

    Joined:
    Feb 17, 2011
    Posts:
    56
    create a sphere collider set as a trigger, and make it the size of your block+4 meters (half the size of the cube, +2 = radius of the collider). On collision, load the next level.
     
  3. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    236
  4. Nightshade1

    Nightshade1

    Joined:
    Feb 6, 2011
    Posts:
    95
    Ok well what avo game me i have no idea what its saying and satoh has collision (my player floats) so still need help
     
  5. BobC

    BobC

    Joined:
    Mar 8, 2011
    Posts:
    7
    If you have no idea what the OFFICIAL API documentation is saying, then you clearly need to brush up on your C#/Javascript/Boo. Quite simply, between what Satoh and Avo gave you, you should have exactly what you need.

    I would personally recommend using the Application.LoadLevelAsync() function, though.

    Also, if you checked the box "isTrigger" for the Sphere collider, then your character should not even be floating as the physics engine would not register the collider as a collider, but instead a trigger which you call in your character's script by calling OnTriggerEnter() functions.
     
  6. popmog78

    popmog78

    Joined:
    Jan 19, 2011
    Posts:
    154
    Try the Application.LoadLevel();
    Also, you can use function OnCollisionEnter(collision : Collision)
    {
    Make sure you put the gameObject.tag with the object that you are going to be colliding with.
    Application.LoadLevel();
    }
     
  7. pat_sommer

    pat_sommer

    Joined:
    Jun 28, 2010
    Posts:
    586
    not sure on your coding ATM, but there was a mistake in the beginning, he said to make the collider a trigger, but yet said to use the OnCollisionEnter, when it should be OnTriggerEnter

    so if you have it checked as a trigger, use on trigger,

    also it may have to have a rigidbody attached to it in order to pick up the physics
     
  8. Nightshade1

    Nightshade1

    Joined:
    Feb 6, 2011
    Posts:
    95
    ok i think i get it
     
  9. Nightshade1

    Nightshade1

    Joined:
    Feb 6, 2011
    Posts:
    95
    thank you all i had this toulbe for over 1 month