[SOLVED] Cocoscreator w/ underscore.js?


#1

Hi,

It looks like underscore.js lib would be useful for what I needed so I tried adding it to cocoscreator but I’ve been getting errors. I’ve been putting it in my scripts folder but I’m having this error:

Simulator: ERROR: TypeError: undefined is not an object (evaluating ‘root._’), location: assets/scripts/underscore.js:23:32

I obviously have been doing things wrong here. Is there a specific folders for external scripts or something?


#2

Make some folder, for ex. “libs” and put underscore.js

Select it in Cocos Creator and check “Import as Plugin” and platforms, where you need underscore


#3

Wow, I didn’t know about this at all! It works perfectly now. Thank you very much for helping out. :slight_smile: