#Help
1 messages ยท Page 1 of 1 (latest)
when i got to hit play to text if my new code works it just flickers off
Wdym flickers off
idk how to explain that's why i asked if i could call to screen share
u can send a video
did u try restarting?
ya
so when u press play unity just flickers like 4 times?
one time
Also every time I restart this comes up
this error: The associated script cannot be loaded, please fix any compile errors and assign a valid script
did u fix the errors in ur script?
I canโt find any
Iโve been following a video exactly
using UnityEngine;
public class Sanke : MonoBehaviour
{
private Vector2 _direction = Vector2.right;
private void Update()
{
if (Input.GetKeyDown(KeyCode.W)){
_direction = Vector2.up;
}else if (Input.GetKeyDown(KeyCode.S)){
_direction = Vector2.down;
}else if (Input.GetKeyDown(KeyCode.A)){
_direction = Vector2.left;
}else if (Input.GetKeyDown(KeyCode.D)) {
_direction = Vector2.right;
}
}
private void FixedUpdate()
{
this.transForm.position = new Vector3(
Mathf.Round(this.transForm.position.x) + _direction.x,
Mathf.Round(this.transForm.position.y) + _direction.y,
0.0f
);
}
}
(that's the code)
sanke != Sanke
sorry
did u configure ur ide?
did u configure ur ide
and r u using visual studi code or visual studio
vsc
how do i know if i configured the ide
sorry ๐ like i said very new to coding
If you don't know if you configured your ide, then you didnt configure it
#854851968446365696 has instructions on how to configure it
configuring it is like autocorrect for code and helps you identify problems
ok give me a sec
use visual studio
it is so much better
vsc is just a text editor
pretty much
visual studio is an ide
and is way better for unity
and to configure it you go into project setting you go to external tools and chose visual studio as the editor
๐คฆโโ๏ธ
How might I get to project settings
edit then project settings i believe
its either that or preferences
there will be something called external tools
donwlaod visual studio adn use visual studio
please download visual studio
it will make ur life so much better
trust me @cyan solstice
its so much better
Can we first try to get it to work with vsc then I can use the other
well now refresh vsc
close it and open it
im not sure if it has intellisense tho
i havent used it for this
that much
Ok Iโve reopened it
Sorry one second just trying something
alr
yay
can u show me the whole monitor
i need to see something about visual studio
good good
there you go
well ur all set
but i very much reccomend u use visual studio
but whatever floats ur boat
how might i fix the problems tho
unityengine is all of the errors
like that the top
remove .unityengien on line 30
not at the top
then all ur errors will go awau
did u save the script
Ya
Where is gameobkect
the gameobject the script is attached to
becasue it cant load the scropt there isnt an active instance
so you need to remove the instance of the script
then reattach it
there arent any errors in the code so it should be all good
it compiles, you run the game, then we are all happy.
int eh right
where is says script
inteh component area
press the 3 dots
and press remove componenet
then after u do that drag the script back ontp the thing u had it attached to before
and then ur code should run...
open up the script
the name of ur script
and the class are different
show me the script
line 3?
line 3
save it
then attach ur script
ur class name has to be the same as ur script name
show me the script
I donโt think so
Restart what unity?
Ok one sec unity takes a sec to reopen
alr
Alright itโs reopened
try and attach the script again
Still no
Ok Iโll do that
Ok
sorry ive been in here for awhile. i forgot cologne
Uthel is my boss
They can help us out
i checked the class name
Sorry guys I appreciate the help
the class name and script name are the same
no errors in the code
no other scripts besides this one
and the script wasnt previosly on the player when trying to reattach it
oh wait you already caught the caps
I also helped them configure their ide to check fo erros
yessir
i checked the script name and the script class. r u sure they didnt chagne it?
.
look at screenshot right below 'still didn't work'
can u link it pls
i dont see it
and here too
oh my lord
u spelled it correctly in the class
but not on the script
u have to either make both of them
Iโm pretty sure I fix the spelling mistake
I SEE THE PROBLEM
HAHAHAHA
U HAVE AN ISNTANCE OF THE SCRIPT ATTACHED
ITS A BROKEN INSTANCE
BUT AN INSTANCE NONETHELESS
lol calm down
HAHAHAHAHAHAHA
im so glad
lmao
xD
remove where it says script 1
press the three dots
remove component
then drag ur snake script back onto it
oh...
still nope
๐ญ
i need to finish some spanish hw rlquk
the problem now is still the same as before, you have compilation errors in that script
Copy the code here, delete the old script. And make a new one. Then paste it in
but as @vivid jacinth said we cant see any errors
using UnityEngine;
public class snake : MonoBehaviour
{
private Vector2 _direction = Vector2.right;
private void Update()
{
if (Input.GetKeyDown(KeyCode.W)){
_direction = Vector2.up;
}else if (Input.GetKeyDown(KeyCode.S)){
_direction = Vector2.down;
}else if (Input.GetKeyDown(KeyCode.A)){
_direction = Vector2.left;
}else if (Input.GetKeyDown(KeyCode.D)) {
_direction = Vector2.right;
}
}
private void FixedUpdate()
{
this.transForm.position = new Vector3(
Mathf.Round(this.transForm.position.x) + _direction.x,
Mathf.Round(this.transForm.position.y) + _direction.y,
0.0f
);
}
}
oml i never knew u could do csharp. i normally just do cs
its an old pic, i type cs ๐
.
should i try this
I'm seeing tons of compilation error, that script is an absolute mess
you need to configure your ide
and fix all the problems
and its not even the whole thing!
the ide is configured
im pretty sure the ide is configured
no
it said assembly csharp
they said that?
kihjgfsjkhdfks
oml
well i went through the process
we made it visual studio code in the external tools
and refreshed it
it was unsuccessful ๐
private Vector2 _direction
still wont compile
oh no wait thats fine
lol
Those poor braces :(
look at the errors
I think I was mistaken, it looks like its set up right
you just.. didn't do anything about the stuff underlined in red
those are errors, unity won't even look at the script if it won't compile
if anything is underlined in red, not only will the script not work, big red flashing lights and confusing messages will pop up calling you dumb
i'm really new to this so are the errors easy to fix
look here @remote fox this is why i am confused. it is configured. yet there arent any errors showing up
even though there are visibly many
they only showed up when i typed this.transForm
now there are ๐
I think in this case you can just remove the bottom two lines of the script. that one extra {, and the this.transform line
lemme count the braces real quick
oof I mean real slow
holy man they all over the place
yeah one extra one you don't need at the bottom
please i beg @cyan solstice use visual studio
we would not be having any of these errors
like showing up
when i attached that pic to u
the errors didnt show up
they would have in visual studio
I think here, perhaps it was a bug from initially configuring it
did you make him reboot? ๐
yeah
shrug, welp, it's workin now ๐
lol
either way i just like visual studio more
it feels nicer
idk how to explain it
ive only ever used vscode so I dunno.
i have many times
and it literall feels like sublime
but a little ide ish
did this
more errors noe
now
good! I like errors
transForm is incorrect
yes yes
no caps on the F
that should be it
omg it worked!!!!!!!!!
great ๐
@remote fox @vivid jacinth thanks so much
im sorry i took up so much of your time @vivid jacinth ๐
ya i was following this vid
so why did Cap F work in transForm for him @remote fox
bad tutorial, he probably edited out him fixing the typo
its all good
any way that i can help i will do it ๐
have a nice day and good luck on ur game
thanks