0

I'm trying to put an inventory management system (Devion Games from Unity's asset store) into the Ellen 3d Gamekit project (Also from Unity).

The problem I'm facing is releasing the mouse and camera movement when you open one of Devion's inventory or crafting menus). I can see where Devion pauses playerinput if using their 3rd person camera. Devion...UIWidget.cs:

if (m_CameraController != null)
    {
        this.m_CameraTransform.SendMessage("Activate", this.m_CameraPreset, SendMessageOptions.DontRequireReceiver);
    }else {
        //Show Cursor without ThridPersonCamera
        this.m_PreviousLockMode = Cursor.lockState;
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
        // MY CODE trying to use Gamekit3D's PlayerInput's GainControl()
        //m_Player.GetComponent("PlayerInput");
    }

But of course the Ellen 3d Gamekit uses a Cinemachine.

I thought it would be as easy as adding a "using GameKit3D" to the above code, then referencing it exactly how the pause menu from GameKit3D does GameKit3D...StartUI: PlayerInput.Instance.GainControl();

However, in the all the Devion files, when I try to do "using Gamekit3D" I get "type or namespace not found".

I can put "using DevionGames" in the Gamekit3D scripts, but not the other way around.

As you can probably tell, I'm new to all this. Things I've tried:

  1. Relocating all the Devion scripts out of the folder structure and into assets/scripts. This broke all kinds of references. But I was able to add "using Gamekit3D", but there were so many problems I couldn't get the game to load.
  2. I tried renaming the Devion namespace to the Gamekit3D and that also created too many errors for me to figure out.
  3. I've messed around a little with assembly definitions and references but honestly, it's way over my head and everything I tried immediately broke references to other things.
  4. I tried as many kind of references as I could. When I debugged, I could see the class I wanted to use in the place I wanted to use it, but I could not figure out how to getcomponent or FindGameObjectWithTag

Here's a picture of debuging where loading the Devion menu releases mouse control and you can see the PlayerInput which has public voids "ReleaseControl()" & "GainControl()" that I want to use: debug showing what I want to access where I want to access it

One more thing I've explored and may be playing in here is that most of the scripts related to Devion's menues are not Monobehaviour and the Gamekit3D scripts, PlayerInput most notably, is a Monobehaviour and I've played around with switching those up, or accessing the Gamekit3D gameobject as Monobehaviour.

EDIT to add structure: The reason I think it might be related to an assembly is how I can access one namespace from the other, but not vice versa:

My project structure is as follows:

  • Gamekit3D (all the scripts in this folder structure can add "using devion") -- prefabs, scripts and such
  • Devion (all the scripts in this folder structure canNOT add "using Gamekit3D") -- prefabs, scripts and such
  • Scripts (all the scripts in this folder structure can add both "using devion" & "using Gamekit3D")

here is a look at the solution view: a look at the solution exploreer

I am quite stuck with this and any help is appreciated!

  • I doubt this is the problem but just confirming that it’s not an issue of accidentally using GameKit3D (capital K) instead of Gamekit3D? Does it work if you explicitly reference the namespace in object references with ‘Gamekit3D.Whatever’ rather than including ‘using Gamekit3D’ at the top? – Sven Viking May 07 '22 at 01:48
  • I rely heavily on auto-complete and it's not picking up Gamekit-anything I've tried referencing the namespace in the line and it keeps saying it doesn't recognize the namespace. – Michael Shipe May 07 '22 at 10:24
  • But the Gamekit3D scripts are accessible to Unity, e.g. their Monobehaviours are available to be added to GameObjects in the editor etc.? – Sven Viking May 07 '22 at 10:43
  • I'm not sure I 100% understand your question, but yes, I believe so. I can add a game object and attach a script that I make with "using Gamekit3D" no problem. I tried to add the project structure to this comment, but it didn't format so well, so I edited my question above. Thank you so much @SvenViking for taking the time to look at this! – Michael Shipe May 07 '22 at 16:05
  • I mean can you use GameKit scripts directly without errors, like dragging e.g. Assets/3DGamekit/Scripts/Game/Player/PlayerController.cs onto a GameObject in the editor to add it as a component? Do the GameKit sample scenes work as expected if you load them in your project? – Sven Viking May 08 '22 at 01:37
  • 1
    Oh. Yes. It works as expected. – Michael Shipe May 08 '22 at 18:04
  • I’m not sure then. You could try reinstalling the package and checking for Preferences>External Tools>Regenerate Project Files. There are a couple of somewhat similar questions at these two links in case anything there is of use. https://stackoverflow.com/questions/4228992/namespace-not-recognized-even-though-it-is-there https://stackoverflow.com/questions/3304741/getting-type-or-namespace-name-could-not-be-found-but-everything-seems-ok – Sven Viking May 09 '22 at 03:41

0 Answers0