Question by
BlazeLXIX · Jul 28, 2017 at 03:18 AM ·
2d gamevariablesanother script
Unity 2D: Accessing variables from another script(Problem)
Hello,
I am making a 2D game where the player controls a bow and shoots eyes. Now, I need to increment the score when an arrow collides with an eye, and decrement the life when an eye touches the bow. I tried accessing the bow's variables in the eye prefab, but instead of altering the variables of the bow in the scene, it alters the variables of the bow prefab, which doesn't reset when I press play. How do I make it so that either
A. the prefab affects the instance of the bow in the scene B. Make the bow prefab's life and score reset to 10 and 0 respectively at game start
Thank you so much for the help if you're willing to give it.
Comment