Hi all!
I’m new and i hope оpе you can help me with a little problem with JQuery.
I need to execute some code on $(document).ready(). How can i do that? Where do I need to place the script? Because if I write it in Script Asset, the line is never executed.
All the JS scripts in PlayCanvas are placed in the <script> tags at the top of the HTML. So you can put this in and script asset but don’t put it in the initialise functions or anything like that.
You need also to make sure that you have jQuery loaded to your Playcanvas project.
I’ve replaced the $ with jQuery, if you aren’t doing anonymous functions like in your example it would need the full reference to the jQuery global object.