I’m making a local multiplayer golf game with unity, I have 2 scenes the menu and the first level, 4 golf balls in different colors as prefabs (white, yellow, blue, red) .
I made a script that fills a table with the chosen golf balls and they are arranged by the selection order.
My problem is that in the first level scene , I made the game playable with one ball, I have a camera and shoot scripts connected to that one, what I want to do is making a script that takes the golf balls, one by one, from the table in the first scene and made them replace the other ball.
I tried with the function instantiate but it’s not working, plus the camera and the shoot scripts won’t be applied on many golf balls.
If I understand correct you’re trying to grab values from another scene?
That’s simply not possible, you’ll have to do something to make sure those values survive into your new scene.
There are multiple ways you can do this, something like a gamemanager with dontdestroyonload that holds the values. (dontdestroyonload means it will survive scene changes)
You can also save the values somewhere, like playerprefs and get them from there.
There are more options, but those are probably the easiest to start with.