jfk
jfk

Reputation: 21

Inaccesible due to its protection level

I am triyng to add an animation to my project.Although I add the class referance to another classs , visual studio is giving the following error:

inaccesible due to its protection level

I define the datatype but nothing has changed.Here is my code block ;

  static Dictionary<string, AnimationClip> ProcessAnimations(
       AnimationContentDictionary animations, IList<BoneContent> bones)
    {
        // Build up a table mapping bone names to indices.
        Dictionary<string, int> boneMap = new Dictionary<string, int>();

        for (int i = 0; i < bones.Count; i++)
        {
            string boneName = bones[i].Name;

            if (!string.IsNullOrEmpty(boneName))
                boneMap.Add(boneName, i);
        }

        // Convert each animation in turn.
        Dictionary<string, AnimationClip> animationClips;
        animationClips = new Dictionary<string, AnimationClip>();

        foreach (KeyValuePair<string, AnimationContent> animation in animations)

        {
            AnimationClip processed = ProcessAnimation(animation.Value, boneMap);

            animationClips.Add(animation.Key, processed);
        }

And this part is giving this error :

  animationClips = new Dictionary<string, AnimationClip>();

The AnimationClip class :

class AnimationClip
{
    public AnimationClip(TimeSpan duration, List<Keyframe> keyframes)
    {
        Duration = duration;
        Keyframes = keyframes;
    }
    /// </summary>
    public AnimationClip()
    {
    }

    /// </summary>
    [ContentSerializer]
    public TimeSpan Duration { get; private set; }


    /// <summary>
    /// Gets a combined list containing all the keyframes for all bones,
    /// sorted by time.
    /// </summary>
    [ContentSerializer]
    public List<Keyframe> Keyframes { get; private set; }
}

Anybody can help me ? Thanks in advance.

Upvotes: 0

Views: 623

Answers (1)

Ronan Thibaudau
Ronan Thibaudau

Reputation: 3603

Change

class AnimationClip

to

public class AnimationClip

Making it's member public is a thing but the class itself needs to be public too if you want to access it this way.

Upvotes: 1

Related Questions