Can't use size() in setup()

Trying to run a large sketch I cloned from Github, I get the error

size() cannot be used here, see https://processing.org/reference/size_.html

Documentation says:

the size() function must be the first line of code inside setup(), and the setup() function must appear in the code tab with the same name as your sketch folder.

This is the case: size() is called exactly once as the first statement in setup() in a tab named TheAbyss. This is also the name of the sketch and the name of the folder in which the sketch files reside.

How can I find out why Processing doesn’t like size() at this location? Thanks for any input.

The sketch is much too large to copy here, but for what it’s worth, here is the beginning of the TheAbyss tab:

/**
 * The Abyss
 * 2010-13
 */

CreatureManager creatureManager;
boolean useBackdrop = true;

void setup() {
  size(displayWidth, displayHeight, P3D);  
  smooth(8);
  frameRate(60);
  creatureManager = new CreatureManager(this);
  // creatureManager.toggleManagerInfo(); // turn info off

  initShaders();
} 

void draw() { 
...
1 Like

Documentation also says

To run a sketch that fills the screen, use the fullScreen() function, rather than using size(displayWidth, displayHeight).

The error goes away when I replace displayWidth and displayHeight with numbers, or use fullScreen() instead of size().

2 Likes
2 Likes