.meta files |
Remove all .meta files |
On MacOS, search for .meta and delete. TODO: create a script for this |
[SerializeField] |
[Export] |
|
Auto serialized public fields |
[Export] |
Unity auto-synthesizes public fields. Godot does not. Add [Export] to fields you want to serialize. |
[SerializeField] List<Vector3> vectors = new(); |
[Export] public Vector3[] vectors; |
Export list for serialization |
void Awake() |
public override void _Ready() |
Unity calls Awake with random order. Godot calls _Ready in order from child to parent to root. |
void Start() |
No exact equivalent |
Requires custom solution |
void Update() using Time.deltaTime for time step |
public override void _Process(double delta) using delta parameter for time step |
|
void FixedUpdate() using Time.fixedDeltaTime for time step |
public override void _PhysicsProcess(double delta) using delta parameter for time step |
|
.zero |
.Zero |
|
implicit conversion between Vector3 and Vector2 |
Not supported |
|
[Range(0, 20)] |
[Export(PropertyHint.Range, "0,20,")] |
|
radians = degrees * Mathf.Deg2Rad |
radians = Mathf.DegToRad(degrees) |
|
degrees = radians * Mathf.Rad2Deg |
degrees = Mathf.RadToDeg(radians) |
|
Mathf.PI |
Mathf.Pi |
Pi (ฯ) constant |
Random.InitState(seed) |
GD.Seed(seed) |
Initialize random number generator seed |
Random.Range(min, max) |
GD.Randi() % valueRangeSize + minValue |
Generate random integer |
Random.value |
GD.Randf() |
Generate random float between 0-1.0f (inclusive) |
Color.red |
Colors.Red |
Color constants |
gameObject.name |
node.Name |
In Godot, the names of sibling nodes must be unique from each other. If you change the node name to an existing name it will be automatically renamed (From in-code documentation). |
rigidbody.isKinematic |
physicsBody2D is CharacterBody2D |
Test: Is kinematic |
new Vector2(spriteRenderer.size.x, spriteRenderer.size.y) |
sprite2D.Texture.GetSize() |
Get sprite size in pixels |
spriteRenderer.color |
sprite2D.Modulate |
Get sprite modulate color |
spriteRenderer.flipX = true |
sprite2D.FlipH = true |
Flip sprite horizontally |
spriteRenderer.flipY = true |
sprite2D.FlipV = true |
Flip sprite vertically |
[Tooltip("tooltip")] |
No equivalent |
Not available in C# for Godot. Documentation ("Currently only @GDScript has annotations") |
.x |
.X |
Vector types |
.y |
.Y |
Vector types |
.up |
.Up |
Vector types |
.down |
.Down |
Vector types |
.z |
.Z |
Vector3 |
.forward |
.Forward |
Vector3 |
.normalized |
.Normalized() |
Vector types |
.magnitude |
.Length() |
Vector types |
GameObject |
Node |
See Porting Problems section for more information |
Vector2Int |
Vector2I |
|
Vector3Int |
Vector3I |
|
DestroyObject(gameObject) |
QueueFree() |
Destroy node in scene |
transform.childCount |
GetChildCount() |
Get count of children for MonoBehaviour (Unity) vs Node (Godot) |
transform.localEulerAngles = new Vector3(0, 0, -newAngle.Degrees) |
RotationDegrees = newAngle.Degrees |
2D rotation |
transform.parent |
GetParent() |
Get node parent |
foreach (Transform childTransform in transform) |
foreach (var child in GetChildren()) |
Iterate through children for MonoBehaviour (Unity) vs Node (Godot) |
OnTriggerEnter2D |
Code Sample |
|
OnCollisionEnter2D |
Code Sample |
|
AudioListener |
AudioListener2D , AudioListener3D |
Audio |
AudioSource |
AudioStreamPlayer , AudioStreamPlayer2D , AudioStreamPlayer3D |
Audio |
GlobalLight2D , Light2D |
CanvasModulate , DirectionalLight2D , PointLight2D , LightOccluder2D |
2D Lighting |
using UnityEditor; |
Remove all |
|
using UnityEngine.XXX; |
Remove all |
|
using UnityEngine; |
using Godot; |
|
Debug.Log |
GD.Print |
|
Input Actions |
InputEvent /InputMap |
Godot Documentation: InputEvent |
Rigidbody2D as child component |
RigidBody2D as parent node or CharacterBody2D as parent node |
In Godot, the roles of ownership between a node and its rigidbody are reversed |
Unity packages |
Remove all |
Remove installed Unity packages from the Assets/plugins folder |
n/a |
partial class requirement |
Because of the way Godot builds C# code, you'll get a build error for classes that subclass a built-in Godot class and don't use partial . Documentation: Godot Interop With Source Generators |
n/a |
Godot type name conflicts |
If you have any types in your code that conflict with built in Godot types, use namespace to wrap them. |
Prefab |
Scene |
Godot Documentation: Where Are My Prefabs |