JME3 Eclipse Assetmanager is null

Hi,



i’m new to Jme3 and want to start using it with Eclipse - the IDE i know best.



I downloaded the latest nightly build and added it succesfully to the source path of the “hello world” project.

Also the jars in the lib folder are added to the build path.

It compiles with no errors.



When starting the project, i have the problem that the ‘assedmanager’ is null?! Why?

Basically the it happens with just this few lines of code:



[java]

public static void main(String[] args) {

Main app = new Main();

app.simpleInitApp();



}



@Override

public void simpleInitApp() {

Box b = new Box(Vector3f.ZERO, 1, 1, 1);

Geometry geom = new Geometry(“Box”, b);

if(assetManager == null){

System.out.println(“Asset Manager is null”);

}

Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setColor(“Color”, ColorRGBA.Blue);

geom.setMaterial(mat);

rootNode.attachChild(geom);

}



[/java]



I really love jMonkey engine already, and was extremly happy finding this. I would be so happy to use it further.



Thanx for your help to basic guys like me :smiley:



Pixelkalle

The assetManager can only be null at this point.

you have to call:

[java]app.start();[/java]

instead of

[java]app.simpleInitApp();[/java]

in line 3

1 Like

Yay,



that works!! Tank you. Havn’t seen that.