Can you do float + float
I want to do add a float to another float. Like this but this is not working. Can you even add floats? This is most likely a very dumb question. Note: I can not change this to ints for reasons.
c#
public float timestorer; public float timesaver;
timestorer += timesaver;
Answer by jgodfrey · Mar 08, 2016 at 02:09 AM
Certainly you can add floats. What you have above should work, assuming your two variables have been initialized to contain values. Here's an example:
float a = 9.1f;
float b = 0.9f;
b += a;
Debug.Log(b);
Its not working. This Is what I have so far. Time saver is not getting added up. Why is this? I can't have set numbers though.
float t = Time.time; t += timesaver;
That's going to take the value of "timesaver" and add it to the value of "t". The result will be stored back in "t".
What value is in "timesaver"?
What exactly are you trying to do?
Don't worry about it, I did it a different way. Thank you for helping me though.
Your answer
Follow this Question
Related Questions
float subtraction gives wild answers? 2 Answers
How to stop a big float value from changing to weird equations 0 Answers
How can I use a float Variabel in an other Sript? 1 Answer
How can I change this script so that each instantiated prefab spawns a set amount faster 0 Answers
create graph editior for values 0 Answers