-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C# new export variables won't show in Inspector until restart #12518
Comments
Currently, Godot does not build the project automatically when your script changes. You can build with the |
Duplicate of #11955? |
Ok just saying , even if i builded in vscode it dident show in inspector until i restarted Godot editor.. I get it needs alot of polish anyway, and pls dont froget to add support for Exporting Lists and Arrays... This is my first issue whit github so sorry if i am not using it proper :) , do i need to close it now or what? |
Your issue is good, don't worry :) My comment is more meant for @neikeq to decide if it's the same issue or a different but related one. |
Well I could still reproduce this issue today with a build newer than #12474, though I'd have to debug a bit more to see the exact steps to reproduce. |
C# exports don't appear for me even after restarting Godot, on git master. public class GridManager : Node {
[Export]
public int test = 0;
// ...
} |
@zatherz I think what's going on here is that the C# project needs to be built before Godot can know about the variables. So, instead of restarting, try adding the export attribute, then run your game with F5 or F6. The variable should then appear in the inspector. |
@NathanWarden It doesn't, but I might have to make a new build |
Found my problem, only fields can be |
Many users are confused by this issue, it even makes the |
This also causes a major issue when working in teams or on multiple machines because when downloading the repo for the first time when you first open the project whatever variables are in the startup scene get auto-updated, but since they haven't been exported they get completely deleted. I could make a video showing this if desired. I may be wrong, but the obvious solution seems to be that when opening the project it should compile the project (if possible), then load the first scene. |
@NathanWarden That's not related to this, but it sounds like a serious issue indeed. |
@neikeq Thanks, I'll open a new issue :) |
I had this issue today, custom build, built today, what happens is: Looks like its just a problem in a new project in the first run. |
New problem, if i export arrays, and mark as [Tool], i cant change the array length in inspector, stays zero even when i press to grow, or type a size, if i try too much godot crash without too much things in console. should i open another issue?I could not find any issue already open. if i can make any test to help i can do |
Yeah I'm having this issue on master atm on Windows 10. |
Im having an issue where once I add a signal, the exports I added are no longer showing in the inspector and the signals aren't either. |
As of today on Ubuntu 16.04 running 3.0.5 Mono version stable, I get the same behavior as @maikramer:
Looks like it's been a while. Is anyone still maintaining the Mono version? I might be able to help on this issue with some guidance from someone who's worked with the code base before. |
If I remember correctly, this is an issue even with GDScript, where if a script had an error in it then it could no longer generate the variables, thus those values would be lost when the scene is saved. So, I think the solution would be to have Godot internally know the last successful build of each script, and only update serialized variables in the event of a successful build. It would be set to unsuccessful by default, so when you first open a project it will keep all variables there. This is especially a problem if you just cloned a project from source control, as this means everything gets reset immediately in the main scene. |
That's not the problem I'm describing. My script built successfully, but its Export variables still didn't show up in the editor without restarting. |
Oops, I confused this with another very similar issue (again). I bet you'd should be safe to try and tackle this bug then :) @neikeq is still the maintainer, but if I'm not mistaken, I think his time is somewhat limited right now due to school, but should pick up soon. |
Does this still happen after f1130f9? |
I'll let you know as soon as I've forked and built from source -- might take until tomorrow. |
It will take me a while but I'll grab this on Mac and see if f1130f9 fixes this. Right now the problem is just the hot reload; clicking Build Project causes the [Export]'d variables to appear. |
Still haven't checked on Ubuntu because when I ran the build with Mono support enabled, there was still no option to create a C# project. Maybe the build failed silently and I was running the non-Mono bin by accident. I'll look into it more when I get the chance |
@NQNStudios I ran into the same problem on my Mac last week. Thank you for taking care of Ubuntu. in my case, though I had thought I set the build flags appropriately, I ended up with a non-Mono Godot. Nowadays I just check the About box as soon as I am done building to verify I didn't screw things up. |
What is the issue? The C# project should be generated automatically when you create a C# acript. Is there any error? |
@neikeq There's no error, just behavior that is unexpected. I don't think this is a bug so much as a feature request. When working in a C# script, if I add I believe the intention is to have this automatically updated behind the scenes, wherein I add It's more of a nuisance than anything else, and anyone coming from Unreal or Unity has this "auto-build" expectation as well. |
Again, I think this should be re-labelled, since this is not a bug and more of a feature request/improvement. |
@lawsonry I get what you're saying. Essentially with gdscript if you make a change in the editor (even before saving) godot picks up your export variables on keypress it seems. With c# it picks it up on build and that's not a problem, but it would be nice if godot would reload assemblies if a script has changed when focused. Then it would update exports in the editor before building, but idk if the editor can do that without building the source. |
Oh, I thought the issue was that the exported properties didn't appear after building. |
@neikeq Thank you for your response. I know from other threads that that's your plan, which is why I thought this issue should be relabeled as a feature request/improvement because it's not really a bug. @exts Exactly, yes. I also understand that this would require some reworking of what the editor does and probably extracting away the process that reloads the assemblies from the process that builds the project. Again, I don't think the original author of this issue meant for this to be called a bug; I think it's was inadvertently called a bug because it's a commonly expected feature of other editors, like Unity and Unreal. |
@lawsonry yeah, you should create a new issue and I think and @neikeq should close this one because that original issue is essentially fixed to the first problem. When the exports weren't reloading in the editor until you restarted the editor. Now building from the mono tab or play scene reloads them fine. |
The issue was that the variables didn't show up even after building. I'm not sure if it has been fixed or not, but I had also seen this a few times. I haven't had much time to work in Godot in the last couple of months, so maybe it's been fixed since then :) |
@NathanWarden I think it has been fixed. I've been testing v3.0.6 on both Mac and Windows, and in both cases, a rebuild of the project makes the variables appear. |
I'm closing this then. Feel free to open an issue about automatic builds. |
Sorry to revive this but it's still not working for me. It doesn't even work when I rebuild, or restart Godot. I can use hard-coded values in the meantime but I really like this feature and wish it worked. I'm running Windows 10, 64-bit. Godot v3.1.1 |
Okay, it updates but only if I changed the hard coded value. If I change the variable name it doesn't care. |
Fixed for me on 4.0 Beta |
Possible regression: this sometimes still happens, requiring a manual build to coerce the editor into showing the newly added exports. |
The issue reappeared indeed, but in specific contexts, for reasons related to changes in Godot 4. To leave this old issue closed, I'd recommend future reporters to open new issues, if possible with the more specific contexts causing the bug. For instance: |
This still occurs in Godot 4. However my work around for this is to run dotnet build in the root of my project which will show the exported variable. I've only tested this on Mac M1 but this may also work on Windows. |
Operating system or device, Godot version, GPU Model and driver (if graphics related):
Linux Ubuntu 16.04 , 3.0.Alpha (3-4 day old i think), R7 250
Issue description:
Script wont show references in Inspector if i dont restart Godot , and no support for Lists :(
Steps to reproduce:
Created new project, c# script whit export variable, added it to node
[Export]
public int ran = new int();
wont show in inspector, tryed switching nodes, starting stoping game, nothing worked until restarted godot. Possible cuz it was first added script, later adding more export variables, started showing after running game in editor
The text was updated successfully, but these errors were encountered: