Skip to content

MapboxConvenience - bad Monobehaviour Singleton implementation #46

@Naphier

Description

@Naphier

The current destruction of the only MapboxConvenience instance was happening after I built for a standalone exe. I've addressed this with the following changes:

public override void Awake()
		{
			/*
			if (s_instance != null)
			{
				Destroy(gameObject);
				return;
			}
			*/
			base.Awake();

			if (s_instance != this)
			{
				Destroy(gameObject);
				return;
			}

			if (string.IsNullOrEmpty(_token))
			{
				throw new InvalidTokenException("Please get a token from mapbox.com");
			}

			if (_fileSource == null)
			{
				_fileSource = new FileSource(this);
				_fileSource.AccessToken = _token;
			}
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions