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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Replace GameObject

Discussion in 'Scripting' started by nincs, Jun 12, 2016.

  1. nincs

    nincs

    Joined:
    Mar 25, 2015
    Posts:
    65
    Hi!

    I have two GameObject's, and I would like to replace one with the other with press a key!

    Anyone could help me?
    Thank you very much!
     
  2. alexeu

    alexeu

    Joined:
    Jan 24, 2016
    Posts:
    257
  3. nincs

    nincs

    Joined:
    Mar 25, 2015
    Posts:
    65
    Hi!

    Thank you, yes, something like this, but... with this script I can turn off the GameObject, but then I can't turn on. So it would be good, but I was wondering if there is a simpler solution when I push of a key once the 1st GameObject is activated, then when I press another key, the 1st GameObject is disappear, and the 2st is activting.

    Thank you!