سؤال

I am getting a compile time exception that states:

Actor.TimeScale.get' cannot be accessed with an instance reference; 
qualify it with a type name instead.    

This is the code, which has been cleaned up to just the relevant lines:

class Actor
{
    static float _timeScale = 1.0f;

    public static float TimeScale
    {
        get { return _timeScale; }
        set { _timeScale = value; }
    }
}
class Game1
{
    private void BeginLevel()
    {
        Actor.TimeScale = 0.3f;
    }
}

Now, I know something is amiss with static, but I don't understand what.

هل كانت مفيدة؟

المحلول

A child class of actor had:

this.TimeScale;

which of course doesnt work so well with static.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top