void Start()
{
gameObject.SetActive(false);
}
// Update is called once per frame
void Update () {
}
}
When I start the game, the gameObject is still visible Can you help me?
Actually, your code should work and make the GameObject inactive. Make sure your script is enabled (check box to the left of the script). Also, are you sure there is no other script activating the GameObject somewhere else?
What do you actually want to do? Do you want to enable or disable the game object? In case you want to enable it it should be
gameObject.SetActive(true);
instead of
gameObject.SetActive(false);
If it still doesn’t work as intended: Make sure that the script is assigned to the right game object and also make sure that there is no other script which enables or disables the game object.
Actually, your code should work and make the GameObject inactive. Make sure your script is enabled (check box to the left of the script). Also, are you sure there is no other script activating the GameObject somewhere else?
– mikelortegaif this is the real code i think the variable of the gameobject is wrong but nothing else i see is wrong
– reddead12