Author Topic: Object not set to an instance  (Read 73 times)

Guest

  • Guest
Object not set to an instance
« on: February 01, 2019, 10:02:40 PM »
Hello, im using the same code than levelmanager in exemple scene and it doesn't work.
My compasspoipro object is located in a special scene that load before my level.
when my level is loaded i have a poimanager that seek for the compasspro instance

Code
			
        CompassPro compass;

        // Use this for initialization
        void Start()
        {
            // Get a reference to the Compass Pro Navigator component
            compass = CompassPro.instance;
}


Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4222
    • View Profile
Re: Object not set to an instance
« Reply #1 on: February 02, 2019, 03:29:45 AM »
Hello,

Make sure your Compass Navigator Pro component has "Don't Destroy On Load" option enabled:


Enabling that option will avoid the compass to be destroyed when switching between scenes.

You can do the same for the CompassProPOI components as it also has a "Don't Destroy On Load" option for POIs you want to preserve across scenes.

If problem persists, please make sure you're using the latest version from the Asset Store and post the full console log error.

Thank you.

Guest

  • Guest
Re: Object not set to an instance
« Reply #2 on: February 02, 2019, 06:29:23 AM »
yeah it is in a protected array of gameobject that doesn't destroy on load. The compass and my interface is intact but the POI doesn't seem to detect the compass.

compass =  compasspro.instance

will return "null" each time. im currently trying to manually set the object

unplug

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Object not set to an instance
« Reply #3 on: February 02, 2019, 09:02:00 AM »
I found the problem...

in file CompassPro.cs you use

GameObject.Find("CompassNavigatorPro");

i suggest you fin a tag and not a object. People rename their stuff and move them around... I will personnally hard code the gameobject since it is static.

ill let you know if its solved

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4222
    • View Profile
Re: Object not set to an instance
« Reply #4 on: February 02, 2019, 09:42:12 AM »
Yep. Will be changed in next update. Thanks.