#💻┃code-beginner
1 messages · Page 595 of 1
You need to configure your IDE
it's not set up properly for coding with Unity.
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
And yes the error is because you declared your prefab as a GameObject instead of as an EnemyMovement
😭
not gonna lie, everything you're saying is like going above my head
so sryy but can someone lime walk me through step by step if you can
since you changed what you spawn your enemy as
EnemyMovement instead of GameObject you have to change the original declared type of prefab
the field for enemyMovementPrefab
public GameObject enemyMovementPrefab;
what does this line mean?
First step is to configure your IDE
follow the link above
We aren't supposed to help you until you do that
If your IDE isn't providing autocomplete suggestions or underlining errors in red, then it needs to be configured.
this will help you out
!vs
If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
guys im so lost - I can't get WebGL to grab text files from a folder with 3 different methods so far. 1. Just normally grabbing it from StreamingAssets doesn't work. 2. Grabbing it from Resources folder doesn't work. 3. Using UnityWebService to grab it also doesn't work, tells me accessing the folder is forbidden or something:
Any idea how to get around this? I know I can also set stuff in the inspector as TextAssets, but that is unreliable
how is setting stuff in inspector unreliable ?
Adding new word lists means I need to go an manually add it in for example
ohh alright
Also the occasional missing reference from messing with scenes and stuff
you're using UnityWebRequest just makes a get request yes?
yes
Application.streamingAssetsPath + "/WordLists"
btw use Path.Combine when doing paths, never manually concat them with slashes
what happened to using text assets instead?? load em with Resources.Load()
you can't use resource folder on WebGL to my knowledge
you can use Resources with WebGL...
also are you trying to grab the specific asset or just grabbing the folder?
every asset in the folder
hey guys can anyone help ? im trying to make a fps game but when i shoot the bullets they just keep stay put in the air , can anyone help ?
https://paste.ofcode.org/yiVSWYNu7ewVphQbiLV3SM this is the code for the bullets
you cant do that with a web request so what are you doing even
At this point try resources again correctly or have a serialized asset list for text assets
Log rb.velocity in start after you set it
What you can't do is use System.IO to reead files on WEBGL
in the inspector right ?
It would be quite difficult to add a debug log in the inspector
ok so i do it in the code right ?
show the webrequest code
That is normally where you write logs yes
okay so update, i already did have C, C# dev kit and unity installed
but just cannot find the preferences tab
its like missing on my end
yup thats only part of it
oh no its in Unity
mac is under Unity, on Win under Edit
it didnt work
As in nothing logged? If so, either nothing has this script on it, or everything with this script on it has no rigidbody
If it's the latter, you should be seeing the log you already put in place that would tell you that
Obviously, you would have checked the logs you intentionally added before asking the question, though
maybe i gotta change something in the inspector , any ideas ?
Well, do you get your log saying that there is no rigidbody on the bullet?
is there a reason you aren't just using a TextAsset?
O/P principle
well, yes, you have to modify the word list to add words
i added a rig-body to the bullet in the inspector , but i guess it aint working
You also have to do that if they're copied into a StreamingAssets folder
or modify the references to add more word lists
ig its stretching it a bit tbh
If the word lists must be fetched at runtime, I would completely keep them out of your project
Just host them separately
Show the updated code with the logs in them
i'm not sure how this would happen, beyond just randomly deleting your assets
which is generally a bad idea
https://paste.ofcode.org/U4zfcwvvksdvVeJZbA2tyy this is for the bullets
and this is for the weapons https://paste.ofcode.org/UuXhmNeh2gvGsnumKWMNyJ
wait a sec
https://paste.ofcode.org/zVFvNjJrDrD8JQnxkwiuyA here the bullet code
Okay, so, you don't get either log when a bullet spawns in?
what do you mean
the bullets do spawn they just dont move
Do you get any logs
do you know what Logs are for ?
no , i dont get any warning or errors
Then nothing with this script on it exists
Those specific logs don't print ?
Ensure that you do not have information messages hidden.
screenshot console window in playmode
all i get is this
Bullet Velocity: (0.00, 0.00, 0.00)
UnityEngine.Debug:Log (object)
Bullet:Start () (at Assets/scripts/Bullet.cs:42)
Jesus christ so you've had the original log the whole time?
Why did you say it didn't print
oof
Your velocity is 0, that's your problem
sorry im new to unity
You have no speed
if you don't know what something means, you need to ask about it, instead of trying to skip past it
When you multiply something by 0, it becomes 0
so i gotta fix the code got it
alright everything is configured
close VSC.
Click regen project files button there, then open script from unity
screenshot entire VSC window
ok there is an error
You need to download .NET Sdk, install it and restart pc
being downloaded right now
restart pc after
just to be sure, you have this vs code addon right? https://marketplace.visualstudio.com/items?itemName=visualstudiotoolsforunity.vstuc
k bet
they do otherwise it wouldnt have shown in Unity Preferences
its just .NET SDK missing
more specifically dotnet command
supposed* to fails 9/10
Hey guys, does anyone know how to work with Mesh Colliders? I need it for a school project.
do you have a question?
in a server full of unity devs, what do you think?
also this is a code channel.. #💻┃unity-talk and try specifying the actual problem
What specifically is the issue
alright good now, now it shows the red line underneath
nice!
now it tell you what the issue is in editor and also show all the classes you made, should be simple fix
nooo
other way around
Does your enemy prefab already have a script on it that contains the data you want?
why did you change it back to GameObject
What script has the .player variable
the prefab was declared as GameObject when you wanted it to spawn as EnemyMovement
i think my enemyMovement has a player feature
So, that is the type you want to use
not GameObject
not enemyMovementPrefab
but this
That is the type you want your prefab to be, and that is the type you want to store the result in
public Foo bar;
This declares a field named "bar". The field can contain a Foo. Anyone can see the field because it is public.
thats a different file tho, enemyMovement.cs is for the AI navigation and EnemySpawner.cs has the spawning feature
should i put it all in one file so that its not confusing
No.
In what way does that matter
You cannot put multiple MonoBehaviour classes in the same file.
It's also irrelevant, yes
let me give you a teaspoon
EnemyMovement enemyPrefab;
EnemyMovement newEnemy = Instantiate(
most of the time get GameObjectout of your habits
You can refer to a prefab as a GameObject or as any component type attached to its root object
i changed it to movement
This is also incorrect. EnemySpawner is not a variable.
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
EnemySpawner is the name of a type.
Should take tutorial session to a thread
Change the type of the variable
yes i changed it to EnemyMovement
if you don't know what that means, hit the basics
start with the pathways tbh it will go over this stuff
sticking EnemyMovement into the Instantiate call would also be wrong.
you're trying ride a bike downhill without ever having training wheels
it's very hard for us to help you if you don't know what any of these things actually mean
the instructure just gave us to do the roll a ball, didnt teach us anything beforehand
try the new pathways they are more structured, a bit of a slow burn and you already did most of the config parts in essentials, maybe to its ending lessons or go into the junior path it walks you through the steps a bit more
alright i'll try that
Does someone know how to use "decimal" ? Because someone said it rounds the numbers
They'd be wrong
ok but do you know what makes my number smaller
decimal is just a larger variable type than double so it can store more values
how? decimal is more accurate
What do you mean by making your number smaller?
that can be, I watched a 3 year old tutorial
like the number only gets to 285.84
what's it supposed to "get to"? What's the context? Is there math happening?
I see the code but I have no idea what the inputs are or what the expected results are
You have to remember we don't know what you're working on or what's going on. You need to explain
Are you referring to "how to print the value with fewer precision"?
yes
its the total price of a bill, like all values are adding to the total yk
no wait
its big mistake
Is this Unity related btw?
the thing is 0.01 is not a number that can be properly represented in floating point numbers
no but the c# didnt respond
So all these numbers with hundredths of a euro are slightly off
If you want accuracy with money etc you should use integer types
e.g. store long eurocents and do all your math with that, then format it as euros later.
!csds
Join the C# Discord server, a programming server aimed at coders discussing everything related to C# (CSharp) and .NET. https://discord.com/invite/csharp
how to just do that
Does anyone have a comprehensive tutorial on how to implement wave function collapse for complete beginners? i am trying to create a procudral backrooms map on a small plane, and i heard this is the way to do it.
there are pretty good videos explaining this on youtube , also there was a blog site I had b4 but forgot to bookmark link
ill try find it
I also read a few good articles...which I've forgotten about since then
whoops
My first implementation was not really based on a tutorial, though
yeah but problem is im a complete beginner in unity
You should start with something that is deliberately not optimal
no bit-fields, no clever tricks
Imagine something like this
public class WFCSlot {
public List<WFCTile> legalTiles;
}
public class WFCTile {
public List<WFCTile> legalNeighbors;
}
public class WFCGenerator {
WFCSlot[,] cells;
}
Each slot holds a list of legal tiles
When you place a tile, you throw out anything from neighboring cells' legalTiles that isn't in that tile's legalNeighbors list
Was it tile/grid based?
Yes -- it didn't learn from an example
I figured that would be way more annoying to implement
Ive been thinking of experimenting with non-tiled WFC
each tile had a set of adjacency rules (including rotations)
yeah i kind of understand how it works fundamentally, but i have absolutely no clue on how to implement/code it. tbf i wouldnt mind just copying someones code as this is for a school project and theres about a trillion different things i need to do
Ah, to me that is the main charm of WFC
Didnt get to implementing it yet, because it does sound annoying
But probably pretty rewarding when it clicks
it's pretty expensive (a 3x3 window is way slower than a 2x2 window)
I do want to try it out eventually
This guy did it with 3D shapes:
https://www.youtube.com/watch?v=1tgMl92DAqk
Pretty interesting stuff
So I'm Trying to make this model I made do some animations I got from mixamo, but said model isn't doing any animations like it did on the website and not following any code
oooh, thats very clever!
Hi, I'm not sure if this is this is considered beginner or advanced, so if my question is not fit for this channel tell me and I'll move it to the right one
I want to optimize performance by replacing a coroutine (IEnumerator) to an async routine (Awaitable), but my IEnumerator coroutine uses a WaitUntil, and I don't know how it would translate in an Awaitable
just use a while loop?
What am I doing wrong? I moved a static bool to public and refactored the scripts to reference it but it doesn't work
I just get a million null reference exceptions
Show !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
And what line has the error
how can we know without you showing us the code or what you did ?
We can't really answer that
static variables belong to the class itself not other objects from that class
unless you actually say what you're doing
ok I'll show the simplest script
& share the null reference error screenshot
public class Follow : MonoBehaviour
{
public GameObject Ball;
Vector3 ballPosition;
public Play Play;
public GameObject PlayButton;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void LateUpdate()
{
if (Play.play)
{
ballPosition = Ball.transform.position;
transform.position = ballPosition;
}
}
}
do I need the game object reference here or no
for what
for accessing a bool in the Play class
its static, it belongs to the class you don't need to make a field for the class
Is play static?
it's not static. I removed it from static
this pattern is also pretty bad
so I could make it just public
then yes, you do need a reference
ah ok
I mean, that's weird, cause I reference the class and drag the game object with the script
then I also need the object reference
seems redundant but ok
That is the object reference
yes for the component
it needs to know WHICH component on which object
And you get that by dragging in the object
since components need gameobject you always need to put it on a gameobject
If you're getting an NRE, check your scene for other Follow components (in the search bar) and make sure they all have something assigned to Play.
you guys are confusing me. I drag the object when I just write "public Play Play;"
So do I need the "public GameObject;" reference too where I drag the game object again or not?
Drag your object into the Play variable
Boom, now you have a reference
yea I did
same with ball
What line
you still didnt screenshot the error to show which line and which script
so if you put Ball in there (the field by drag and drop ) what makes you think Play is any different, just drag and drop object there
you generally dont want a field just as GameObject
you want it as whatever script/component on the object so you can start doing things with it right away instead of looking for component each time
Debug.Log($"Play is: {Play}";
OK now I only got the null reference exception on 1 object that is referencing
I restarted
and I got 0 errors
coolio
I didn't do anything literally
You probably didn't clear the error after you fixed it
yea but why did I originally get an error every frame, but then stopped getting it without doing anything at all
fkn unity
maybe the restart fixed it
didnt you say you made it static at some point ?
That's not possible. Either you didn't save, or you didn't wait for the recompile, or you didn't clear the error.
once you made non static thats when it probably went NRE
I did and decided to make it just public to reset it between scenes
I've heard people say that errors "just went away" or "just appeared" without them doing it it. 100% of the time, they were incorrect
I mean I could do that anyway but ok, I wanted it "clean" whatever that means
yes exactly thats why it went From no errors to NRE
Especially considering the variable has exactly the same name as the class, so it would still compile after making the change
static variables belong to the class itself so they dont need instance reference
I commented it out until I fixed it by referencing it and all that
yea I know
I commented out all the lines referencing it until I put in the necessary references
but ok whatever it works now
I was frustrated because I thought I didn't know something but I did lol
unity has its quirks too
this is entirely a behavior of C# , though
if i had a nickel for everytime someone blamed the Unity Editor.. I'd be Scrooge McDuck 🦆
(and it's very normal)
the drag and drop part
btw you can [SerializeField] private so you don't need to make everything public , this will also show in inspector. Its good practice to not accidentally change things from other scripts when you forget in future what you're accessing
^ facts.. keep things private until you need them not
I tell myself before i start drinking...
lmao.. over-sharer eh?
hank hill showing his buttox in the elevator good episode..
how do i get over a breakup in c#
By posting somewhere else
yes sir
So I'm Trying to make this model I made do some animations I got from mixamo, but said model isn't doing any animations like it did on the website and not following any code
make sure your rig is compatible
and its rigged correctly..
check the animator to see if the clips are actually playing (during run-time) first
#🏃┃animation and probably move here <-
I've made a seesaw that I want the player to be able to use by standing on it, but the player uses a character controller and the seesaw works with a rigidbody. Is it possible to make them work together or will I have to change my player, since it doesn't really use physics?
You could manually compute the mass it would exert and use AddForceAtPosition to press down on one edge of the seesaw
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Rigidbody.AddForceAtPosition.html
https://www.youtube.com/watch?v=VQbG9dnkVgc ive made a video specifically bout this w/ a rope bridge..
my CC is kinematic so i had to use raycast and exert forces down onto the rigidbody planks.. it would work similar w/ ur seasaw.. just apply the force downwards at the players position... as Digiholic mentioned
good luck 🍀
What's the equivalent of lua's local/global variables in c? I thought it was private/public but those seem to constrict access to class/across classes respectively, and are both evaluated at runtime which is not the behavior I want. I want a function-scoped variable that is initialized when reached, and script-scoped variable that is initialized when reached.
Also, stackoverflow says variables are tagged "private" by default, but I don't believe so.
Declaring variable with private gave me image 1's error: A field initializer cannot reference the non-static field, method, or property 'PlayerCamera.SensitivityX'
Removing the private cleared it up
Whether they are inside or outside a method
So I can't make a variable declared inside a method accessible outside of it?
Declare the variable outside the method
That would replicated lua's "global" behavior right?
No idea
you should look up how scope works
Then there can't be another separate variable in a more refined scope?
I refuse to use 1-indexed languages on principle
If I declared outside method, then wanted a different variable using the same name inside a method, would that not be possible and still reference the method I declared originally?
If you declare another variable inside a method with the same name, then you would be referring to that variable whenever you used that name
You could reference the field variable with this.
Oh so that's how it works thanks
One more question though, what's the syntax for dictionaries in C? I'm assuming Unity doesn't have their own version of C
unity uses c# not c, they are very different languages (despite c# being based on c)
notably, a local variable, declared inside of a method, doesn't exist on the class at all
whilst a field, declared directly inside of the class, is part of each instance of the class
How do i parse data from json? I've got a response from an api that looks something like this {"playerName":"ben"}, but i cant figure out how to separate this out so i can get the player name by itsef
For simpler applications, you can use JsonUtility.
Whether you use JsonUtility or opt for Json.NET, you'll need to create a class that matches the shape of your data
hold your horses, with newtonsoft you can just parse and modifiy the AST 😉
I already have a class that i use to serialize the data earlier, could i use that? Does it have to be setup in a specific way?
if you're already serializing it in your c# code, then use the exact same thing to deserialize it
then wtf did you mean by "I already have a class that i use to serialize the data earlier"
can someone please help me with me ? im trying to make this enemy right ? but the code wont do shit , he wont play any animations , my enemy just says put , i dont think it has something to do with the code
i got a warning saying " Failed to create agent because there is no valid NavMesh"
can someone please help ?
suggest you read the documentation & examples in the link posted above, this should clear things up a bit
I don't have to serialize it for some reason, it just does it
While that error won't have anything to do with animations it will mean your nav mesh agent isn't going to do anything.
If you want to use a NavMeshAgent it needs to be on a NavMesh
This is all the data class is
i also got a error saying
MissingComponentException: There is no 'AudioSource' attached to the "ZOMBIE" game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object "ZOMBIE". Or your script needs to check if the component is attached before using it
but i did add a audio source , and that means the script works and that is detecting the player , but something wont let him do what he is supposed to do
Well then, that would mean that There is no 'udioSource attached to the "ZOMBIE" game object, but a script is trying to access it.
You probably need to add an AudioSource to the game object "ZOMBIE". Or your script needs to check if the component is attached before using it
I would expect there to be a corresponding method that retrieves a score and gives you a metadata object.
Somewhere you have a copy of that script on an object that doesn't have an AudioSource.
Yeah it is just plain json
ah, yep, a string
You can use JsonConverter to deserialize it.
Although, somewhat interestingly, the documentation examples are using Json.NET. See here -- https://docs.unity.com/ugs/manual/leaderboards/manual/tutorials/unity-sdk/add-new-score
JsonConverter is built into Unity. JsonConvert is from the Json.NET package.
fixed the audio part , but got a new error saying "SetDestination" can only be called on an active agent that has been placed on a NavMesh."
Ah, so it might be worth using jsonconvert then
Im guessing thats what they do inside the leaderboard method
You should not use JsonUtility for dealing with web APIs
json utility is a minimalistic serializer that has zero convenience
If they do, then you'd absolutely want to use Json.NET's JsonConvert to deserialize it
Yeah ill use that then ty
(and in that case, it should already be available in the project)
Yes it is i didnt realise it wasnt in the standard library
a lot of unity packages install/use it as a dependency
You can only call SetDestination on an active agent that has been placed on a NavMesh
Sound, that seemed to work ty
sorry but i dont understand
In order to call SetDestination, your agent needs to:
A) Be active
B) be on a NavMesh
so my navmesh inst active ? here is a screenshot of my navmesh in inspector
that looks like a navmesh agent
Did I say anything about the NavMesh being active or not?
Also, this screenshot does not show anything about a NavMesh
(in fact, a nav mesh can't be "active")
click on bake on the NaveMesh
actually, this is wrong! good thing i had a look, haha
disabling a NavMesh Surface component causes its navmesh to go away
Did you set up a NavMesh surface? https://docs.unity3d.com/560/Documentation/Manual/class-NavMeshSurface.html
The Unity Manual helps you learn and use the Unity engine. With the Unity engine you can create 2D and 3D games, apps and experiences.
a NavMesh Surface component is used to bake the navigation mesh
one must be presesnt (and have been baked)
or else there is no data for the NavMesh Agent to use
NavMesh Components make up the navigation system in Unity. The navigation system allows users to create characters that can intelligently move around the game world, using navigation meshes that are created automatically from your Scene geometry. Dynamic obstacles allow users to alter the navigation of the characters at runtime, while off-mesh l...
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
This tutorial is out of date.
It's for older versions of Unity that don't have the AI Navigation package
and thus don't have things like the NavMesh Surface component
i was able to bake it , but i think the enemy is falling of the floor or something , he wont appear when i test it
Where do they end up? Look in scene veiw and see what's happening
you can select the object and hit "F" to focus on it in the scene view
I remember having a fun time with this during a game jam. We were spawning enemies at...interesting positions
sometimes they just exited the map
bye-bye
i saw him flying of the map , i guess i gotta add a rigbody add gravity and then it will work
ok i just tried that and now he flies up moves abit and then goes down , i have no idea whats going on now and no idea how to fix it
no errors appear
Gravity does make things fall. If it's going through the ground, does the ground have a collider?
i forgot to say that the enemy goes up flying , walks abit and then falls to the void
You might need to capture a video of what you're seeing, or post !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
theres navmesh gizmo's when u have an agent selected that might be some use
i reallly dont know whats the problem here i have these animations for a bow i made and everything works great untill i shoot the bow to explain(i made it o when i release the PlayerAimShoot(rightclick) the bow will return to idle pose and it works when i relase it goes back every time but when i shoot the bow now goes back on its own every time i try to aim in the middle of the animation even tho im still presing the rightclick so it souldnt be possible right idk someone tell me what am doing wrong. i can send a video of it happening if needed.
u definitly should post here that video and also share code of PlayerAimShoot
and PlayerShoot
imo it'd be a nicer setup with
a bool isAiming and a single trigger called Fire or something
could make a more tidy animator.. and have the states do their thing..
it'd be more automatic than controlling every aspect of it w/ triggers..
TLDR: too many triggers for my liking..
i would just Play those animations instead of maintain so much of triggers
you'd use one trigger and then let the state machine do the rest of the transitions
^ having multiple triggers and laying it out the way u do.. imo is asking for trouble
well maybe one trigger to draw, another to release
i think a bool would be better for drawing..
that way u could release and have it transition back to idle.. w/o having to worry about resetting the trigger or anything
yeah it would handle the draw but then undraw without shooting the arrrow case well
ill try it
yea but the bow and the arms have difrent animator conttrolers
u could do the same w/ both animators
if u use the same naming convention u could even loop thru them w/ a single line of code
forgive my crap mspaint skills
haha no wories
but also my fire animation is made to go back to the idle position so is the trasition from fire to idle needed?
go in play mode, make pause and check in the scene view your agent
basic test with plane, NavMesh Surface, Capsule with NavMeshAgent and SetDestination on start work directly
u can send it back any way u'd like.. if it has an exit time.. and a transition (it doesn't even need parameters)
it'll follow the transition.. just less work i was thinkin
thanks sm
this is the gizmo's i was talkin about.. external
would be helpful to see in realtime what ur nav agent is trying to do
i have no idea how to fix this
Can you show the !code for that object's movement
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Can you show the inspector of the Zombie object?
It looks like either you have an animation with root motion, or it has a parent and child that both have a rigidbody
Remove the Animation component. It's unrelated but you shouldn't be using it, you already have an Animator
Does this object have any children? Do any of the child objects have Rigidbodies?
i checked but none of them have rigbodys
Can you show a screenshot of this object on the NavMesh? With the collider gizmo visible?
like this
Looks like your collider is embedded in the ground
It should probably be on the ground, instead of in the ground
Also, you might want to re-bake the mesh because it looks like that collider actually stopped that ground from being considered "Walkable"
i rebaked it , good news it stoped flying away , now it justs disapears before i can see it
While playing, switch back to scene view, select it in the hierarchy, and press F
yeah the enemy is falling into the floor
Does your floor have a collider
a NavMesh Agent does not depend on colliders -- it just snaps to the mesh
However, the Animator could be controlling the position of the object
which would cause everything to go haywire
But this also has a rigidbody on it, so maybe getting rid of that is the play
or at least disabling gravity
oh, yes, that's going to make it fall straight down
I would suggest setting up your character like this:
- Character <-- NavMesh Agent
- Model <-- Animator
the Animator can do whatever it wants with the model object
so the animations should only be on the model not the character ?
Where can I learn simple fps movements?
is there something wrong with the model ? i tried everything but he always just falls to the floor , i even added a capsule colider
The model doesn't matter at all.
turn off the Animator and remove the Rigidbody completely. The object should stick to the NavMesh.
did that , i just saw it clip into the floor and fall
Deactivate every child object so that there is nothing but the "ZOMBIE" root object. Also turn off your "Zombie AI" script.
Hey I'm trying to put in a background but the camera just doesn't see it. Can someone help?
how are you trying to do this?
I put the image into the game as an object then it into a background layer which I then put above the default layer
"as an object"?
Show me exactly what you did
i'll need to see screenshots of the inspector for the background object
Turn off 2D mode and the problem should become apparent
if it's not obvious after doing that -- compare the Z position of the camera and the background
Ah I see thanks
Sorting layers will only matter if two sprite renderers are at the same depth from the camera, btw
the only child objects are parts of the model and the navmesh surface
...well there's your problem
the navmesh surface is not supposed to be attached to the character
attach it to an empty object
ideally, I'd parent the rest of the level to that object, then set the surface to only look at things in its current object hierarchy
Why is there a Navmesh Surface on this zombie
i turned off everything beside the model and now it just stays put in air , obviously
so he can find the player ?
you've glued the entire world to the zombie
What does a NavMesh surface have to do with that
What does making the zombie a walkable surface have to do with finding anything?
im so confused by what bound.min and bound.max are even for on box colliders in code. I need the closest value to the world origin and the largest value away from the world origin, which thats what i thought the bounds.min and max were, but they arent even close, just giving max and min y ig? the x and z values arent at the corners like i thought, and i have to use center - size/2 and center + size/2. What are they used for, i mean why have that value exposed?
They could be used for easy aabb testing. You check if a point is within bounds with min <= point <= max
im saying you cant use it for that bc they dont do the minimum x and z, and max x and z
Who says what?
wait, no matter how i do it i cant actually get the bounds
Sounds like a different problem then
the max and min both return positive, even when doing 1 - 2
ahhh absolute values, rip me ignore me i know what the problem is, completely didnt think of it
Should also note that collider(maybe other too) bounds are in world space, so there's nothing wrong with both min and max being positive.
yes, but i need the one collider encompassed completely in all axis by the bigger collider
so i need to check that its bigger xyz then the min bounds, but lower xyz then the max bound
I have this in Update()
int distance = target - current;
float current = Mathf.MoveTowards(current, target, distance * Time.deltaTime);
How do I calculate the time required for current to reach target? Does it depend on distance or is it a constant?
distance = rate * time
therefore:
time = distance / rate
although your code is using the distance AS the rate
which is weird
and it means it will NEVER actually reach the target
I would expect the code to look more like:
int distance = target - current;
float current = Mathf.MoveTowards(current, target, speed * Time.deltaTime);```
also you should most likely be doing Mathf.Abs to the distance to get the absolute value.
but why would you want to do that
to check if any is negative
if theres a better way to check if any value of a vector3 is negative, please let me know
i don't even know the purpose of doing that 🤷♂️
to check if something is inside of a set of bound coords
just create a bounds and use the Contains method
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
ah, contains method. i legit read that 1h ago and just, forgot it existed when setting up my code
thats on me entirely
https://paste.ofcode.org/QuddHhycTFugrTDgtk5v3h does anybody know if im doing this correctly im trying to have a mainclass that has a soundmanager right now and i want it to work like this basically MainController.Instance.SoundManager.<any public functions>; basically like a singleton that can be accessed anywhere
this is super cursed. why does MainController access SoundManager to do things when SoundManager inherits from MainController?
idk i was trying inheritance but i guess i screwed up
also for future reference, you can use more than one link to share more than one class instead of shoving it all into one link so that it's harder to navigate between the two classes. or you can use paste.mod.gg which supports more than one file per link
oh ok thank you for the tip
any suggestions on how to fix it because im not sure tbh
I would suggest looking up how to properly implement the singleton pattern then not have SoundManager inherit from MainController if MainController is going to be using SoundController
although this whole interplay between these singletons really feels like it's going to lead to a horrible web of singleton abuse
got it thank you for the feedback
Shouldn't the script on assets allow to modify the default superclass parameters?
You can but not scene objects
What do you mean?
Oh I thought you were asking why it wouldnt let you modify
Yeah, I mean why the parameters of the superclass are not showing there
They show once assigned as a component
I've been wondering this also
why cant i add such function to button
public void setmode(int mode)
{
usemode = mode;
}```
i clearly see other functions from list having parameters
like UI button onclick ?
did you drag the one from gameobject
If i want to move i cant move
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
(for error, not code)
https://screenshot.help
don't use photos to share screenshots.
Use links when sharing your code
you should also configure your VSC looks not configured
!vscode
what is "all this " ?
you have to be specific
if you are confused about something, ask
you have a few things to do.
- configure your IDE (code editor) vscode because its required to get help here
- Screenshot the error properly because it seems unrelated to code you posted
did you do win + shift + s ?
yes
it should be in your sidebar
and Ctrl V in discord
i mean you could also SS sections cropped too but good enough
error seems related to Version Control
if you aren't using it just remove it in package manager
before you do screenshot it , wanna see something
screenshot is fine lol
ok waht i have to to now
only this there
yeah the newest version is borked i guess
idk restart unity or just remove this package if restart doesnt help
can you help me to reinstall
Okay, what does that even mean? I never got that exception
Am I using this wrong?
can you help me to re install
just remove it
ok wait
if you want version control use git
i have remove what now
what console#
where is console
ah i have
but there is nothing in
i cant move
i cant move my char
thats unrelated, is the previous error gone and not showing up
this error is gone
send script according to #💻┃code-beginner message
and show where you put script in the scene
so use any of them ?
Unity Version Control
Git
Get the latest .gitignore file from here. It should be placed at the root of your Unity project directory.
the same script you said isn't working
use one of the links, copy and paste code there, save and send link
ok
using UnityEngine;
public class Movement : MonoBehaviour
{
// Bewegungsgeschwindigkeit
public float moveSpeed = 5f;
// Update wird einmal pro Frame aufgerufen
void Update()
{
// Holen der Eingabewerte (WASD oder Pfeiltasten)
float moveX = Input.GetAxis("Horizontal"); // A/D oder Pfeiltasten links/rechts
float moveY = Input.GetAxis("Vertical"); // W/S oder Pfeiltasten hoch/runter
// Berechnung der Bewegung basierend auf der Eingabe
Vector3 movement = new Vector3(moveX, 0, moveY) * moveSpeed * Time.deltaTime;
// Anwendung der Bewegung auf das GameObject
transform.Translate(movement);
}
}
here
are you fr ?
what
yes i have
alright goodluck with this bs
```cs
// Code
```
Moment
mate ur frustrating to help , I told you what to do a few times already you managed to somehow make it worse each time
scroll up you will see
also sending a screeenshot of the page after telling you this is like giving me a big "F you"
okay its pretty clear you need to start here
https://learn.unity.com/pathways
Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.
this is gonna be all night with this , got no energy to explain the basics of the editor
hint : components need to be on gameobjects to do something in playmode.
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
how i can see my unity version?
In the hub when opening the project
ty
Hello im new here
Hi new here
I have a question
if its code sure
Then you should !ask it
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696
otherwise #🔎┃find-a-channel
It’s about me , i mean i was making games 3 years ago and i got my certification for game dev but since that i stopped doing coding u can say i stopped doing this but now i want to start again , I don’t know where to start again
Any suggestions
!!
Hi all, new to unity. Im trying to make a script that changes a sprite to another sprite when it collides with a certain object but have no idea how.
Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.
i scoured everywhere but it seems like there are only tutorials for SWITCHING places on collision
OnCollisionEnter then with having a reference to the sprite renderer you switch the sprite to whaetver sprite you want, you need to make a field for this too
That's half the work, detecting when something collides.
i have no idea how to write that
So your question really is, how do you change the sprite at runtime, which you just get the SpriteRenderer component, and change the sprite property on it.
im terribly sorry but i legit have no idea how to comprehend any of these
you do have to learn the basics like referencing components and accessing their properties and methods, stuff like that
also the docs shows example for each thing you need
how i can learn here?
Been following this tutorial and this is supposed to show a "press to interact" UI then remove it, still very much so learning so I'm not sure what I'm doing wrong
remove the ()
also !ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
That did it, thank you!
What am I looking for specifically with this?
Your error you see in unity should be underlining red in the editor, since its not you need to configure it properly with unity. click one of the links follow the steps
Oh! Awesome, thank you!
btw do you know this worked because difference between
function() function call that returns a result, your case void
function is a delegate , a reference to the method basically
I did not know that
Can you call charactercontroller. Move multiple times in update loop
you can but you typically shouldn't
try to combine all your velocity and dir into 1 call
multiple calls can give unexpected result
Okay thanks
One issue with using just one move call is that if I am near ledge to a declining slope and put a lot of forward velocity it flies off instead of sticking to a slope. How would I go about solving this?
so my character is falling through the plane and its driving me nuts! heres the script for player movement if anyone can help me fix my code if thats even the problem. another thing is my character crouches really slowly but thats not 1st priority for fixing it rn.
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Don't screenshot your code and use ^
From your code your moveDirection.y never resets and only accumulates
Okay, I got it working based on that video. Previously I used projectonplane on slope and had issues, but issue could have been anything
Similar to before, I'm following this tutorial and this script is meant to start the cutscene, but it's not letting me add the script to an object and says "script class cannot be found"
what does this error mean when im opening my project?
you need to start by configuring your !IDE 👇
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
I downloaded the manual one, but it's not showing up in the preference tab's dropdown menu
that means there are compilation errors in the project. if the compilation errors are in your own code then it's typically safe to just ignore it and then fix the errors when the project loads. if you are unsure where the errors are from go ahead and enter safe mode so the editor doesn't break and you'll be able to see what the errors are so you can address them.
wdym by "i downloaded the manual one"? you are using vs code
I downloaded the one with "installed manually" next to it, then went to use it and Unity wouldn't recognize it
Just restarted the program and it's running now
so you went and installed visual studio? because your screenshot showed vs code which is an entirely separate program
I have visual studio now, yeah
ik your helping someone else rn but i have no idea what this error means 😅
great, so get that configured then
seems like you have private on something that cannot be private. and considering it's line 1 that's probably on a using directive which is definitely not correct
Are you trying to make your class private
I set the preferences to that now that it's working, but clicking on my script is just opening the program and not the script itself
that isn't the only step to configuring visual studio
i understand now. thanks so much!
Tried opening a script now and the program just says "This operation could not be completed"
make sure you have completed all of the configuration steps, then if the issue persists try restarting everything (including pc if necessary)
What other configuration steps are there? The link in the !ide thing sent to me a page, I followed everything it said on there across a few pages, and It's not changing
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
wdym "across a few pages"? the configuration steps are on one page.
and if you have completed the steps, then i've already told you what to try next
ok so it was the easiest fix ever except for one thing, my player is slowly falling through the floor still, even though i thought i fixed it
make sure both objects have colliders and that you are moving the player in a physics friendly way
i did exactly what you said and this is still happening
ok well the video is very laggy lol but you get the point
i mean, i really don't considering nothing of value is being shown in the video
im slowly falling through the gound and i already checked if they have colliders, plus i am just walking on a plane object so im not walking non physics friendly.
show the relevant objects and how you move the player
bet, let me download obs real quick so its not as laggy lol
just screenshot the objects, i don't need a video of the inspector
I cant move my char pls Help im new
https://screenshot.help
also !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
OK WAIT
it also appears that you have compile errors which you need to address
Your editor is not configured. You have to configure your !ide before we can/will give you help.
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
yes pls help
great job ignoring the code sharing instructions
at least vs code appears to be configured in that last screenshot though
What editor do you use?
If Visual Studio, and you downloaded it from the Unity Hub, press • :visualstudio: Visual Studio (Installed via Unity Hub)
If Visual Studio, and you downloaded it manually, press • :visualstudio: Visual Studio (Installed manually)
If Visual Studio Code, press • :vscode~3: VS Code
If JetBrains Rider, press • :JTRaider: JetBrains Rider
Yeah, noticed it now. Not sure
i use editor visuel stodios code
fused
can you help me in a talk
i dont understand
hint: check your unity console
here
then there is something you are not showing because you have a public float variable which should appear in the inspector but was not in your previous screenshot
that indicates that either you've gone and made two components called Movement or you have compile errors. and since unity doesn't show any compile errors, i'm leaning toward it being the former issue
and what i have to do now
read my most recent messages very carefully
idk what is all this public float
then start smaller, there are beginner c# courses pinned in this channel and the pathways on the unity !learn site are a good next step after that
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
So I got visual studio fully configured, and now my only issue is the console error about "interactable could not be found" from my previous message
This one
Old screenshot
okay and do you have a class called Interactable
idk
that was not in response to you
This still does not appear to be configured. Please follow the Visual Studio Code link from the bot message to configure it.
ok
Like I said, i'm following a tutorial and I've been building this from scratch in line with the vid, which was also from scratch. Haven't added anything he hadn't, and he never touched on classes. Wouldn't know where to start looking
visual studio has a search feature you can search the project with to find out if you do have a class called Interactable
nobody here even knows what tutorial you are following so that's really the only advice that can be given with the information we have
can we go in a talk?
this script is guaranteed to run only in editor mode, can this coroutine run?
[ExecuteInEditMode]
public class UpdateTextAreaDimension : MonoBehaviour
{
public void UpdateDimension()
{
GetComponent<LayoutElement>().preferredHeight = -1;
StartCoroutine(Refresh());
}
IEnumerator Refresh()
{
yield return new WaitForSeconds(0.5f);
GetComponent<LayoutElement>().preferredHeight = GetComponent<RectTransform>().rect.height;
ContentParent parent = GetComponentInParent<ContentParent>();
if (parent != null)
{
parent.RecalculateDimension();
}
}
}```
Why? This chat works fine. Best I can do is make a thread
yes
i guess i dont need the coroutine
what is a thread
shoot
just so you know that ExecuteInEditMode attribute isn't doing anything there considering there are no monobehaviour messages
i need code review, it worked but very ugly. it's to determine whether a recipe is "identical"
A tool for sharing your source code with the world!
Send a new screenshot
from?
Your editor window
Used the search, found a class called 'Interactable1' instead, changed the script to match that, and got two new errors
boom
does Interactable1 have a virtual method called activate on it?
i think this is a common problem that should have already be studied and solved properly, but i dont know the words to google. this is what i can came out with.
why does the player have a mesh collider on it? the CharacterController is the collider. also i'm not 100% certain since i don't typically use it, but i don't think the CC plays super well with non-convex mesh colliders so the ground collider should either be marked convex or just be made into a box collider considering the ground is just a plane. you also appear to have a broken script on the player
well, i was thinking that aswell but i had to be sure so i added that idek why, im just doing stuff to try and fix it and the broken script is just a useless script i dont use, idk why its checked or even in the components.
so remove it
yea i did but im still having the problem
and did you read the rest of what i said?
no
my guy, i'm not in a conversation with you
no
Found the issue by changing the original class in the script to just Interactable, matching the name of the script and the class I was trying to reference. Seems to have done it
bet
can any1 help me? i cant move im new
removed the mesh collider and replaced it with a box collider and its still not working, also im now getting this error
that error is unrelated, it is from the version control package. if you aren't using that package you can remove it, otherwise just clear the console and move on
anyway, if it is still not working then show the relevant !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
oh bet that
like send the code you mean?
Thanks for the help @slender nymph, issue is fully resolved now
what else could that possibly mean?
lmao idk
A tool for sharing your source code with the world!
i was told to use this
so heres the code
yes. and for future reference, do not click "Basic" before sharing the code, just click save and share the link in your browser. selecting "Basic" removes all syntax highlighting
oh, my bad i never used this website lmao
so throw some logs in there to see if it is correctly detecting ground
can any1 help me i cant move im new
bet
I would recommend using breakpoints and stepping through the code, if that's something you're familiar with.
show the inspector for the object with this component
Is this an old screenshot? How is it still not configured?
Verify the code even compiles to begin with by logging a message in the console from this method. https://unity.huh.how/debugging/logging/how-to
it is correctly detecting ground
show how you have actually determined that. because if it is detecting the ground correctly then it shouldn't be moving you through it
how i can?
you've been posting almost nothing but screenshots this entire time and suddenly you don't know how to post a screenshot?
i'm just gonna go ahead and drop this advice again and stop engaging: #💻┃code-beginner message
and the answer to that screenshot is still this: #💻┃code-beginner message
well im using raycast to check if the object detects the floor
since when?
that was not in the code you showed previously so when did you add that?
and where are you actually using it
well for one thing, that isn't actually doing anything so you aren't even using it to detect ground
and another, if you're going to completely change a fundamental part of the component while receiving help you should share all of the changes
huh? it put in the console "Ground detected". also my bad
that doesn't mean it actually does anything. all this tells you is that your raycast-which is being used for nothing-detects the ground. it has absolutely nothing at all to do with the ground check you do in your other code
are you just not familiar with the rest of the code that you wrote or something?
well, im only around 4 months into learning c# and i had to get A LOT of help to be able to make this code
but surely you bothered reading it to find out where you're even checking for ground before going and adding a useless raycast?
uhhhh well ive never used a raycast, i just learned it in my programming class at school 😅
so you didn't read your own code then?
yea, i read it. i just didnt think to check where im checking for ground.
😅
look man, i only got a c- in programming at school rn, im not amazing lmao
so if you read the code, and you read my message to add logs to ensure it was correctly detecting the ground, did you not perhaps think to put logs where it is currently checking for ground which you should know it is doing considering you allegedly read the code?
https://paste.mod.gg/askwnkuxalhe/0 this better lol
A tool for sharing your source code with the world!
hey folks, i have assets from some old game and would like to make a unity project around it. it's all custom formats and custom container archives. how would you go about doing that? i'm thinking of creating custom importers, but hitting some hard walls on the way (mostly because i don't know the right way for doing things in unity).
it is against server rules to discuss the usage or practice of ripping assets
im lowk gonna deal with all this bs tomorrow, im tired and i gotta wake up at 7
i'm not ripping anything, i own these assets and not planning on releasing anything, it's a toy project
sure, jan
Should you not just be able to open the original project and properly export/import them into your new project then?
lol wtf, what's with the accusations from the very first message? 😄
I'm confused on what you want. If you own the assets can drag them into your project
these are custom formats from very old game, none of it is recognizable by unity
But regardless
i was thinking of writing the parsers and make the editor see those assets natively
but if that's not the way i guess i'll just convert
ok then
it seems like your problem lies outside unity
can u register event on a TMP text component?
im planning to attach a script with this function on large sums of TMP text, this function should execute whenever the TMP_text.text is modified by code or by inpsector or by any sorts of stuffs on runtime
public void UpdateDimension()
{
GetComponent<LayoutElement>().preferredHeight = -1;
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
GetComponent<LayoutElement>().preferredHeight = GetComponent<RectTransform>().rect.height;
ContentParent parent = GetComponentInParent<ContentParent>();
if (parent != null)
{
parent.RecalculateDimension();
}
}```
ofc i can always call this function after the code changed the text, but im wondering if i can do onvaluechange
this is only for TMP_Inputfield?
https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/api/TMPro.TMP_Text.html#events
these are the only events on TMP_Text
oh yeah
lol looks like input field is more advanced
buuuuut that UI was supposed to be plain text
it's not "more advanced" it's just that InputField expects to be changed by user input
You can probably use the input field
and just disable it being interactive
or just make your own event
i don't think modifying it via the inspector would invoke that event though which is what they want
Ah, ok then OnValidate it is then (or ISerialization)
i have tweaked my script a bit, now its being used by both editor mode and runtime
but that shouldnt be a problem
how do i disable a canvas ?, i took the reference through code
the same way you disable any other component that can be disabled
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Behaviour-enabled.html
thanks i just started learning code
also is there any way to get the panel through code and not the canvas?
there is no such thing as a panel
the panel is just an Image component
panel is just a game object with an image already on it and named 'Panel'
but note that disabling that component only hides that image, you'd have to disable the entire GameObject if you wanted to also hide child objects (or use a CanvasGroup to modify their alpha)
thanks
i will stick to the canvas then
depending on what you want to do, canvas group is probably a better option - it allows you to fade on/off, instead of instant show/ hide
is something i am not doing nicely? i cant see the canvas when the player collides
have you confirmed that code is running
You wouldn't toggle the canvas component for visibility, just do the game object
yeah the time stops nicely after it collides
didnt understand bro
mb
but i am new
show the hierarchy + inspector for the canvas
and at run time, before you collide with this object.. the cavnas component is disabled?
I cant remember how a time scale of 0 affects things now (havent used it in years) try swapping those two lines round
😄
hm i did but it had no effect, but not it is working since i changed the setactive line. Thanks bro
IIRC UI interactions dont work with 0 time scale, it's not a good way to pause gameplay
kk
Your new code is what I meant by this
bro if u are free can u teach me rn? just a bit
not really - ask specific questions and I / someone will answer if we can / are free
i actually am making flappy bird first as my first project, everything done for now, i cant think of how to approach the pipe spawning system, i have already made the pipe prefab and a handler empty gameobject, but don't understand where to begin from to write the code.
flappy bird is an extremely common game to make, there are hundreds of tutorials around for that
is there a way to make sort of a folder inside visual studio where I can keep only certain scripts? Instead of having these tabs + the drop down on the right, maybe like a second drop down with only scripts i put in there or something along those lines?
Hey all, if something exists within a trigger when the game is started, is onTriggerEnter called? And if so, does this happen before Start()
you can test that, Im 99% sure the answer is no
Trigger methods require some collider intersection
camera animation is causing script to bug, any fixes?
Yes
I want to make a script that stores some public methods, like some sort of manager that I use in other scripts to make things more organized and stuff. How would I do this?
so like you want a script that holds methods?
yea, basically that
like a script that holds common methods and you can use the methods in another script?
yep
one way i know is using interfaces
interface myInterface
{
public void myFunction;
}
i havent really tried defining a function but this works for me
(outside monobehaviour class btw)
Monobehavior, myInterface:
public void myFunction{
//code goes here
}
k, got it
need someone to help me fix my zombie enemy AI
You need to properly !ask a question then
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696
so im trying to make a zombie enemy that once he spots the player he will go after him and attack him , simple right ? well i tried to implement it , the model wont do any animations , he goes flying into the air for some reason i don't know , he wont go after the player , i made a script for him , i dont know whats wrong but please help me
