Question by
edvardskesteris · Jul 25, 2021 at 03:33 PM ·
gameobjectscenechangeautomaticallycounting
Change scene automatically when all objects are clicked
Hello! I need help with my new game. I'm very poor in C# programming. I need a script when all objects are clicked automatically change scene + I need a score counting and when the scene is changed all scores are not destroyed. This is my script now: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class pop : MonoBehaviour { public AudioClip sound; AudioSource audio;
// Start is called before the first frame update
void Start()
{
audio = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
bool wasClicked = false;
private void OnMouseDown()
{
if (!wasClicked)
{
wasClicked = true;
transform.Rotate(0, 0, 180);
audio.PlayOneShot(sound);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Invoke Random function 0 Answers
gameObject reappearing after setactive false 1 Answer
How to change the shape of gameObjects 2 Answers
How can I detect if a user is looking at a Gameobject inside a scene from a VR headset 0 Answers
Making a Deckbuilder 0 Answers