Cannot read properties of undefined (reading 'model')

Hi I am new to playcanvas and I tried loading the mirror plane and I am getting this error :

[mirror.js?id=169615901&branchId=dcd2f932-2fa5-497b-a321-7fad2633475a:173]: Cannot read properties of undefined (reading ‘model’)

I copy and pasted the latest script from the latest scene editor for the planar mirror and added layers etc to appropriate objects and ticked the primative box in the script. But Still that error comes up.

Any help with this would be great or if anyone has a better suggestions to get refelections on a object instead of a flat plane like this would be a great help.

Hi @Chris_C and welcome!

The error means that you try to access the model component, while there is no model component on the entity with the script.

Since the model component is deprecated, could it be it is replaced with the new render component?

I wonder why model is used twice here, that could also cause the error.

image

If you use an example project, can you share the project please?

Hi Albertos,
Thank you very much for the quick help and reply. I just copied and pasted the scripts and shader from the latest build of the mirror plane scene.
Also in regards to the code on line 173. I deleted the doubled “.model” part and still reflections does not work but the error is gone. Im not sure where I missed things…

Here is the example project I hope it opens in your end.
https://playcanvas.com/project/1195268/overview/post-effects-test

I don’t understand what you mean with this. Is it an PlayCanvas example that you can share?

In this project render components are used instead of model components. Maybe you can try to replace model with render in the script as well.

In this project render components are used instead of model components. Maybe you can try to replace model with render in the script as well.

Albertos thanks heaps again ! I will get a programmer to look at this for me as I am so bad at programming. Thanks heaps for your help !