godotengine / godotengine/godot
Export variables don't show up on Godot 4.4.1 Stable (Mono)
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Version : Godot_v4.4.1-stable_mono_linux_x86_64
Debian OS debian 12.
Godot + C#, for linux.
### System information
Linux Debian 12, Godot_v4.4.1-stable_mono_linux_x86_64
### Issue description
I have a node2D node, and a child of that, a tileMapLayer node. I have a starter function c# code attached in the node2D node, and a c# small class attached in tilemap node.
What I wanted was to do [Export] variable {get; set;} and it shows up on the godot editor inspector. But when I select the attached node, I only get a script selection dropdown at very end of list, and a "select metadata" button at the end.
The "script variables" section do not appear in the inspector section.
(might I add that this was a headache and I lost some hair to this now.
asdfk#! jl@;ks! d$f;!l #jk&&;! klfsd!.
### Steps to reproduce
*Bugsquad edit: cleaned up script blocks for clarity*
Script 1: attached to root Node2D game node.
```c#
using Godot;
using System;
public partial class Main : Node
{
private WorldgenA generator;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
generator = new WorldgenA();
generator.tileMap = GetNode(generator.tileMapPath);
generator.setWorld();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
generator.renderSlice(5);
}
}
```
script 2 attached to TileMapLayer Node (child of Node2D)
```c#
using Godot;
using System;
public partial class WorldgenA : Node
{
public enum TileType {
air,
water,
earth,
stone
}
TileType[,,] world;
[Export] public NodePath tileMapPath { get; set; }
[Export] public int TestInt;
public TileMapLayer tileMap;
public void setWorld() {
world = new TileType[20, 20, 30];
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 20; y++) {
int surface = 7;
for (int z = 0; z < 30; z++) {
if (z < surface) { world[x, y, z] = TileType.stone;
} else if (z == surface) { world[x, y, z] = TileType.earth;
} else { world[x, y, z] = TileType.air; }
}
}
}
}
public void renderSlice(int zlevel) {
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 20; y++) {
for (int z = 0; z < 30; z++) {
if (z == zlevel) {
TileType tile = world[x, y, z];
int tileID = -1;
switch (tile) {
case (TileType.air): tileID = -1; break;
case (TileType.earth): tileID = 0; break;
case (TileType.stone): tileID = 1; break;
}
if (tileID != -1) {
tileMap.SetCell(
new Vector2I(x,y),
0,
new Vector2I(2,0)
);
}
}
}
}
}
}
}
```
### Minimal reproduction project (MRP)
[a1.tar.gz](https://github.com/user-attachments/files/22310398/a1.tar.gz)
Contributor guide
Research direction
Start by extracting a1.tar.gz and opening the minimal reproduction in Godot_v4.4.1-stable_mono_linux_x86_64 on Debian 12. Select the TileMapLayer node and compare the inspector with the exported members in the attached WorldgenA C# script; done means the script variables section and exported fields appear as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, godot
- Domain
- devtools, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100