0 votes

Hi I want to add a TouchScreenButton in my code, this is my code

var StartBtn = TouchScreenButton.new()
var normal_btn = preload("res://Load/startBtn.png")

when i run this i got an issue
Attempt to call funtion 'set_texture' in base 'null instance' on a null instance, how can i solve it?

Godot version 3.2
in Engine by (15 points)

1 Answer

+2 votes
Best answer

Hi, you should replace:



StartBtn.normal = normal_btn

Or if you still want to use the setter method, according to the documentation, the equivalent method for setting the normal property is set_texture


Yeah, I know, it probably should be called set_normal or setnormaltexture, but it is what it is.

by (56 points)
selected by

Thanks, it works like this StartBtn.normal = normal_btn

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.