✅ Simple Semester Project
Rn im learning C# on Unity and i have a little project. in my game my character should throw a shuriken against a shield to deactivate it for 1s. Then i should be able to dash into the enemy while the deactivation is active. I tried using a bool which is located on the enemy, and gets false when the shuriken hits him and then the maincharacter can destroy him after dashing into him
26 Replies
What's the question here?
why isnt the connection working
Interesting choice of words btw :pepecoffee:
What do you mean by "connection"?
throw Shuriken = IsShieldActive false
dash while IsShieldActive ( in other Script) destroy Gameobject
Have you fixed the errors?
idk how
like should it even work that way
So instead of saying "something is not working"
You post the errors
sorry :( ive started c# like a week ago
After that, it's easier for someone to help you
There are two parts to this:
1. Make sure you got valid C#
2. Make sure your game logic is correct
We can definitely help with 1. and maybe also with 2.
Tbh you should not start with Unity
But that's too late now
so what can i do that i can make it easier for u to help me
In general, you post the code containing errors and the actual error messages
In VS, the Error List
(I think)
What SG said :blobthumbsup:
its german but it says unvalid token
Can you fix those issues or do you need help?
need help
Okay
So this is invalid because:
-
Shield
is not a static class and you can't access a member of a non-static class like that
- For the record: Shield
shouldn't be a static class so that part is fineShield is a Script i gave the enemy
That sounds correct
I think that's idiomatic when it comes to Unity
Can you get rid of the underlined code which I posted a picture of?
Just delete it because it's invalid C#
And rather use
ShieldScript
The question is how ShieldScript
gets its value. I am not familiar with Unity
You could try to get help here: $unity