Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Téléporter un objet

Discussion in '2D' started by DeadCraft, Sep 15, 2020.

  1. DeadCraft

    DeadCraft

    Joined:
    Sep 15, 2020
    Posts:
    1
    Bonjour j'aimerais essayer de téléporter une sorte de pièce a des endroits (que j'ai donné) mais aléatoirement que le sens change a chaque fois que le joueur récupère la pièce. Mais je n'arrive pas a écrire le script si quelqu'un peut m'aider :D Merci !!
     
  2. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,343
    So this is what i got from Google Translate:
    "Hello I would like to try to teleport some kind of room to places (which I gave) but randomly the meaning changes each time the player picks up the part. But I can't write the script if someone can help me: D Thanks !!"

    From what I am understanding, you want to teleport the player (or a room?) to different locations, but have it randomly choose each time which area they get teleported to.

    Check out this video for basic teleportation:


    Or this one if you want it to switch scenes:


    As for the random part, you are going to want to use Random.Range to pick a number. Each number will correspond to each teleport location. Well, it relate to the Index of the Array you set up the teleport locations.
     
  3. JTAGames

    JTAGames

    Joined:
    Mar 7, 2019
    Posts:
    13


    C'est un bon début.