Accessing variable from other namespace

Hi i downloaded an asset called CMD+ and im trying to make a command so that when i press a button inside the console it gives me coins, so i tried “CoinManager.coinAmount” but that gives me "
An object reference is required to access non-static member `CoinManager.coinAmount’ Error.

How do i access “CoinAmount” to the console script?

You need to find a CoinManager object in the scene first. You can do this by FindObjectOfType(), but don’t do call repeatedly as it’s pretty slow. You can also set up CoinManager as a singleton, or make it s static class.

Well, you could make CoinAmount static, if you only have one CoinAmount.

Or, you have to create a reference to your CoinManager. You could also make the CoinManager into a singleton.

@StarManta beat me to it. lol.

Made it static, Thanks! <3 #nohomo