Town scene from hello asset doesn't load

So I’m following the tutorial and the teapot & wall display fine, however, I seem unable to load the town scene. What I tried; zipped file, unzipped files in the assets/Scene folder & finally hard coded the path but alas, all options throw a AssetNotFoundException.

I’m running Jmonkey in intelij, and actually coding in Kotlin, though I doubt that would an issue? And if so, I have no clue how to resolve it so any insight would be appreciated!

if you can’t load any assets then you have something wrong in you grade config well if you use gradle

Hm going by this post everything is there, though for good measure I could try adding local libraries to the project I guess.

use this template directly.

this is an answer but, you are getting AssetNotFoundException that’s mean that you didn’t put the zip file in the right place or you have a bad Gradle config.

Show the exception.

As requested… in general, don’t even bother mentioning exceptions without a stack traces. It’s totally useless. Like a post that says “I have a problem, can you fix it?” levels of useless.

Thanks, haven’t had time to try it out yet, will do so over the weekend probably.

1 Like

This is the stack trace when using unzipped files in the assets folder.

Could you not have saved us all a click and simply included it in a post here? It’s just text.

Also, what is your directory structure, etc. etc…

I can 100% assure you that the problem is on your end. The code is working fine. So in order for us to help you sort out what your problem is, we will need all of the information.

Directory structure, project setup, and so on… so we can figure out which part you did wrong.

He may of failed to registerLocator if using the zip file. Otherwise its like others mentioned, wrong path.

The tutorial asks you to drop the zipfile into the top level directory, not the assets folder.

The tutorial did need to be clarified a little so I edited it. I made the optional step of unzipping required and moved it from the ZipLocator part of the tutorial to the second example.

Edit: Forgot to mention, when you registerLocator on zip files in the assets folder, you have to include assets in the path whereas when its just loadModel the path is relative to the assets folder.

1 Like

But note that there will be no “assets” folder in a final deployment so then you will likely get errors about the missing file just when deploying “for real”.

If you are going to use a zip, probably best not to put it in the assets folder.

Right, as the tutorial directs.

I will add that to tutorial, its not very clear about it.

Ok, I changed this,

•The current classpath (the top level of your project directory).
•The assets directory of your project.
•Optionally, custom paths that you register.

To

•The current classpath (the top level of your project directory).
•The sub-folders of the assets directory of your project.
•Optionally, custom paths that you register.

and added this warning,

When you build your project for distribution, there will be no assets directory. Instead, you will generate an assets.jar file, located in the dist/lib folder of your project that will contain the sub-folders of the assets directory and all the assets in those folders.

2 Likes

Finally, I added this to the ZipLocator exercise,

Remember that there will be no assets folder in a final deployment. If you are going to use a zip, do not put it in the assets folder. Otherwise, you will likely get errors about a missing file. For final distribution, add it to your dist folder.

Thanks for the input.

2 Likes

Yeah not sure why I did that, guess I was still in screengrabbin’ mode from documenting stuff at work :grin:

And you’re right the error was on my end as per @mitm update to the tutorial it’s working now!

Thanks for clarifying! The documentation should probably also mention one needs to add a light source in order to see the town, at least when working through the zip exercise. On my end at least the level had no local or world lights, so I added a the directional light to the rootnode and that worked.

The tutorial uses a directional light and comments that,

// You must add a light to make the model visible

and the exercises use the same code so it is expected for it to already be there.

:man_facepalming:

Actually wrote along with the examples, rather than copy/paste and once I had the teapot & wall visible skipped to the town. Which makes me wonder, how come they are visible without a light source?