G
gdomjan83

  • Mar 8, 2024
  • Joined Nov 29, 2023
  • 0 best answers
  • Armynator That's a pretty good idea. Is there any particular reason you use NodePath instead of referencing Node? That way if you set up the node in the editor, you don't even have to use the GetNode in the Ready method?

    • So, I'm using the C# version of godot because I know and like that programming language more than the Python-esque GDScript. But there is one thing which I envy from GDScript. That you can easily access the Node references by just clicking and dragging the node into the editor.

      In c#, you always have to type out the GetNode<node type>("nodename") method.

      For those who also use C#, don't you have a nice way of speeding up this process? Some Protip. 😃

      • d13 replied to this.
      • Found the solution after a lot of trial and error. So in the Enemy scene, which is the parent scene, I had to delete the value of the 'actor' export variable, and only set the value in the child scenes.

      • So I'm doing a space shooter following a tutorial, and there is a point where I have to make different type of enemies. I'm trying to do this with inheritance, but something is not right with this. Here is my setup:

        I have a base Enemy.cs class with some logic in it. I also have a PinkEnemy.cs class which extends Enemy.cs. Right now, PinkEnemy has no code in it, so if I'm guessing correctly, it should run the code in Enemy, since I'm not overwriting anything.

        In the editor, I also have Enemy and PinkEnemy scenes (pinkenemy inherints enemy).

        So, if I put a PinkEnemy object in the editor and I attach the Enemy.cs script to it, everything works fine. But if I attach the PinkEnemy.cs script to it, it throws exceptions and the unit is not behaving like it should.

        I attached the scripts and exception HERE.

        According to the exception, it seems the actor variable doesn't hold anything, but since it is an Exported variable, I can see that I assigned the PinkEnemy node to it, as I should.

        Any ideas?

      • Hi.
        I'm doing a small project where I create custom components for things like Movement and Input. In these components, I export variables, for example Actor or Sprite etc. Then I assign an object to these variables in the editor.

        When I export the game from the editor, everything works fine.

        But I have also set up a Gitlab pipeline, which exports the uploaded project. The thing is, if I download the exported project, it throws a lot of Object not referenced exceptions. I looked it up, and it seems to me that every variable, which are exported in the components are null, despite that in the editor there are objects set up for them, and they work perfectly if I export the project from the editor.

        Anyone else ran into this kind of problem?