Search Unity

How to make build for some platform when scripts include code for other

Discussion in 'Scripting' started by Ethan_Hunt, Apr 16, 2014.

  1. Ethan_Hunt

    Ethan_Hunt

    Joined:
    Apr 4, 2014
    Posts:
    3
    I am developing a cross-platform game that can be run on android, ios and webplayer. I am using AndroidJavaObject and AndroidJavaClass in my scripts. The issue is that I can make a build for android but when I try making build for web player it gives errors like
    error CS0246: The type or namespace name `AndroidJavaObject' could not be found. Are you missing a using directive or an assembly reference?
    and
    BCE0021: Namespace 'UnityEngine.AndroidJavaObject' not found, maybe you forgot to add an assembly reference?

    I can not go commenting the code each time I make the build for different platforms. Please suggest the solution to this problem.
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
  3. Ethan_Hunt

    Ethan_Hunt

    Joined:
    Apr 4, 2014
    Posts:
    3
    Thanks angrypenguin :)
    This was exactly what I was looking for.
     
    urfx likes this.
  4. urfx

    urfx

    Joined:
    Dec 12, 2013
    Posts:
    12
    me too! good penguin... here's a fish }=]•>
     
    holczhauser and angrypenguin like this.