I want to change the int “select” in the funktions chosemap with buttons.
that works and the debug works correctly.
But when I press space the int I had firts allways gets debbugged instead of the updated int(selected).
example:
I press button 1, the chosemap 1 runs . i Get a debug saying “1”.
Then I press space and 1 is debugd. all correct.
Then i press 2 and the chosemap 2 runs. I get a debug saying “2”.
But then I expect to see the number “2” to be debuged when i press space.
but still 1 is being debugged when i press space.
It is like the first time i press a button select gets locked to that first value somehow.
apreaciate any help Thanks.
public int select = 0;
private void Start()
{
Instantiate(smm);
}
public void chosemap1()
{
select = 1;
Debug.Log(select);
}
public void chosemap2()
{
select = 2;
Debug.Log(select);
}
public void chosemap3()
{
select = 3;
Debug.Log(select);
}
void Update()
{
if (Input.GetKeyDown("space"))
{
Debug.Log(select);
}
}