thats crazy
could it be my build setup ?
i removed older versions of my project to make room. im still learning finding this hard
Yee would you mind sending me the build i sent you as i removed it from my computer. Which wasn’t a good idea. Found this all confusing and frustrating to be honest
Sure, give me a sec, I’ll pm you the link.
Im using unity on I Mac by the way
thanks your a gooden !
Just fixed the live system, it was that after all.
I noticed something with your code, you are not actually using the scriptable object. In your LoseCollider script there’s this line.
public static int numLives;
Erase that, now a bunch of errors will appear, don’t worry, just write “lives” behind the “numLives”.
Here’s an example of how your code should look like:
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoseColider : MonoBehaviour
{
[SerializeField] private AudioClip ballLostSound;
[SerializeField] Lives lives;
private void Start()
{
if (SceneManager.GetActiveScene().name == "Level 1")
{
lives.numLives = 3;
}
else
{
lives.numLives += 1;
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
lives.numLives--;
if (lives.numLives <=0)
{
SceneManager.LoadScene("Game Over");
}
else
{
GameplayController.instance.CountLives(lives.numLives);
Ball.ballInstance.SetBallPosition();
}
AudioSource.PlayClipAtPoint(ballLostSound, transform.position, 1f);
}
}
Compare it with your previous code to see what needs to be changed.
there is a red squiggly line Gameplay Controller script Start under numLives now
Yes, you’ll have to change all of those squiggly lines to exactly the same “lives.numLives”
Remove the “LoseColider” part.
thanks all good fingers crossed lol
ok tested it in local build. Only thing wrong is text wont go up 1 when you get an additional life from completing a level. Nearly there though
oh music doesn’t play when you begin in start menu either but i can live with that
tried building again and now you dont get extra life and text goes down from 3 to 2
is there anything i need to check in the build settings ?
To be honest I’m a little lost here, to me is working just fine, so I don’t know what might be going on here. The build settings don’t affect the code, I’ll test some things out and let you know, but it’s gonna take some time.
thanks Yee
If the built game is working fine for @Yee, I would suggest to close Unity and delete the Library folder. Then start Unity again, wait a couple of minutes until everything was loaded, then open your scene. Test your game and build it again.
And before you do what I suggested, make a backup of your project folder by duplicating it. Save the duplicated folder somewhere else, maybe on an USB stick. To save some free space, you could delete the Library and Temp folders in the backup folder.