Godot Essentials is a project that makes C# development easier in Godot. This project allows enabling and disabling nodes virtually. This means methods such as Process
, LateUpdate
and FixedUpdate
, will not run when the object is not visible, and therefore inactive.
It is mainly a fork of: unity-godot-compat with many deletions and modifications.
- Add the
EssentialsAutoLoad.cs
to a node in your global scene (singleton). - Create a new TestScript.cs
- Write a simple "Hello Godot".
using Bigmonte.Essentials;
[Extended]
public class TestScript : Node
{
private void Start()
{
GD.Print("Hello Godot");
}
private void OnEnable()
{
}
private void OnDisable()
{
}
}
Some of the most commonly used methods of Unity are implemented. Such as:
void Awake () {}
void Start () {}
void Process () {}
Previously called Update, but renamed to Process to avoid conflict with an Engine function called "Update".void LateUpdate () {}
void OnEnable () {}
requires the use ofSetActive
methodvoid OnDisable () {}
requires the use of methodnode.SetActive (bool)
ornode.Destroy()
Example:
[Extended]
public class Ultra : Node
{
private void Start()
{
this.StartCoroutine(MyCoroutine());
}
private IEnumerator MyCoroutine()
{
yield return new WaitForSeconds(1f);
GD.Print("1" );
yield return new WaitForSeconds(1f);
GD.Print("2" );
}
}
- It is discouraged to change the Visible variable of Spatial or CanvasItem type nodes. Use for example
node.SetActive(false);
orthis.SetActive(false);
- It is discouraged to Use Free or QueueFree, use for example
this.Destroy();
ornode.Destroy();
for destroying objects.
Godot 3+
Feel free to point issues and help the development of this asset.
This project is licensed under the MIT License - see the LICENSE file for details
- Most of the intention of providing Unity portability was removed in this fork.
- This extension relies on one singleton to work.
- It may contain experimental/unsafe code