Asset Manager null

Hello guys, this is my first week using jMonkey and I am finding some trouble understanding assets even after reading the tutorials.

I have an class that has the main and extends simpleApplication that get specific motion events passed to it and a class that is responsible of the actual animation of these events. It’s a smaller design from a bigger one so don’t be surprised if it’s a little different than the usual. All the animation function are inside Animator class (that also extends SimpleApplication).

The issue I am having is when I start and have to execute some motion event from Animator I get an assetManager == null error.


private static AnimatorCinematics myApp;

public AnimatorVisualizer( String filePath) {

myApp = new AnimatorCinematics(filePath);



now in the constructor is:


public AnimatorCinematics( String filePath) {

traceFile = new File(filePath);

// used to do other stuff

// issue is that I need to initialize the assetManager here or something

// otherwise if I call it at any point I’m gonna get a null ptr



There is an AssetManager inside your SimpleApplication (especially if you create a simple framework using the SDK). Pass that AssetManager to anywhere you need it.

1 Like

Read the tutorials, you have to do stuff in simpleInit(), when the constructor is called the assetManager is not prepared yet.

I decided to just keep one class extending SimpleApplication and animate in the other w/o extending anything. After reading the API more thoroughly the getters and setters should allow me to do all the work.

Now another issue I was having is using this function:

[java] inputManager.addMapping("3dCamView", new KeyTrigger(keyInput.KEY_3));[/java]

in a class that is an instance of the main (that extends simpleApplication but itself does not extend simpleApplication), I tried this:

[java]myApp.getInputManager().addMapping("3dCamView", new KeyTrigger(keyInput.KEY_3));[/java]

The issue is how to get the keyTrigger to work w/o having to extend SimpleApplication?

@normen said:
Read the tutorials

u were right I got it to work … thanks