An object reference is required to access non-static member...PLEASE HELP !

Hi guy i have a little problem, i’ve created this script to change the “RedSkin” bool of “BallSkin” script in “true”, after the pressure of a button.

using UnityEngine;
using System.Collections;

public class RedSkinButton_Script : MonoBehaviour {

public void LoadScene (int level)
	
{
	Application.LoadLevel (level);
	BallSkin.RedSkin = true;
}

}

But I have this error…

Assets/UI_Script/RedSkinButton_Script.cs(11,26): error CS0120: An object reference is required to access non-static member `BallSkin.RedSkin’…

Please help me

The error is stating that BallSkin.RedSkin is a non-static variable and it can not be accessed. This mean you need to do one of two things depending on how you are using the class BallSkin. The first is to define BallSkin like this

public static class BallSkin : MonoBehaviour
{
    public static bool RedSkin;;
}

or do this in RedSkinButton_Script (my preferred method)

public class RedSkinButton_Script : MonoBehaviour
{
     public BallSkin ballSkin;
     public void LoadScene (int level)
     {
         Application.LoadLevel (level);
         if (ballSkin != null)
         {
         ballSkin.RedSkin = true;
         }
     }
}