Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm writing a game where I want to use ContentTypeReader. While loading my model like this:

terrain = Content.Load<Model>("Text/terrain");

I get following error:

Error loading "Text\terrain". Cannot find ContentTypeReader
AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral.

I've read that this kind of error can be caused by space's in assembly name so i've already removed them all but exception still occurs.

This is my content class:

[ContentTypeWriter]
public class HeightMapInfoWriter : ContentTypeWriter<HeightmapInfo>
{
    protected override void Write(ContentWriter output, HeightmapInfo value)
    {
        output.Write(value.getTerrainScale);
        output.Write(value.getHeight.GetLength(0));
        output.Write(value.getHeight.GetLength(1));

        foreach (float height in value.getHeight)
        {
            output.Write(height);
        }       
    }

    public override string GetRuntimeType(TargetPlatform targetPlatform)
    {
        return
            "AdventureGame.World.Heightmap,AdventureGame,Version=1.0.0.0,Culture=neutral";
    }

    public override string GetRuntimeReader(TargetPlatform targetPlatform)
    {
        return
        "AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral";        
    }
}

Does anyone meed that kind of error before?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I can't be sure from the description but is your content-type-reader class in your content-pipline-extensions project? If so than that is probably the reason why it can't find it. The content-type-reader has to be available at runtime and thus has to be part of the game project or of one of the linked game library projects. Be sure to update your assembly name when you move your class and also, just to be sure, add spaces after the commas in the string that desribes where the class should be.

Edit: to be sure you have to exact QualifiedAssemblyName of a class write this piece of code:

string info = typeof(HeightMapInfoReader).AssemblyQualifiedName;

Of course this only works for a class in the same, or a referenced, assembly so you still have to copy the string in info and put it in the ContentTypeWriter's GetRunTimeReader method harcoded but it makes sure you don't have typo's.

share|improve this answer
    
Yes it is in my ContentPipelineExtensionLibrary. Reference is added and so do spaces to string's but still doesn't work. Any other ideas? –  user1889999 Dec 9 '12 at 22:15
    
Please read my answer again. The problem is that it is in the ContentPipelineExtensionsLibrary and that it should be in your Game project or a Game Library project :) –  Roy T. Dec 10 '12 at 7:14
    
I'm writing this project with my friend and it worked for him. For some reason my project even with those changes can't be run but I assume that its not connected with this issue :) Thank you for your reply. Problem solved! –  user1889999 Dec 11 '12 at 9:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.