wtracker kb

Fix Tracker FOV Undefined Error in Unity WebAR

Fix the “Cannot read properties of undefined (reading FOV)” error in Imagine WebAR by selecting the correct iTracker or wTracker WebGL template in Unity.
discord round color icon

A solution from our developer community

This article is based on a real question in the Imagine WebAR Discord community and includes examples and solutions from developers


WebAR Build Error: Cannot Read Properties of Undefined (reading ‘FOV’)

If your Unity WebAR build fails to run and shows an error similar to:

TypeError: Cannot read properties of undefined (reading 'FOV')

or:

TypeError: undefined is not an object (evaluating 'window.iTracker.FOV')

the most likely cause is that the wrong WebGL template is selected for the tracker you are using.


The Solution

Select the correct WebGL template for your tracker before building your project.

In Unity, go to:

Project Settings
└── Player
    └── Resolution and Presentation
        └── WebGL Template

Then select the template that matches the tracker you are using:

  • Image Tracker: select the iTracker WebGL template.
  • World Tracker: select the wTracker WebGL template.

Selecting the correct Imagine WebAR WebGL template in Unity Player Settings


Why This Error Happens

Each tracker uses its corresponding WebGL template to initialize the JavaScript components required by the tracker.

For example, Image Tracker expects window.iTracker to be available. If the incorrect template is used, window.iTracker may not be initialized, resulting in an error when the build tries to access properties such as FOV.


Quick Check

If you encounter an iTracker.FOV error, first confirm that:

WebGL Template = iTracker

Then rebuild your WebGL project.



Source: Imagine WebAR Developer Community
Originally discussed April 2024.

View original Discord discussion →
Join the Imagine WebAR Discord community →

Related Articles

Discover more from Imagine WebAR

Subscribe now to keep reading and get access to the full archive.

Continue reading