0 votes

Using Godot 3.2 on Windows 10

I am trying to get code from a reddit post on creating an ImageTexture through code. I modified the code to work for C# (below). I do not get any compile errors, but I get the following run time error:

E 0:00:01:0272 System.MissingMethodException: Method not found: void Godot.ImageTexture.CreateFromImage(Godot.Image,uint)
modules/mono/monogd/gdmonoutils.cpp:610 @ debugsendunhandledexception_error()

I can see the method both in the official 3.2 docs and here http://godotsharp.net/api/3.2.0/Godot.ImageTexture/#properties, I honestly don't know whats wrong other than possibly having an incomplete mono build? If that is the case how do I repair/get a working mono build?

using Godot;
using System;

public class tex : TextureRect
{

    public override void _Ready()
    {
        ImageTexture imgTex = new ImageTexture();
        Image dynImage = new Image();

        dynImage.Create(256, 256, false, Image.Format.Rgba8);
        dynImage.Fill(new Color(1, 0, 0, 1));

        imgTex.CreateFromImage(dynImage);
        this.Texture = imgTex;

        imgTex.ResourceName = "CreatedTex";
        GD.Print(this.Texture.ResourceName);
    }

}
in Engine by (18 points)

That looks like a bug with the C# version of Godot.
Does it work if you do imgTex.CreateFromImage(dynImage, 7);?

tex.CreateFromImage(image, 7); still produces the same error. I assume its missing in the 3.2 C# build or I have a bad set of bindings. I will try a reinstall later and see if it fixes the issue.

If the issue persists, report it in the issue tracker

After reinstalling the issue was resolved.

Hey, what did you reinstalled? The Godot Engine? Mono? Visual Studio? I'm having the same issue and can't fix it by reinstalling these.

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 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 webmaster@godotengine.org with your username.