Skip to main content


Showing posts from November, 2013

How to implement Appirater in unity

Here is a working example of Appirater for unity iphones. I was very noob with objective-c when i first did this. So i combined Appirater example given in this site"" with unity ios Bonjour example and made it to work.

Before building your xcode, open from  Assets/plugin/ios, add your appID and other details like after how many uses you want to promote user to rate your app.
Here is a image showing where you want to add your AppID.

After adding your appID and other details, use this script  to call Appirater.

using UnityEngine; using System.Collections; using System.Runtime.InteropServices;
publicclassCallAppiraterU : MonoBehaviour {
[DllImport ("__Internal")] privatestaticexternvoid_StartLookup(string service, string domain);
// Use this for initialization void Start () {         if (Application.platform == RuntimePlatform.IPhonePlayer)         {                  _StartLookup("_daap._tcp","…

How to ignore Raycast in Unity

Ignoring ray cast is pretty simple, but i saw peoples little confused on this topic, even i got little confused when i first tried this. So i thought to post a blog on this topic.

To ignore ray cast you just need to create a LayerMask variable in inspector. Than select all layers on which you want to cast your ray and leave the layer (unmark) on which you don't want to cast your rays That's it, now all you need to do is include that LayerMask variable in your ray casting.

using UnityEngine; using System.Collections; using System; publicclass Player : MonoBehaviour {
publicCamera myCam; publicLayerMaskignoreLayers;
void Update () { if(Input.GetMouseButtonDown(0))       { RaycastHithit; varray2 = myCam.ScreenPointToRay (Input.mousePosition); if(Physics.Raycast (ray2,out hit,Mathf.Infinity,ignoreLayers))               {                     print(hit.collider.tag);              }       } }
Or you can do it another way,

using UnityEngine; using System.Collections; using System; publicclass Player …

Read and Write XML using csharp in unity

Hi Guys, Here is another post showing how to save position and rotation of players using xml in Unity3d.
Let me describe few things about this small dummy game. There are players you can control by clicking on them and using arrow keys you can move them. There are 2 GUI Buttons, one to save "positions & rotation" and one to Load "positions & rotation".

To save "positions & rotation" I am storing all players into a list of GameObjects, when we press save button, we create nodes in XML file for each player with there names and stores there "positions & rotation" in it.
And when we load data form Xml we check if that player is present in the game world (how ? -by using there names) "?when we saved them we used there names, so this will help us now to first find them and than update there position and rotation".

Here is a video..

This is the xml we will get after we click the save button.
<?xml version="1.0"e…