.logik.
❔ I'm trying to convert a Vector3 string to a Vector3 but the numbers returned aren't correct.
The string methods you're using do not affect
StringToConvert
, they return an object which you're not saving to a variable.
Currently what vector3 = new Vector3(StringToConvert[0], StringToConvert[1], StringToConvert[2]);
is doing is vector3 = new Vector3('0', '.', '5');
which should likely be evident in your debug logs.
For example, StringToConvert.Split(',');
will return you a string array which needs to be saved to a string[]
variable. Alternatively just chain the methods and save it into a float[]
variable.
Also your LINQ is going to throw an error because you need to be parsing part
as opposed to the initial string.11 replies
❔ No Build Action option in Property pages
If you hit F4 or go to View > Properties Window, that should open a little panel on the bottom right of Visual Studio. Then by clicking the bitmap in your solution explorer you should get the options there
11 replies
✅ Index was outside of bounds of the array
Probably should be
morseIndex < morseInput.Length
in the for
condition. If you have 5 objects your loop will run 6 times for index = 0,1,2,3,4,5. If you change it to <
instead of <=
then it will only run 5 times.
However the way the index
variable is redundant because thats what the morseIndex
is doing.
Also there are operations that you're performing in the loop that only need to be executed once such as morseInput.Split
and declaring the char
variable.
You can look to move them outside the loop to improve the efficiency21 replies
✅ Help with non-nullable field must contain a non-null value when exiting constructor.
Great - thanks for that. I'm probably not going to use it because I agree that I should be setting the field directly. I'll do some digging to see when/if its ever appropriate to be using the property to set backing fields in a constructor. Appreciate your assistance!
13 replies