Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

HELP QUICK! Destroy Panel!

Discussion in 'Scripting' started by kyle_zambo, May 21, 2019.

  1. kyle_zambo

    kyle_zambo

    Joined:
    May 19, 2019
    Posts:
    2
    QUICK RESPONSES! So I am making a small game and I want to have it so it's like a story based game where your actions are affected by what you do. I have a problem though because whenever I want to go to scene 3 from scene 2 and back to scene 2, it reloads my dialog panel. Another problem is that it doesn't load the character in the next scene sometimes. I copy pasted my character over to the next scene but it just doesn't work. Help me please!

    a6383b40815199840ecb2e5e832764b4.gif

    This is my code for the panel screen
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Choice : MonoBehaviour
    6. {
    7.     [SerializeField] private GameObject choiceMenu;
    8.     [SerializeField] private int choice;
    9.     [SerializeField] private bool trigger;
    10.  
    11.     private void Update()
    12.     {
    13.         if (!trigger && choice != 3)
    14.         {
    15.             Destroy(choiceMenu);
    16.         }
    17.  
    18.         if(choice == 0 || choice == 1)
    19.         {
    20.             Time.timeScale = 1;
    21.         }
    22.         else
    23.         {
    24.             Time.timeScale = 0;
    25.         }
    26.     }
    27.  
    28.     public void left()
    29.     {
    30.         Destroy(choiceMenu);
    31.         choice = 0;
    32.         trigger = false;
    33.     }
    34.  
    35.     public void right()
    36.     {
    37.         Destroy(choiceMenu);
    38.         choice = 1;
    39.         trigger = false;
    40.     }
    41. }
    42.  
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    506
    So how's that QUICK! coming along? I'm not sure people respond well to "encouragements" like that.

    Pro tip: if you want someone to look at the code that's not working, perhaps include the code that is not working. I don't see any scene-changing code. All I see is some modeately abysmal menu response code.
     
    Joe-Censored likes this.
  3. kyle_zambo

    kyle_zambo

    Joined:
    May 19, 2019
    Posts:
    2
    It's fine now, I updated Unity and it deleted all my game files so I'm not working on it anymore..
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,717
    Out of curiosity, why did you need the help "quick", as opposed to the normal/average response time on the forums? Were you writing this for a homework assignment due in a few hours? Were you at a 24-hour game jam?
     
    Joe-Censored likes this.
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    5,518
    Unity doesn't delete project contents on version update.