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