Skip to main content

Posts

Showing posts from January, 2020

EnvMap in CocosCreator

We wanted to get envmap effect implemented to ensure that we are able to show shiny surfaces. Since it wasn't clearly defined or showcased for cocos creator, i assumed it might not work. I wanted to make sure its' easy to setup so we don't loose a lot of time setting up a whole new renderer. Fortunately, the cocos creator engine has already setup the required pieces in place to get this working. I've been able to get this working on Cocos Creator 2.2.2. Here is the gist for implementing the same. Here is how it looks in action :

Google Analytics in Cocos Creator Web Games

Integrating google analytics for a web hosted cocos game is similar to integrating GA in normal websites. Add analytics.js download code to index.html use "ga" object to track events in the game.  This gets tricky if you want to do the same for a game that is running from within a mobile app. i.e, if you are embedding the web build from cocos creator into an android / ios app and loading it from disk for displaying in webview.  Add analytics.js download code to index.html Make GA use localStorage if you are not allowing cookies in webview. Disable the protocol detection in GA  Following is the code snippet to do it: Hope this helps anybody who is trying to achieve the same :)