pc.GraphNode.findByName is not a function [ERROR]

https://playcanvas.com/editor/code/466881?tabs=7160004
https://playcanvas.com/editor/scene/507358

I want to do something like:
pc.GraphNode.findByName(“name”).getPosition();
To get a Vec3 out, but I must be invoking this incorrectly.

findByName is an instance method. You have to call it on an instance of a GraphNode. For example this.app.root.findByName

1 Like

I see now that the API Reference explicitly states the pc.createXyz methods are static. I honestly have not worked much with non-static methods, thank you for pointing that out! I will now assume methods are instanced unless stated.