Pergunta

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.

Foi útil?

Solução

A child class of actor had:

this.TimeScale;

which of course doesnt work so well with static.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top