Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Location
    the rez
    Posts
    55

    Post XNA vol 2: Actor Demo problem with Content.Load (File not found)

    Hi folks, so I'm working through XNA vol 2 and I'm in the Actor Management Demo video. Using XNA 4.0 and Visual Studio 2010. I'm getting a file not found, which I can't figure out since it seems like it should be in the right place but clearly something is wrong.

    I have a Textures folder that I added via the Solution Explorer, so its location is:

    Code:
    ...visual studio 2010\Projects\ActorManagementDemo\ActorManagementDemo\ActorManagementDemo\Textures
    In that folder I have my player.png: Click image for larger version. 

Name:	mVy8e.png 
Views:	235 
Size:	14.5 KB 
ID:	72409

    My code is this, though I have tried many variations:
    Code:
    Content.RootDirectory = "Content"; 
    player = new Player(Content.Load<Texture2D>(@"Textures\player"));
    Player accepts a Texture2D so I'm just passing it over. I've tried many variations, but I'm thinking that it's not looking in the right directory to begin with. Where is the "Content" directory exactly? I have (and still am) researching this problem but so far I haven't come across a solution (though if I do, I'll post it here).

    Could someone help me figure this out?
    Last edited by mandismash; 01-19-2012 at 10:26 AM.

  2. #2
    Join Date
    Dec 2003
    Location
    3dbuzzmania
    Posts
    4,064
    In XNA 4.0 I am pretty sure you have 2 projects in your solution. Notice that one of them is the Content Project. That is where you should store your content.

    So in your case you should have:
    ActorManagementDemo
    ActorManagementDemoContent

    So if you create a Textures folder in your Content project your line should work.

  3. #3
    Join Date
    Dec 2011
    Location
    the rez
    Posts
    55
    Hooray! That works perfectly. Thank you TF242, I really appreciate it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •