this post was submitted on 05 Jul 2023
14 points (100.0% liked)

Godot

5915 readers
22 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

[email protected]

Credits

founded 1 year ago
MODERATORS
 

I have an addon for Godot 3 and I'd like to update it to work on Godot 4 without losing compatibility with Godot 3, I've done this in Unity using defined symbos (with #if UNITY_X_Y_OR_NEWER) I haven't found a way to do this, anyone have any idea?

top 3 comments
sorted by: hot top controversial new old
[–] Ategon 2 points 1 year ago (1 children)

The get_version_info() function in Engine tells you what version of the engine is being used. I personally havent used it since I dont deal with addon building much but it should work

docs: https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info

[–] freakrho 2 points 1 year ago (1 children)

the thing is the code won't compile, I might get around it with reflection but it's gonna be tedious

[–] Ategon 1 points 1 year ago

Ah yeah dont know how you would do it then. When im using addons ive mostly seen two different versions of the addons being made (one for 3 one for 4)