Search Unity

How to change the variables via Get and set?

Discussion in 'Scripting' started by Givago, Jul 15, 2016.

  1. Givago

    Givago

    Joined:
    Oct 22, 2015
    Posts:
    27
    I'm trying to understand how do I change the get and set because I'm in trouble.

    First Script:
    and:

    I created the button and have I put the component.
    When I click on the object you're the first script it changes to true, but in another class nothing happens.
    Why? What should I do?
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    should probably start by looking at the console

    This line will be generating a warning for a start
    Code (csharp):
    1.  
    2. private BotaoIniciar construtorBotao = new BotaoIniciar();
    3.  
    you don't create components like that.

    c# is case sensitive
    Start
    not
    start

    can you expand on that, "another class"? as in another instance? (think something got lost in the translation here...)


    oh and http://forum.unity3d.com/threads/using-code-tags-properly.143875/ not quotations for code please :)
     
    Givago likes this.
  3. Givago

    Givago

    Joined:
    Oct 22, 2015
    Posts:
    27
    Sorry my quotations =s

    There are two different class, I just wanted access to the other var. Because the method OnMouseDown change the var, but, in other class the var not change.