int someNumber = int.Parse(someString);
// or, to better handle blank fields or erroneous input
if (int.TryParse(someString, out int someNumber)) {
//do something with someNumber
}
normal.text takes a string, which means you need to convert your int into a string.
And since SetInt takes an int, you must convert your normal.text, which is a string, into an int.
Those are your clues on what you need to search for. But I would suggest taking a look at the basics to help you gain a bit more knowledge.
The internet is full of examples, but I can’t find one that looks like the one I have. Because I need to save that data and then use it in other scenes and perform mathematical calculations …
I can’t find how to use an inputfield + button to save and save it as numbers, because if it is not impossible to add, multiply … etc
And I am thinking of giving up and using another platform to carry out my project.
Sure, feel free to use another platform. And you’ll likely end up with the same issue, as every platform has it’s own ways of doing things depending on what language it uses. And you’ll still need to learn what to search for.
I have given you the exact things you need to search for. How to convert int to a string c#. How to convert string to an int c#. If you can find those two things, then you should be able to take what you learn and convert like crazy, display as a string as needed, save out as a string or int, etc.
Most likely there isn’t going to an example that does exactly what you want. Sometimes it requires you to break down your task into smaller task, find how to accomplish those smaller task, and then piece it together to get the bigger task. This tends to be where many new developers get stuck at. They tend to want the final product without knowing how to build the individual pieces.
Also note that @StarManta gave some additional info in his response as well.
Instead, you need to reason about your problem space.
Manta and Brath have both given you ample guidance to learn your problem space.
I’ll be more explicit. Here’s the relevant points of what you’re doing.
- each has a specific set of strengths/weaknesses/purposes/fitnesses
- there are many ways to convert between them (see Manta's post)
- PlayerPrefs can store integers OR strings equally well
- InputField only works with strings (input or output)
That’s it. That’s your ENTIRE PROBLEM SPACE.
Based on what you want to do, go work through many tutorials while keeping the above five points in mind. You will actually SEE your problem space in other tutorials, every single part of it.
Once you see examples of how to reason about each of the points in your problem space, you can begin to reason about your own choices in that space.
I fully share what you tell me. I wanted to do things with the unit because it reminds me of old-time flash programming. I can do it myself with no problem in AndroidStudio, but I was really looking forward to getting started with Unity. The problem is the little time available that my job leaves me, and perhaps my little patience. I really appreciate your time and the good intentions of your comment.