ApplicationContext Documentation

Did I miss the documentation for the ApplicationContext class?

The ApplicationContext is referred to in “Anatomy of a Script”, and again in the Glossary. But I cannot find the class itself. From what I can tell it does offer access to:

keyboard (pc.Keyboard)
mouse (pc.Mouse)
scene (pc.Scene)
loader (pc.resources.ResourceLoader)

Documentation for Systems, and Root appear to be elusive too.

At first I thought that the ApplicationContext was just a reference to an instance of PlayCanvas. But based on how Systems was described in the documentation,, I suspect that’s not the case.

From an architecture perspective, I would have thought System(s) would have contained Keyboard, Mouse, Touch, type access, and maybe PlayCanvas.Components would provide access to the different components (pc.Model, which is defined already).

Is the ApplicationContext different from the PlayCanvas instance? If so, is there documentation available for it?

The docs for ApplicationContext are here:

systems is a object containing all the different Entity/Component system objects. e.g. model, rigidbody, collision.

root is the root Entity, it is of type pc.Entity and sits above the top node shown in the Editor. You can access any entity in your hierarchy by doing context.root.findByName("Entity Name");

Note that we’re likely to merge pc.ApplicationContext into pc.Application soon - but we’ll ensure we maintain backwards compatibility. The context on its own is nothing more than a property container.

I really got to get my eyes checked :smiley:

It’s clearly visible in the Engine API Reference. Btw, is there any chance that the index on the left have its own scrollable pane, and have the selected content be displayed on the right?

There’s also sub categories (at least I believe that’s the case) such as “Extended String API”, which pc.ApplicationContext sits six elements down but doesn’t make sense. The sub cats are definitely good but could we have alphabetical too? Basically an option to switch between the two.

So we used to have all the classes namespaced and grouped into categories. e.g.

pc.input (Input Handling)

Over Christmas, we the namespacing and created an alphabetical list. However, this job wasn’t 100% completed and there are still a few namespaces and groupings remaining (e.g. pc.asset, pc.resources and a few others). We’ll resolve this soon. But ultimately, I think it’s a big improvement having dropped the namespaces. Less to type! :smile:

I agree about a left panel scroll bar. We do want to restyle the developer site pages (including the API ref). It’s on the cards, definitely.