Exemple #1
0
 /// <summary>
 /// Initializes the API instance. This starts up the streaming system. Preferably, this should be called from within Awake() and before accessing the Api.Instance. Any subsequent calls to Api.Create will throw an exception.
 /// </summary>
 /// <param name="apikey">Your WRLD API key</param>
 /// <param name="coordinateSystem">The world space map behaviour. Cannot be changed once map is loaded.</param>
 /// <param name="parentTransformForStreamedObjects">Parent object to attach streamed objects to.</param>
 /// <param name="configParams">Configuration data needed by the map when loading.</param>
 public static void Create(string apikey, CoordinateSystem coordinateSystem, Transform parentTransformForStreamedObjects, ConfigParams configParams)
 {
     if (Instance == null)
     {
         Instance = new Api(apikey, coordinateSystem, parentTransformForStreamedObjects, configParams);
     }
     else
     {
         throw new ArgumentException("Api has already been initialized. Use Api.Instance to access it.");
     }
 }
Exemple #2
0
        private Api(string apiKey, CoordinateSystem coordinateSystem, Transform parentTransformForStreamedObjects, ConfigParams configParams)
        {
            CollisionStates = configParams.Collisions;

            if (!APIKeyHelpers.AppearsValid(apiKey))
            {
                throw new InvalidApiKeyException(string.Format(InvalidApiKeyExceptionMessage, apiKey));
            }

            try
            {
                m_implementation = new ApiImplementation(apiKey, coordinateSystem, parentTransformForStreamedObjects, configParams);
            }
            catch (DllNotFoundException dllNotFound)
            {
                bool couldNotFindWRLDBinary = dllNotFound.Message.ToLower().Contains("streamalpha");
                bool is32Bit = IntPtr.Size == 4;

                if (couldNotFindWRLDBinary && is32Bit)
                {
                    var guiTextObject = new GameObject("OtherErrorMessage");
                    var errorMessage  = guiTextObject.AddComponent <ErrorMessage>();
                    errorMessage.Title = "WRLD Error: Unsupported Build Architecture";
                    errorMessage.Text  =
                        "It looks like you're trying to run a 32 bit build of the game.  Unfortunately that isn't currently supported.\n\n" +
                        "Please go to 'File->Build Settings' in the Unity menu and select 'x86_64' as your Architecture to continue.";
                }
                else
                {
                    throw;
                }
            }
        }