Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

An object reference is required to acess non-static member.

$
0
0
So I have an array of structs : public LevelInf[] levels; inside of the class "GameInfo" public class GameInfo : MonoBehaviour { which is made static by a child variable public static GameInfo info; however, when I try to access the array of structs in another script, if(GameInfo.levels[level].speed) { I get the "An object reference is required to access non-static member". I've know what this error is saying, and I know that there is a huge google results page of this question, but I don't know why I'm getting it, as "GameInfo" is indeed a static member. Additionally, I can't make the struct array static, as I need to change it's values in the inspector.

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>