I have an autoloaded Singleton call ViewManager.
The ViewManager has one Table which has one Dealer which has one Deck and one Judge
I'm building a test frame for my game so it would be useful to access some of these major Nodes directly
I've tried a number of ways but I really thought this one would work.
I added these to my Singleton ViewManager (Just showing the code for the Deck node)
Deck = NodeType
print("registerDeck: " + str(Deck))
print("Getting Deck " + str(Deck))
References in scripts of other nodes to ViewManager.Deck or ViewManager.getDeck()
return a null. I have ensured the Deck node has been instantiated by including the registerDeck function which is called in the Deck _ready() script
The register functions work as the following printout shows:
Yet, when I try to utilize the reference (in the Judge's testing method in this case) after the reports above (along with several intervening reports) have been made
Getting Deck [Object:null]
The first report comes from the print statement in the ViewManager getDeck function
the second from the print statement in the Judge testing function
The Deck reference, which had been set, is now null.
This is baffling, since Deck is a variable that gets set once and then is only read. I had thought originally it might be due to threading but too much time intervenes between the reports for that to be likely.