0 votes


When I tried this code ;


It was not working in android But after I have changed code, like this;


It's work fine. So my problem probably arise from str() function. Ok I find some information and They told "Installing the newest export templates fixed it." I know after export newest templates work fine but I have compiled admob and play game services modules for android so I need to use them for project.

in Engine by (15 points)
retagged by

What Labels and what did you expect?
Any error messages while compiling android template?
Any logs on adb logcat?

Hello, I have found problem. When I tried this code;


It was not working But after I have changed code, like this;


It's work fine. So my problem probably arise from str() function.

2 Answers

0 votes
Best answer

As you mentioned, it works fine with up to date export templates, so you need to rebuild yours if you need custom modules.

by (1,958 points)
selected by

str() function work fine with this templates but not work after compile new templates without new modules or with.

If you build templates using the source code from the master branch, but try to use them in Godot, it won't work. You need to have templates that match your editor version.

Godot version Godot v2.0.4.1 but still don't work.

I have tried it with Godot Engine 2.1-rc1 and its work fine but this new templates compiled without my modules so I will add new modules and compile android again.

EDIT:Also everything work fine after using templates with Godot Engine 2.1-rc1. Thanks for helps @Akien . So my problem arise from versions.If anyone try to add new modules and compile for new template from Latest source code you need to use unstable version godot engine.

0 votes

str(): it seems that this function does not exists in GDScript....
Instead you must use:

 get_node("Label").set_text(var2str( number ))
by (1,486 points)
edited by

Hello, I get this;

I/godot   ( 4868): [1;35mSCRIPT ERROR: random: [0m[1mInvalid type in function 'set_text' in base 'Label'. Cannot convert argument 1 from bool to String.

I/godot ( 4868): [0;35m At: res://scenes/Questions.gdc:123.[0m

in logcat .what I am use str() or var2str() from each function.

Probably, your function argument is a boolean, it must be a number...

str() can convert booleans and numbers alike, so that's not the problem.

I am sure my variable integer.

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.