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

If / Else ?

Discussion in 'Getting Started' started by DoruKs1, Jun 26, 2015.

Thread Status:
Not open for further replies.
  1. DoruKs1

    DoruKs1

    Joined:
    Jan 14, 2015
    Posts:
    28
    Okay! I didn't get a sh*t from this new system. I DON'T EVEN KNOW HOW TO MAKE A IF ELSE STATEMENT TO PLAY A ANIMATION.
    Maybe it's my fault but please help.

    (I need a example statement)
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Please stop to unnecessarily highlight your text in any way if you don't have a good reason for it. It is very annoying to read. You can just type the question and indeed I won't answer your question or help just because of that.
     
  3. DoruKs1

    DoruKs1

    Joined:
    Jan 14, 2015
    Posts:
    28
    Sorry but I think I'll go mad. It's annoying. I don't know anything about it! Can you help?
     
  4. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    What does it even mean?
     
  5. Kaz_Yamof

    Kaz_Yamof

    Joined:
    Jan 17, 2013
    Posts:
    28
    Yes, I can.

    Watch this. Then you come back with a real/well explained question.
     
  6. DoruKs1

    DoruKs1

    Joined:
    Jan 14, 2015
    Posts:
    28
    Ok. So as you can see , door is a bool and it's on. I want to make code something like:
    Code (CSharp):
    1.  if(door = false)
    2. {
    3. animation.play("dooropen")
    4. } else
    5. {
    6. animation.play("doorclose")
    7. }
     

    Attached Files:

  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You'll have to learn C# first I think. It's clear you're not used to programming in C# yet as the above code assigns door to false within the if statement.

    I would also recommend playmaker asset if you would like to try a visual scripting solution.
     
    SimonDarksideJ likes this.
Thread Status:
Not open for further replies.