Unity Package code not global

Hello,
I recently created my own Unity package that I will be posting on the Unity Asset Store. I was required to add a namespace to the code before sending it off to be uploaded.
When I locally import the class to another project I want to be able to access the Singleton from anywhere else in my project.

But I am unable to access it. What do I need to do in order to access that script?

I attached screenshots of:

  • JSON package
  • The main logger script that is to be used in my other project I uploaded the package to
  • my assembly definition for the package
  • and the code of how I am supposed to access the logger tool

Please let me know what other information you might need or if this needs to go to a different forum.




Hi there,

I’m not sure which part of the forum would be best suited for that question.
Maybe in package management or assets and asset store… but maybe I can also help directly here.

Looking at your screenshots, everything seems to be fine on the setup side.
The asmdef has Auto Reference selected, your class is in a namespace, and you’re trying to use it with the class name.
Could it be that the file where you’re trying to use the code is missing a using LogMachineController; at the top to make it find the LogMachine class in the new namespace?

Hello! Thank you for the reply!
I did have that but it didn’t work (eventually it did)
I needed an assemble def in my main code and needed to reference the packages assembly def. And now it works!

1 Like

Glad to hear that you solved it.

Can I ask you to report a bug with your project whenever you have some time and post the bug ticket number here? Talking with the scripting team I think it should work without requiring an asmdef in your main code, so there may be something strange going on.