What is wrong with my script?
I am trying to create a list, and when an object is collected (in this case a bottle) a tick appears next to it.
This is the script that I currently have (c#)
using UnityEngine;
using UnityEngine.UI;
public class tick_1_script : MonoBehaviour {
public RawImage tick;
public GameObject bottle
// Use this for initialization
void Start () {
bottle.enabled = true
tick.enabled = false
}
void Update () {
bottle.enabled = false
tick.enabled = true
}
}
If you can help me, please do as I need it as soon as possible...
I have updated the script to
using UnityEngine;
using UnityEngine.UI;
public class tick_1_script : $$anonymous$$onoBehaviour {
public RawImage tick;
public GameObject bottle
}
void Start ()
{
if (bottle.active = true)
tick.SetActive(false)
}
void Update ()
{
bottle.active = false
tick.SetActive(true)
}
}
but now it is just giving me a bunch of parsing errors:
unexpected symbol '}' in class struct or interface member declaration
unxpected symbol '}'
and parsing error
If you could tell me why this is that would be awesome, Thanks!
Delete the first } (just below your variables).
And it should read if(bottle.activeSelf == true), which is the same as if(bottle.activeSelf). GameObject.active is deprecated.
Besides that, there's nothing close to a list in your script. So noone will be able to help you.