Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform.
24
votes
Accepted
Avoiding string literals to reduce memory allocations
A string literal in C# will be compiled to string literals in IL.
Then the IL is compiled to machine (or to C++ and then to machine code if you are using IL2CPP).
On machine code the strings constants …
0
votes
How do i get key input using c#
Awaiting a key
I believe we can create a custom signal for this:
[Signal]
public delegate void KeyPressedEventHandler();
public override void _Input(InputEvent @event)
{
base._Input(@event);
…
15
votes
How can I structure my game like a "classical" program?
Finding the entry point in Godot
Godot has a different entry point and uses different binding for each platform it supports. Because of that, it does not offer access to any of the actual entry point …
2
votes
Accepted
How can I check if `call`, `callv` failed
Checking a method signature with reflection
I believe Godot does not have a means to check if a call failed...
But you can check your concerns before making the call.
If you are going to call like thi …
2
votes
Accepted
Why can't I access my custom signal under the SignalName subclass when trying to emit it?
What you need to emit a signal is an StringName. You should be able to confirm that by looking at the definition of EmitSignal.
An StringName is an internal string in Godot engine.
SignalName, on the …
2
votes
Accepted
Move object continuously along y with optional movement along x
Can you use Mathf.MoveTowards?
I believe it would be something like this:
var position = transform.position;
var step = velocity * Time.deltaTime;
position.x = Mathf.MoveTowards(position.x, targetX, …
14
votes
What's the appropiate way to achieve composition in Godot?
I have gone from a monolith player controller, to an state machine, to a behavior tree, to something closer to what you describe.
My current character controller looks something like this in the scene …
11
votes
Can I just convert everything in godot to C#
Pikalek answer is correct. I'll expand a bit about the performance and the translation process.
I want to point out that C# will give you more optimization avenues than GDScript, because C# has typed …
2
votes
Accepted
How to keep track of 'already happened' in-game events in (event cascade/chain of events)?
Using an autoload
what I imagine I could do, it's an autoload (persistent) scene that listens and saves every event-action (that is, only the events that could trigger more events) in an array.
Yes, …
2
votes
Accepted
How to check which Area2D's are overlapping with KinematicBody2D?
This is much easier starting with the Area2Ds. You can query each Area2D with overlaps_body. Something like this:
var areas := [$Area, $Area2] # perhaps get the list from somewhere else
for area in ar …
1
vote
Accepted
Are there feature/performance/platform limitations when using the Mono/C# version of Godot?
There are likely some bugs because it is a new feature
C# - the language - is well supported. Also, a lot of effort have gone into supporting ahead of time compiling, which allows greater platform s …
4
votes
OpenTK immediate mode on net core doesn't work?
OpenTK is discouraging the use of immediate mode. But it is still supported. To use it, you need to set NativeWindowSettings.Profile to ContextProfile.Compatability. That is, you want an entry point t …
8
votes
Accepted
How to wait until the frame is done?
Disclaimer: Mono Build? I haven't tried at the time of writing.
This is the GDScript 2.0 you would be trying to mimic in C#:
await get_tree().process_frame
Thus, I believe in C# it should say:
await …
1
vote
Accepted
How to implement a simple Scrollbar
I'm going to give values to Minimum, Maximum and Value from the way you want to use them.
We start with this code, where you use Minimum and Maximum:
if(Thumb.Position.y < Minimum) Thumb.Position.y = …
4
votes
Which method for creating a Loot chance, int or float?
We are talking C#, so I'll assume .NET. Thus you would either use System.Random.Next which works with integers, or System.Random.NextDouble which - as the name suggest - works with double. There no me …