Im having an issue where whenever i type [SerializeFeild] type name then as soon as i press ; it automatically makes a new line and makes my codes look like this
[SerializeFeild]
type name;
instead of all one single line. how do i change this? my code still works and i can go back and delete the spaces in between but its just annoying and if i leave it, it doesnt look neat.
thanks for any help!
Hi,
You don’t place a semi-colour after the attribute. The semi-colon is to indicate the end of a statement/code block - Visual Studio will be being helpful by placing the cursor on a new line when you are pressing this as it assumes the end of a statement/code block.
Both of these examples are fine to use;
[SerializeField] \<type> \<name>
[SerializeField]
\<type> \<name>
There is no need for the above to be on one line, unless you want it to be.
Hope this helps
p.s. might just be in this post and not in your actual code, but checking the spelling of the attribute also, its “Field” not “Feild”.
thank you for replying but I do need the smi-colon, my scripts wont work without it. the issue im having is with my config params. for example this is what they look like right now
[SerializeField] float moveSpeed = 10f;
[SerializeField] float padding = 1f;
[SerializeField] GameObject laserPrefab;
[SerializeField] float projectileSpeed = 10f;
[SerializeField] float fireSpeed = 0.1f;
but i had to change all of these to delete the space in between them, because whevener i type in the semi-colon it moves everything after [SerializeField] to the next line.
im thinking there is a way in visual stuido to change this but im not sure where.
in case anyone else is having this issue, i figured it out. i was using an old version of visual studio, once i got a newer version it works fine.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.