+1 vote

Hello. I want to use a custom file extension for .res files but cannot work out how to load the file in the ResourceFormatLoader.

extends ResourceFormatLoader
class_name CircFormatLoader

func get_recognized_extensions() -> PoolStringArray:
    return PoolStringArray(["circ"])

func get_resource_type(_path: String) -> String:
    return "Resource"

func handles_type(typename: String) -> bool:
    return typename == "Resource" 

func load(path: String, _original_path: String):
    var file = File.new()
    if file.file_exists(path):
        file.open(path, File.READ)
# Cannot read the binary res file. End up with null return value
        var res = file.get_var()
        return res
        return ERR_FILE_NOT_FOUND
Godot version 3.3.2-stable
in Engine by (202 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.