Bug with built executable

Sun 28. May 2017, 09:35

Hi,

Possibly I have set something up wrong but currently I'm assigning an Articy Ref to an objecting using

[SerializeField]
ArticyRef articyCardDeckObject = null;

I then use this ref to pull out some data.

CardDeckArticy newDeck = articyCardDeckObject.GetObject<CardDeckArticy>();

This works perfectly in the editor but when the game is built I get a null reference exception as articyCardDeckObject.GetObject<CardDeckArticy>(); isn't returning anything.

FYI I also instantiate a clone of this object just before I access this (The above code happens in awake())

GameObject unit = (GameObject)GameObject.Instantiate(unitDictionary[unitName]) as GameObject;

As I mentioned, this is fine in the editor so I'm not too sure what's going wrong. Any help would be great.
05josephsmi
 
Posts: 4
Joined: Sun 28. May 2017, 09:29

Re: Bug with built executable

Sun 28. May 2017, 20:26

Hi 05josephsmi,

The most likely reason is that it is most of the time not safe to call anything from the plugin inside any Awake() calls.
The reason for that is, that the Database need to initialize aswell, and i chose the earliest possible occasion for that. Now sometimes it might work, because the order of those events are not fixed and some might be lucky and it gets called in the correct order.

And i think it works in the editor because the editor works slightly different in regards to lifetime events and assets. So what should work is that you access the ArticyRef inside a Start() method, in fact Awake is the earliest usable so you should be safe using any other of the events.
If you need to know more have a look at the unity docs and the different events.

If that didn't work and it still is causing issues you might have a more severe problem. Are you doing a windows/mac/linus standalone build? Can you check the log files?

And you might want to get rid of the "= null" i don't think its a problem, but it doesn't do anything. And in fact the object will get instantiated as unity won't serialize null.

Let me know how it went

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Bug with built executable

Mon 29. May 2017, 12:19

Thanks for the reply Nico,

It looks like accessing the articyRef in Start() doesn't fix the issue. I even tried putting an Invoke with a delay in start of 20 seconds and the error still occurs after the timer expires. I also tried changing from serializeField to a public field. However there's still no difference. The articyRef exists but calling GetObject on it returns null. Unfortunately it looks like this code is in your library and I am unable to debug it further. I'm doing a window stand alone build. I have attached the logs, could it be that your library is for some reason not included in the built executable?

Also I was using Debug.LogError to check if things exist so that will be reflected in the output.

Code: Select all
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\mike\1_Data\Managed\UnityEngine.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\UnityEngine.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\Assembly-CSharp-firstpass.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\Assembly-CSharp-firstpass.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\Assembly-CSharp.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\Assembly-CSharp.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\Assembly-UnityScript.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\Assembly-UnityScript.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\UnityEngine.UI.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\UnityEngine.UI.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\UnityEngine.Networking.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\UnityEngine.Networking.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\ArticyRuntime.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\ArticyRuntime.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DemiLib.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DemiLib.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DOTween.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DOTween.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DOTween43.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DOTween43.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DOTween46.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DOTween46.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DOTween50.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DOTween50.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\DOTweenPro.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\DOTweenPro.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\ProBuilderCore-Unity5.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\ProBuilderCore-Unity5.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\ProBuilderMeshOps-Unity5.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\ProBuilderMeshOps-Unity5.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\KDTree.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\KDTree.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\pb_Stl.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\pb_Stl.dll into Unity Child Domain
Platform assembly: C:\Users\mike\1_Data\Managed\Triangle.dll (this message is harmless)
Loading C:\Users\mike\1_Data\Managed\Triangle.dll into Unity Child Domain
- Completed reload, in  1.005 seconds
Platform assembly: C:\Users\mike\1_Data\Managed\System.Core.dll (this message is harmless)
Platform assembly: C:\Users\mike\1_Data\Managed\System.dll (this message is harmless)
desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0
<RI> Initializing input.

<RI> Input initialized.

<RI> Initialized touch support.

The referenced script on this Behaviour (Game Object 'Card1') is missing!
 
(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1743)

The referenced script on this Behaviour (Game Object 'Card3') is missing!
 
(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1743)

The referenced script on this Behaviour (Game Object 'ClawPortrait') is missing!
 
(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1743)

The referenced script on this Behaviour (Game Object 'Card2') is missing!
 
(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1743)

UnloadTime: 2.134849 ms
Setting up 2 worker threads for Enlighten.
  Thread -> id: 8030 -> priority: 1
  Thread -> id: 9004 -> priority: 1
Articy.Unity.ArticyRef
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:25)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 25)

Null
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:27)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 27)

NullReferenceException: Object reference not set to an instance of an object
  at GP.Combat.CardDeck.Start () [0x00030] in C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:29
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 29)

Articy.Unity.ArticyRef
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:25)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 25)

Null
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:27)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 27)

NullReferenceException: Object reference not set to an instance of an object
  at GP.Combat.CardDeck.Start () [0x00030] in C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:29
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 29)

Articy.Unity.ArticyRef
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:25)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 25)

Null
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:27)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 27)

NullReferenceException: Object reference not set to an instance of an object
  at GP.Combat.CardDeck.Start () [0x00030] in C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:29
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 29)

Articy.Unity.ArticyRef
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:25)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 25)

Null
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
GP.Combat.CardDeck:Start() (at C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:27)
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 27)

NullReferenceException: Object reference not set to an instance of an object
  at GP.Combat.CardDeck.Start () [0x00030] in C:\Users\mike\GenocidePoint\genocide-point\GenocidePoint\Assets\Script\Battle\Units\CardDeck.cs:29
 
(Filename: C:/Users/mike/GenocidePoint/genocide-point/GenocidePoint/Assets/Script/Battle/Units/CardDeck.cs Line: 29)
05josephsmi
 
Posts: 4
Joined: Sun 28. May 2017, 09:29

Re: Bug with built executable

Mon 29. May 2017, 13:12

That sounds a bit weird, but maybe something is wonky with the package handling.

Are you using Packages at all? If you do, make sure that you either set them as default package or load the package before trying to access it.

You can change the default package in the database view.

packages.png
packages.png (12.31 KiB) Viewed 19007 times


If you have never changed anything like that, its unlikely that this is causing a problem.
So i might need some more informations. What you could do is add a check to see if the ArticyRef is carrying an object at all.
To do that, just add a log output printing

Code: Select all
Debug.Log( articyCardDeckObject.id );


if this prints 0, then the ref is loosing the assigned value, which could be related to you Instantiating it from a prefab. What object are you assigning into the ref?
While i never encountered it, thats at least at this point the likely cause.
If this is not 0, and a rather large number, the ref is most likely correct and the database doesn't carry any or the correct objects. To test that, you can print out the size and maybe the first object inside the Database.

Code: Select all
Debug.Log( ArticyDatabase.Objects.Count );
Debug.Log( ArticyDatabase.Objects[0].TechnicalName );


If up to this point all is working as expected, you can try to query the database by hand, instead of using an ArticyRef. By using any of the GetObject methods. If that works, something is broken with the ArticyRef and i need to have a look into it.
But at this point i think something gets lost between a prefab and instantiating it.

Sorry for your trouble and i hope we can work this out together!

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Bug with built executable

Mon 29. May 2017, 14:03

Okay, something odd. The imports were fine so I attempted to print some data.

It seems if I try to do anything with the database in start, before accessing the REF it works. So possibly for some reason it isn't initialized until something accesses the ArticyDatabase object. Possibly I'm missing some kind of init script (There's no flow player script in this scene) or something along those lines. Although since this fixes the issue that works for me. I don't know the cause of it however.

Debug.Log( ArticyDatabase.Objects.Count );
Debug.Log( ArticyDatabase.Objects[0].TechnicalName );

If you want me to investigate anything more so you can try to find the cause of the issue just let me know.

Thanks
05josephsmi
 
Posts: 4
Joined: Sun 28. May 2017, 09:29

Re: Bug with built executable

Mon 29. May 2017, 14:37

Ah! You gave me an idea what appears to be the issue! I have a check inside the ArticyRef to not do anything if the database "singleton" is not assigned. Any other call would take care of initializing the singleton, but this call (ArticyDatabase.IsDatabaseAvailable()) is not supposed to initialize it, instead just check it. Something else needed to initialize the database before the ArticyRef could access it. But obviously inside the ArticyRef this check is wrong.
Usually this is not an issue, because its a rather isolated case and its less and less likely to occur when the project grows, thats why i didn't found it when testing it. :roll:

Long story short: You did nothing wrong, its a bug that i could find thanks to you! :D

I expect to have a fix for the next version, thank you very much for helping resolve that issue!

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Bug with built executable

Tue 30. May 2017, 20:27

Glad you managed to catch it :)
05josephsmi
 
Posts: 4
Joined: Sun 28. May 2017, 09:29

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 35 guests

Who We Are
Contact Us
Social Links