#💻┃code-beginner
1 messages · Page 173 of 1
yh
show the visual studio editor package in your package manager
remove the highlighted one
i understand what LateUpdate does but what's its actual timing
Like, Update() is every frame, FixedUpdate() is every physics step
When does LateUpdate run
show relevant !code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
https://docs.unity3d.com/Manual/ExecutionOrder.html
shouldn't you still be learning the basics of C# though?
k and now
could you elaborate ? what vaules youre talking about
ive covered most basic stuff, still got coroutines to do but other than that should be good
these are unity concepts when you have been struggling with basic c# syntax. learn c#
bro i AM
still dont show the choice they say i need to take
no youre messing around in unity, that is not learning c#
im taking unity learn courses as well as reading the documentation and reading basic C# websites
then select the browse option and select it manually. or use visual studio which is easier to configure and less likely to break
you can learn unity after c# and after that you can mess around
can you please stop being so condescending to me when I HAVE been taking courses for DAYS
i know days isnt a lot but im trying
Send a screenshot of what you ARE seeing
everyone keeps treating me like im going in fully blind im not
the lie detector test has determined that was a lie
cuz you are
if i don't know one or two specific things, that doesn't mean i'm not trying at all
you infact are going in blind xD
you cant tell us otherwise, youre prooving it with your questions
its called having gaps in my knowledge
I would rather call that a marine trench
and actually going through a structured course that teaches c# is how you close those gaps in your knowledge. we're not telling you to go learn the basics for shits and giggles, mate. if you have gaps in your knowledge about literally the absolute basic stuff then you need to take some time to go learn that
leave me alone
best to stop arguing and go off and get on with what you need/want to do
no youre not, you are just playing around in unity and getting confused come here and ask a question that can be answered by watching basic tutorials
yeah i'm out
this isn't an airport mate, you don't need to announce your departure
just go do the learning instead of complaining to everyone that you're trying to do it
box coming in with a finisher xD
deserved
do i restart my pc wen done or its ok
wdym?
if u changed setting in IDE you can restart it, tho Im not sure you need that.
Restarting pc only needed when app on instal tells you to do that
if you've completed the configuration steps in the guide and you've already restarted after installing the c# extension (which installs the .net sdk) then you just need to regenerate project files and restart vs code
if (nothingHasChanged) { restartPC(); }
if (somethingChanged) {delete/system32}
don't multiply your velocity by deltaTime
also, it should be called in FixedUpdate
ok so the eror say Assets\script\PlayerMovement.cs(12,39): error CS0117: 'Input' does not contain a definition for 'getAxis'
yes and you should now see it underlined in red
ow its you, did you finally configure your IDE? @limber stone
yh it work ty
ima fix this rn
great! now spell the method name right
ty i was miss typing that one word and other but this one wouldnt be higligther in red
yes, you don't need that. a rigidbody's velocity is already expressed in units per second and the deltaTime multiplication is used to convert something from units per frame to units per second
for sure not because of that
yeah that isn't going to affect the actual framerate
Vector3 direction = playerRb.velocity; also why did you call that variable direction
it's not a direction
Unity just ate my full 32gb ram tryna make a 5400x9600 2d grid
lol
then fix your code
and why do you make such a big grid
I have no errors to work on
i mean optimize
big grids are funny
Small brained
ok lol
Followed some guide on unity forums exactly
whats in that gird ?
Square sprites
if its just an empty grid that would maybe eat 2mb+
that's 51 million elements
what
if its just the grid, without content
it doesnt eat that much ram
but yeah with sprites, rip ram
so 51 milion empty objects on the scene, would eat only 2kb ram according to you?
meant 2mb whoop
is your computer freezing, or is it just unity? if the latter then you probably have an infinite loop somewhere
damn are you in the matrix
yeah this seems like a hardware issue not a unity issue
that computer is fucked
yeah your gpu is dead mate
seems like your GPU is fucked mate 😄
thats a fried gpu
Update GPU drivers
put it in the oven for a 1 minute in 200 celcius degree
OOOOH RIGHT
I forgot to put a / between
Yoo, rain?
Pixel rain
of pain
i dont think an update can fix damaged hardware, that looks like typical dead gpu artifacts
if your goal was pain then yes
mate incase you missed it due to the restart, your gpu is likely fucked
its not unity
I cant help but wonder if its now running integrated graphics
how do you judge its pretty good?
your gpu might be new / good performing, but its in broken condition by the looks of it
that kind of artifacts i had them myself before before my gpu fully killed itself
if i remember it was something due to the VRMs shitting themselfs, from me overclocking it too much for too long
but guess what, what did i do to my new gpu instantly, overclock it xD
that is 100% irrelevant to the issue you showed
that piece of code wasn't even used
you weren't even using that variable so it was a useless line anyway
^ this is your code
you made Vector3 direction = playerRb.velocity; and never used it
so it's not relevant to your fps issue
you made a variable
and you are never using it
im just showing you that after deleting it, NOTHING will change
how can we know?
hello back unity say i have an error in the code "expected" but i dont see werre it is and wen double clicking on the unity error it canot find the error
Maybe show the entire error..
it's telling you that something is expected. read the full error. read the full line it tells you the error is on. pay attention to the red underlines in your code
therre isnt any red under line
screenshot your entire code editor again
prove that it is actually configured now. because if you have an error then it will be highlighted in your code editor
not configured
what but i followd the internet thing you sent and did all
well you clearly missed something 🤷♂️
once it's configured, you'll get red squiggly lines in quite a few places for that code, in VSC
mb didnt see that one
install Visual Studio and configure that. it's much easier and less likely to break
i have it but my licence is over and i whatch tons of vidéeos for fixing it but it wont work
install the community version
thaths why i was stoping programing
VS is free
? how
with the visual studio installer
ik its weird
learn how to google things, my friend
i did for week
delays how. can you show a video of what is happening?
still moving in Update()
it's just assigning to velocity though so that wouldn't be a problem
also you completely ignored the earlier advice of removing the deltaTime multiplication
you also still have several useless lines in there that do basically nothing
what is Vector3 direction
you know that this is not a direction?
and you are never using it anyway
remember how everyone told you that had absolutely nothing at all to do with the game freezing
your code still has nothing to do with your broken video card
either your video card is broken, or if youre lucky the drivers are faulty
i would first use DDU to remove all GPU Drivers and then install the newest available for your card
if then its still slowing down or doing the freezes you know that your gpu is broken and you will need to buy a new gpu
ok so wen i got the visual studio comunity the guid say just to update to get ide is it done ?
it isnt tho, that was clearly your gpu
doubt
if you aren't going to bother actually listening to anything anyone here tells you, why are you even here?
yeah im reaching the end of my patience, if they arent listening hes the next i report and to receive a warning
Listen to what we have to say, otherwise why are you even joining here ?
I have a really specific problem which will be a bit more dificult to describe here so if anyone is willing to help me please dm 🙂
if you want to figure it out, @gaunt harbor do the steps i provided
if you need help with DDU im willing to help
What is the benfit of using an array versus a list?
A array neeeds to be filled / instanciated before using and cant be changed
you are incredibly unlikely to get someone willing to help you privately via DM. if you need help with something then just ask your question in this server in the appropriate channel and https://dontasktoask.com
no one will dm you, ask here
list can be resized, arrays are fixed size
i mean this is such a google question you can look up in 10 seconds 😄
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 60)
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 50)
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 40)
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 30)
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 20)
{
AudioManager.instance.PlaySFX(31);
}
else if (score == 10)
{
AudioManager.instance.PlaySFX(31);
}``` is there a cleaner way to do this. feels very repetitive
also if you have to ask this, go watch this: https://www.youtube.com/watch?v=gfkTfcpWqAY
C# tutorial for beginners: Get up & running with C# and code in just 1 hour! No prior knowledge needed.
- Get my full C# course: http://bit.ly/2KJLPuS
- Subscribe for more C# tutorials like this: https://bit.ly/38ijYjn
⭐️Want to learn more from me? Check out these links:
Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhame...
what's that, its terrible
yh i know
if(score % 10 == 0)
So there is no way to add a something new to an array.Got it thx 🙂
afaik he goes over lists and arrays
Bruh moment
no you dont need dictionary
play the same index
okay didint see it doesnt change
this one is the best solution
if score is dividable by 10 that will get 10,20 etc...?
yes
awesome thanks
note that also includes 0 though
0 && <=70 && score%10 if you have to restrict the range
well i set that max to 70 but really i just want to get the 10th so score could go to 1000
just do if(score % 10 == 0 && score != 0)
also if score is a float, it is almost impossible for any of these conditions to be true
thanks, score is int
if its a score it shouldnt be a float anyways nvm im wrong
that's not necessarily true and entirely depends on the design
That's just not true
i made a doodle jump clone where the score was just the height along the Y axis which was a float 🤷♂️
oooh ok now my error scan work ty box frend
ok for the payment for all the back and forth with box: 25 box credits /s They gonna misunderstand this anyways
thanks guys
Okay so im working on fishing game. RIght now I have a world generating mechanic which randomly spawns prefabs of gameobjects on map (like in this vid https://youtu.be/D4EOgZyNk-k?si=6BCPYr1uIWR3ucvC) I have attached a fishingevent script to each newly spawned lake which I have done by attaching the script to the prefabs of the lake gameobjects. But the problem is that the script has its references (pic) and I just cant find a way how to fill those references by a script whenever the object spawns so yeah pls help :DDDD
ok an other proble not the typing ig but it jump but not evry time i press space
like 3 time at 10
What.
my jump button work but it dont jump evry tim i press
When spawning, you need to get a reference to this component.
Then it's just fe.canvas = etc
You may want to declare the prefab reference as
FishingEvent fePrefab
Then doing Instantiate(fePrefab) will return the component reference for you straight away
that's sad!
pfff
i have another horrid one. if (CansGameManager.instance.above70) { speed = 9; } else if (CansGameManager.instance.above60) { speed = 8; } else if (CansGameManager.instance.above50) { speed = 7; } else if (CansGameManager.instance.above40) { speed = 6; } else if (CansGameManager.instance.above30) { speed = 5; } else if (CansGameManager.instance.above20) { speed = 4; } else if (CansGameManager.instance.above10) { speed = 3; } else { speed = 3; } what could i do to clean this one up. really every 10 it just increases the speed. Could i just get the score again and check if % 10 speed +=1; would that work best
show the code
Dictionary
have you heard about Dictionarys or Switches
switches will result in the same ugly wall
yes but its way better for performance
it's not "way better"
where did you hear that
switches yes dictonarys no. again i dont want this to cap at 70 would like this to be forever 80,80,90 etc...
I dont think its working as I think it should?
learn about dictionaries
dictionary or switch cannot solve it
this is not one to one mapping but many to one mapping
or serialized dictionaries
it is worlds better, if you do this if else the entire time instead of switches
its minimal at once, but very bad at scale
you need sorted set (idk if it support lower bound search)
why dictionary wouldn't slove it?
read the comment above and above this comment
i did
it would, the switch is just easier
it "solves" it, but it doesn't scale.. you still have to add every instance
Can you crash an audio source? If I run my mouse really fast along buttons which are configured to playoneshot a sound on hover eventually they stop making sounds
yes but then it's much clearner in code
assuming you add the entries via inspector
Im lost so diconary is a no?
What type is "abovexx" ?
you can somewhat "corrupt" the audioplayer in unity by overloading it too much
there is no reference to prefabs, the prefabs are saved to the generating script in "GameObject[] objectPrefabs" array
you can use an decreasing array and iterate it and break until you find the element right smaller than it
public bool above10, above20, above30, above40, above50, above60, above70;
var instance = CansGameManager.instance;
switch (instance)
{
case var _ when instance.above70:
// Code to execute when above70 is true
speed = 9;
break;
case var _ when instance.above60:
//etc
speed = 8;
break;
}```
?
run faster then sorted set since you only have few elements (<10)
sooo... objectPrefabs is an array of...?
how can i avoid t hat?
thats what i would do
thats the most readable
dont overload it
and easy to add new cases
i want to change the whole thing. i dont think i want the bool any more i just want to get score now. and if its above 10 speed is 1 above 20 speed is 2 etc...
objectPrefabs is an array where all the prefabs are stored
So you have references to prefabs 😄
how much at a time would be considered overloading though
Just divide it by 10
those prefabs have script attached to them and the script has its own references that need to be filled for the code to work, and I need to find a way how to fill those references using script
hashtable basic:
it is used to provide one to one mapping so if you have something likes
type val;
int x=X;
if(x<100){
val=thing;
}else{
val=another thing
}
```which implies the for x in **range** [INT_MIN,100) val=thing, which is not one to one mapping
oof you would need like very many like audiosources to archive that, maybe like 1k + ?
yh thats what i sais earlier could i divid by 10 then do speed ++
also depends on your pcs audio driver a bit
that might be php sorry
GetComponent<T>() , GetComponentInChildren<T>() , GetComponentInParent<T>()
No literally just divide by 10. Integers cannot have decimal places so something like 36 / 10 == 3
only like happens if you automatically spawn audiosources and have a bug in the code that spawns way too many
so wtf 😭 i only have like 10 sounds at a time playing through one source
my prefabs always contain either a specific monobehaviour OR class derived from a specific class derived from monobehaviour, where the class that instantiates it can GetComponent, then call Initialize(arguments) to give any info it needs to start and connect to the scene.
maybe it doesnt crash the thing but you reached your max voices the audiolistener listens too
but it shouldnt like stop playing completly, that behaviour is not normal
what unity version are you on ? Some new beta version or is it a "stable" release
so if I understand right yyou have a script that fills the references in other script and both of these scripts in one prefab?
SpawnedEntityHandler : Monobehaviour has Initialize(…) which is like a standard initialize
the script that instantiates the new gameobject has basic information needed to pass in to call Initialize
SpawnedEntityHandler can also get other information from singletons.
its 2022.3.17
but SpawnedEntityHandler gets the key unique info it needs to start up in that Initialize( call
int speedIncrement = 1;
int score = CansGameManager.instance.score;
speed = baseSpeed + (score / 10) * speedIncrement;``` somthing like this
shit like starting position, starting velocity, starting rotation, what kind of object it is supposed to be…
SpawnedEntityHandler has basically 1 job: manage loading and unloading of the thing. It does not have any code specific to the kind of object it is.
Other scrips on the object query SpawnedEntityHandler in Start() to know wtf is going on, to initialize their own variables.
does this all make sense, tt?
When i import a 3d model from blender into unity and apply rigidbody it doesnt work? The only way it works for is to put a invisible capsule with a mesh collider. But how can i make the 3d model itself have mesh collider all around it instead of having to use a capsule or something?
oof tbh i have no clue, can you show your code that fires upon hover ?
oh wait are you saying hover ?
is it in update ?
and checking for hover
or are you using lateupdate / fixedupdate
cuz it could be that its playing the oneshots like 300times per second (at 300fps)
im using pointerhandlers
that could be enough to brick the audiodriver in unity
maybe put a log in the method where youre playing the sound, to validate if its this, or if its doing it correctly (1time)
normally that should be not fps dependant
and only fire once
can you show how youre playing it, on the ui and the code
and can you create a debug log ^^
Listening to events, hmm i have no clue, maybe the logs can help, but i dont think thats it, i think something else might be broken
im out of ideas what could be the problem
you hear what the problem is though right?
yeah
can you go in the audio settings and make a screenshot of that
maybe you set your max voices to some weirdly low amount by accident
Project settings audio
ah ye
512/32 seems normal
ok now im lost, i have no clue anymore to be honest
maybe an editor bug ?
have you tried restarting your pc since this happend ? If its an editor bug it might fix it, thats the last thing that i can think of
it wont move the player
yeah, might just leave it tbh its the leasst of my concern rn
this code seems correct to me, where do you place this script
why is the code different colour?
on player
i also have this weird issue where when i switch UI panels, the button that was last active before i make set the gameobject to false keeps its previous state, so it stays yellow or whatever. how can i fix this?
- ur using a different IDE.
- themes are a thing
IDE?
the development enviroment
youre using visual studio code, the person in the video is using visual studio
i would recommend installing visual studio inside unity hub, its the first addon if you click on manage install
Also you would need to set up visual studio code manually for unity if you want to use vsc
!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
• Other/None
this dont work and idk why
on player
can you show the editor with the inspector on the player
I'm trying to set up a simple grid, and seperate objects that you can drag and snap onto the grid, I have a working grid and a separate dragging script that doesnt snap to anything, is there a way to snap it to the separate grid or would it need to be in the same grid manager script
click on the player on the left and send a new screenshot
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
The separate grid? There’s two grids?
please scroll down in the inspector
Or are you asking if there a way to make the code for the grid snap in the objects?
i want to know if you actually attached the script
no sorry, i have a grid manager that just makes a grid with prefab tiles, and then a dragging script that doesnt snap to anything, i want to be able to drag objects and have it snap to the first grid
Ah, I see
but because i will have different objects to drag i would think i need the snapping feature to be on the objects rather than anything in the grid
I see
So what you could do is make a list of every grid tile’s transform in the grid, then loop through that list, find the closest one, and set the objects position to the closest one
Alternatively, you could just simple make its position round to the nearest ____
hmm, because the grid manager and dragging scripts are separate would I be able to access that list of tile transforms?
Yes, you could make each tile add itself to the list remotely by accessing the script in the object via a reference, or make the list static so that anything can access it without a reference.
Check your spelling...
are you using the new input system ?
can you refrain from reposting everything if i dont instantly answer? i will get to you
what new input system
ah alr, when you said check for the closest one, how would i go about that or could i just check the mouse position and see if it overlaps another tile, and then get that tile's data
unity has an "old" and a new input system, if you look into your package manager and you search input manager is that installed or not
His spelling is all wrong, why are you talking about the new or old input system? 
read the error. you spelled it wrong . . .
cuz it looks like its trying to use the new input system but its not fully set up
Ah yes, the second option is a better idea, yeah just make a raycast from the mouse position and then get the data of whatever it hits
i did see i spelled horizonal wrong and i fixed that already
i honestly forgot raycasts existed i was just gonna use screentoworldpoint 💀
lol
they send the code a bit after that, they fixed the spelling mistake
do you have any other errors?
same for @slender nymph
no thats all i see
is this old or new
and where have you defined the input axis Horiznonal?
in the code you send its correctly Horizontal, so either this is old errors or you send not your code
clear out the old errors and try running the game again . . .
and actually take a look at the stack trace for the errors too if they persist
if it still appears, then you haven't saved the script . . .
didnt even see the spelling mistake, i thought its some error from the new input system, my bad
just did
click one of them and show the stack trace
did you press control + s in the code editor ?
clicked save and it worked
but this scares me, why is it yellow
you kinda have to save your changes when you update the code . . .
ngl i thought it does it automaticly
when ever i close the clode
did you rename the script?
thats a setting you can activate in some IDE's
but its bad
cuz with every save unity will recompile
so youre constantly recompiling while typing
its the same so idk
show the inspector of the player and the camera
errors gone now
had to reload the game
it only took me 4 days to make the player be able to move xd
This is why we don't do hardcoded strings.
no, before it was called Movement . . .
not my game
now ?
you can post all of your stuff. anyone in the chat can help and they'll need all the info. don't wait for anything . . .
that is ibhrz and not woly...
yeah, Woly told me . . .
the thing is, just dont repost it like instantly, if noone is getting back to you after like 10 minutes (unless your message is still on screen) you can repost it
no the thing is they posted something while i was helping someone else and then instantly reposted that to get my attention.
and then i actually forgot them 💀 thats my bad
soo whats the problem
Update is misspelled . . .
Sometimes you need 4 eyes, thanks
capitalization matters . . .
ok thanks'
alright so it drags and snaps to the grid, but is there a way i can also have it freely move outside of the grid (the grid does not take up the whole screen), if the mouse goes outside of the grid then it just locks to whatever side its on
Idk if you solved this already but calling GetButtonDown is not reliable in FixedUpdate. Do it in Update instead
GetButtonDown is true for one frame, and it's not guaranteed that FixedUpdate runs every frame
i dont anderstand what to change
you got told exactly what to change by osmal
GetKeyDown etc is true for exactly one frame
FixedUpdate does not happen every frame.
If you use GetKeyDown in FixedUpdate, it will usually not work.
I mean move the if-statement that sets isJumping to true, into Update.
Update runs every frame
i dont anderstand very well the coding language so instead of get button down i type what
ik what you mean but dk what to do to change that
Have you used Update before?
nah
It's a method just like FixedUpdate that you currently have
ok
It's one of the 'Unity methods' that gets called automatically if it exists in your script
This is very basic stuff so I suggest taking some starter courses !learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Please watch this https://www.youtube.com/watch?v=XtQMytORBmM
🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴
Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...
or use unity learn from the link above
That's a decent beginner video, yeah.
ok
GMT is very good imo
yeah, it’s a good start
ty it work but now my walking speed is slow like it wwalk litle bit and stop and re strat ik were this come form but idk how to fix it
Show your code, put it in a paste site !code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
please use screenshots and not that
looks like your java version is outdated ?
but a screenshot of the tracelog would make it easier to help you
I can't send screenshot sorry
I don't have discord there
And I can't download it, it's a school PC only
What can I do?
update java
At what version? 8?
what ? No. Use 17
youre making something, you need the java sdk, not the consumer thing
2 different things
Wait wait, android studio SDK?
like this ?
not really, but better then nothing
But it's says android SDK
look at the bottom right
problem is that its compiled for the wrong version and cant be loaded
More recent, what do I need to do?
does anyone have template for a runner game like subaws surfer ?
no
but you can buy one one websites, im pretty sure
where ?
this one is more recent
But unity says that the version need to be at java 8
this is a game development discord and not a lazy ripoff discord, you wont find help here regarding that
you can tho, use google to find a place to buy that
or you could do it like other people here and learn coding, learn unity and make it yourself
but i want to see how runner game is doing and in youtube tutorials are very bad
What version do I need to have?
i have seen good tutorials for it
you need to look better or you call them bad cuz you dont understand what they are doing
just install java 17 sdk and then restart unity
and then look if the error still exists
we go from there
but i don't want to copy paste every tutorials beause if one day my friends or any person say how i do it i can't say i copy paste it in youtube
Then learn how to code / create games and make it yourself
C# tutorial for beginners: Get up & running with C# and code in just 1 hour! No prior knowledge needed.
- Get my full C# course: http://bit.ly/2KJLPuS
- Subscribe for more C# tutorials like this: https://bit.ly/38ijYjn
⭐️Want to learn more from me? Check out these links:
Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhame...
🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴
Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...
Thanks, you are very useful
you mean helpful, but thanks
so can somone tell me how to fix the non walking problem pls
also you seem to have problems writing english, you could try out https://deepl.com to translate your language to english
That can avoid confusion or mistakes
are you making a 2D or 3D game
cuz youre mixing Vector3D and 2D
2D
its a tutorial i folowd
the tutorial very surely didnt tell you to pump a Vector2D into a Vector3D
Thank you for helping me so much
try this
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public float jumpForce;
public bool isJumping = false;
public Rigidbody2D rb;
private Vector2 velocity=Vector2.zero;
void Update()
{
float horizontalMovement = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
if(Input.GetButtonDown("Jump"))
{
isJumping = true;
}
MovePlayer(horizontalMovement);
}
void MovePlayer(float _horizontalMovement)
{
Vector2 targetVelocity = new Vector2(_horizontalMovement, rb.velocity.y);
rb.velocity = Vector2.SmoothDamp(rb.velocity, targetVelocity, ref velocity, .05f);
if(isJumping == true)
{
rb.AddForce(new Vector2(0f, jumpForce));
isJumping = false;
}
}
}
I replaced the wrongly used Vector3D with 2D
i cant figure out how to make this re-enable the rigidbodys gravity when the stair has been walked over...
can someone plz help
// Stair check
RaycastHit objHit;
Vector3 heightVex = new Vector3(0, playerHeight, 0);
if (Physics.Raycast(lowerStair.transform.position, moveDirection, out objHit, 0.6f, whatIsGround))
{
float angle = Vector3.Angle(Vector3.up, objHit.normal);
if (!Physics.Raycast(upperStair.transform.position, moveDirection, out objHit, 0.6f) && angle > 85)
{
rb.drag = 0f;
rb.useGravity = false;
rb.position -= new Vector3(0f, -stepSmooth * Time.deltaTime, 0f);
// Push the player towards the movement direction smoothly
float pushSpeed = 1f; // Adjust the speed as needed
Vector3 targetPosition = rb.position + moveDirection * 0.5f;
rb.position = Vector3.Lerp(rb.position, targetPosition, pushSpeed * Time.deltaTime);
}
}
rb.useGravity = true;
😅
just do an else case with that
unless i missunderstand something
it still walk step by step very slowly but jump good
it dosent work when i do that
increase the movespeed in the editor
can you activate the performance window or maybe im overlooking something (can someone else please look over it =))
in the game window there is a option to show the performance window with the fps
its not fps bcs i have rly nice pc and jump is clean
ah ok
are you following this tutorial ? If no, follow this one instead
https://www.youtube.com/watch?v=XtQMytORBmM
🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴
Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...
Hi , i'm starting to code on Unity with C# and i'm following a tutorial to start somewhere
i'm doing exactly everything the guy do but i don't have the same result x) here are some picture
for my movement or the blue square everything work fine but for the square i can't fill any value like Speed min max X and min max Z
Anyone know what's happening ?
is your IDE configured?
also you need to fix compile errors
that's why it doesnt work
i cant explain like what i want but, this walls are strange like when i jump and walk i can stay on the wall, anyone know how to stop that?
very far from 'exactly'
it looks like have super glue on it
Are you using rigidbody velocity to move? You need to set friction to 0 if so
Otherwise post code
that's the video script
yep, totally different to yours
wdym by totally different?
this thing?
That would be a rigidbody yes
but where i set friction to 0?
Exhibit A
Exhibit B
i am sorry for my questions i am still learning
yes i spotted the difference but i wouldnt say its TOTALLY different 😄
it's just because his IDE is not even configured
i was searching a error for a solid 15 min staring at it tbh before i send my msg x) new to it i was blind thx
You need a physics material which you assign on the collider
Need help with tile rules. I dont get how to make them work.
I want top one only to be on right and never in other different positions.
Second one in middle, 3rd one on right only
work now
@safe flicker
man
configure your IDE
you'd have spotted the error in 5 seconds instead of 15minutes
!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
• Other/None
i don't know what a IDE is
OMg not again
then google it
An IDE (Integrated Development Environment)
and when you find out, configure your IDE
i'll do it
I'm wanting to make enemies spawn outside the screen. Do I need to make it spawn outside of the viewport or can I also just make it spawn a certain distance from the player which probably is outside of the viewport?
Both
@rare basin You know as well as I do, this is programming, a one character difference in a script of 1,000 lines can make the outcome totally different
well if you have a scrpit of 1000 lines then you made some architecture issue 😄
but yes i get it
I don't intend on making u do the work, but I have figured out the viewport, how do I make it spawn outside of this? Is it like ```cs
vector2(random.range(and somewhere here outside that viewport))
One option is to randomly choose whether to spawn to the left or right
Get camera size and just use x and y bigger then camera size on random?
then you can pick a random position that's less than the left edge or larger than the right edge
repeat this for the Y axis and you're good
It's top-down so im intending to make it spawn top bottom left right
Vector2 result = Vector2.zero;
bool left = Random.value < 0.5f;
if (left)
result.x = Random.Range(-0.3f, -0.1f);
else
result.x = Random.Range(1.1f, 1.3f);
this would give a 50-50 chance of being on the left or the right
and pick a reasonable view-space position that's a little bit off the edge
so here I would make another bool for top and make it again 50/50 with top or bottom?
Right.
If you want to do pixel distance (screen-space) or physical distances (world-space), you'd just replace those constants in the Random.Range calls
so for screen space you might do Screen.width and Screen.width + 100f to spawn on the right side
for world space, you'd need to first compute where the right edge of the screen is
Vector3 rightPos = Camera.main.ViewportToWorldPoint(Vector3.right);
result.x = Random.Range(rightPos.x, rightPos.x + 5);
This would spawn something up to 5 meters off the right side of the screen.
hello everyone hope you are well, I am a beginner and I would like to have a script that allows me to get in and out of a vehicle and be able to drive with my vehicle and already on my scene and my character the same I can move with my character and move the camera but I can't make it go up and down, thank you for your help!
lmao no
with what exactly do you have issue
and what do you have so far
describe your issue, no one will pull your tongue to tell us that
I have a suspition he considers this chat as ChatGPT
well they said "but I can't make it go up and down" so maybe hes done everything and the only problem is his camera cant go up and down? in which case u have to post ur script @simple cedar so we can help fix it
okay so what does i cant make it go up and down even mean?
we dont need to speculate
we need facts
He kinda got silent
And without code how are we supposed to answer that other than "make the camera go up and down instead of not doing that"
basically my character is functional I can move with my vehicle and script but I will need the script so that the character can enter and exit the vehicle and be able to use it
and what have you done so far to try and achieve that?
I watch YouTube tutorials and I get a Unity Standard Assets error but the problem is that Unity removed this so I'm looking for a new script
what did unity remove?
entering and exiting vehicle?
Unity Standard Assets is not related to a enter/exit vehicle system you want to create
using UnityStandardAssets.Vehicles.Car;
yes that's what I'm thinking of doing but I don't really know that's why I'm asking you here
it depends on what design do you want
do you want it to be raycast based
to enter vehicle
or trigger based when you are close to a vehicle
plenty of interactable things tutorials
in trigger
I have some weird tile? The one on left doesnt even exist in my rule set
do you have a video? because I only have tutorials on old unity
this is a code related channel
you can google it yourself
Where then to deal with Grid Rule tile
watch some, pick one you like the most
not in code related channel 🤷
ok ok thanks you !
My cursor is still visible ven though I set its lock state and visibility
Its because its standart sprite for it bruh
show code so we dont have to speculate i guess
well the way i would debug this first is add a debug log in there to see if this code is even getting run
My "enemey" is dumb, and when he spots me he walks trough the walls, how can i make him smart?
My player movement is a mess
It has both camera functionality and movement combined
how is this code even called? show entire script so we can see where the issue is
Debug.Log(Cursor.lockstate);
``` should work right?
Start() method
Are you actually clicking into your game view?
Meaning?
Click the game view?
Yes?
Also holy shit my code is like 500 lines for wallrunning jumping and sliding
That can't be efficient
Guys i know it's not the right session but i don't know where to ask tbh.
https://gyazo.com/5a21e422ea809071c3e939e96d687baa does anybody know why the player_equip animation get stuck at the end and prevent other animation from playing? The transition has a trigger condition
Use pathfinding such as the builtin NavMesh
so ur clicking on the game view and it still doesnt work? show ur start method then
Log Cursor.visible in update. See if it's getting set back to true
and if it is then ctrl+f and search for cursor.visible to see where you're setting it to true again
https://gyazo.com/e673af66f66cee3a8f423e36a92101e3
im having an issue where the trigger collision between the player and a pickup item wont happen until i click on the player object in the heerarchy
so ur probably not clicking on ur game view then? like u gotta click it once when u start playing
It had a few "False" statements and then suddenly a bunch of "True"
wait what
If it just keeps spamming false then the cursor is invisible and it's likely just an issue with your editor. Either you aren't focusing the game or you've got a stuck alt key or something
ctrl+f for "Cursor.visible" and show where else it is in your code
Yeah that's probably what you should have sent instead of just saying it's "False". You have code elsewhere setting it to true
I honestly can't even remember where or what is everything because my code is so stupidly complex
half a thousand lines just for jumping, crouching/sliding and wallrunning
There is a surprisingly high lack of quality movement tutorials on rigidbody online
Movement code tends to be large
luckily all u need to do is ctrl+f for Cursor.visible and it shows you
how do i do that
Learn how to create AI pathfinding using the Unity NavMesh components!
This video is sponsored by Unity.
● Watch on Unity's website: https://goo.gl/jUsU8D
● Example project: https://github.com/Brackeys/NavMesh-Tutorial
♥ Support Brackeys on Patreon: http://patreon.com/brackeys/
·································································...
ty guys
How to fix Grid Tilemap collider 2d being quite wrong?
Its way too far away from visible tiles. I can stand almost one extra tile futher then they end
Can someone please link a good tutorial for fast-paced rigidbody movement?
Actually nevermind
I can try find a system I used in the past that worked well
It was buggy but I was able to fix it relatively quickly
And build on top of it
Its also good to mention what kinda game you are making when asking for a tutorial
Fast-Paced FPS
I've been going back and forth on games
Once I wanted to make a 2D game and another 3rd person story-driven one
I just looped back to FPS
Might as well finish it
bump
You dont have a transition from player_equip to another state
Transitions are one-way
Also your IsEquip trigger is true so it will keep going to that state
I tried using unity Imput system. I created it in 2 places one is DontDeleteOnLoad gameobject other is Player that is on the scene.
One is interfiering with another. Should I only create it once in the dontdeleteOnload object and access it in the player?
private PlayerControls _playerControls;
and what is PlayerControls?
PlayerControls is not the "unity input system"
so you checked the "Generate C# Class" option?
It was working before I incialized anothe instance of them in different class
Is Gradle something I need to manually install to build a project for android?
i think i shouldnt be capturing when there is a hotcontrol
Im pretty sure it comes with android studio
This is why I have warnings off in the console lol
Warning: Reactor temperature critical 😴
Im using this
should i switch to the new input system
I know you are.
But did you go and check the box here to generate a class from your input action asset?
im used to the old one and im not bothered to learn the new one but is there anything better abt it
If it was working before it means I have setup it correctly
Well old one detects one action/frame new one can take in multiple
Arent you reading what I write?
Yes. I am. You haven't answered my question.
there are lots of ways to receive input.
I'm not asking you if your code used to work. I'm asking you which way you're getting input.
I need help deciphering this error message, it occurs whenever I try to build my project for android
given that your asset is named PlayerControls, I'm guessing you did, indeed, use the "Generate C# Class" option
void OnEnable()
{
_controls.Enable();
_controls.PlayerControl.Movement.performed += OnMovementPerformed;
_controls.PlayerControl.Movement.canceled += OnMovementCancelled;
}
void OnDisable()
{
_controls.PlayerControl.Movement.performed -= OnMovementPerformed;
_controls.PlayerControl.Movement.canceled -= OnMovementCancelled;
_controls.Disable();
}
private void OnMovementPerformed(InputAction.CallbackContext context)
{
_moveVector = context.ReadValue<Vector2>(); // Deals with movements
}
private void OnMovementCancelled(InputAction.CallbackContext context)
{
_moveVector = Vector2.zero; // cancels movement
}```
A: this is not android server
B: I hate it with passion
C: God save you from android
and this code looks exactly like what you'd get if you checked the "Generate C# Class" option, yes
Is there are way to stor A* from cluttering the console?
As I said before it was working okey before. I made another instance of it in different object and it got borked
so from player_equip i should do a transition to any other state? IsEquipTrigger was true cause it was stuck x)
You are trying to answer a different question than I am asking.
I asked how you got input, not whether it worked
Yes
i'll try thanks bro
i presume this is some third party asset
it should have options for that somewhere
private PlayerControls _controls;
void Awake()
{
_rb = gameObject.GetComponent<Rigidbody2D>();
_controls = new PlayerControls();
}```
Its only way is C# generated script
i don't understand why you're showing me random pieces of code instead of just saying "yes, I'm using the 'Generate C# Class'" option
ITS THE ONLY OPTION
I do not understand what that means. There are many ways to get input, like InputActionReference and the PlayerInput component. That's why I needed to be sure which one you were really using.
anyway, coming back to the original problem...
@verbal dome any idea on what i should put to exit a trigger? (to go from player_equip to idle) let's say
like on the exit transition what should i put? As far as i know triggers should reset after the animation is called, no?
Whatever condition you want to cause the transition to occur
I think you're seeing "interference" because the first PlayerControls is grabbing the devices, so the second one can't find any more devices to bind to. I don't use the generated C# class in my own game, so I can't be completely sure about that.
Keeping a single instance on a DontDestroyOnLoad-ed object sounds fine. You can just make it a singleton that the player component looks for.
I mostly use InputActionReference to reference specific input actions
Dont need a condition in this case, just make Has Exit Time true
So it automatically exits via the transition when player_equip finishes
And yes triggers are just booleans that go false automatically when a transition uses it
I have a script that create a maze randomly, and i add a enemy but my enemy instead of go around the walls he face it, and try go trough it, i already have seen some videos, with Nav mesh, but it doenst work, idk if it is because of the maze is generated randomly or i am doing something wrong.
seems like your navmesh wasn't generated with the walls in mind
You can also use A* for this
Did you look at the NavMesh after it's generated?
i dont understand much of unity so have i high chance of me doing something wrong
What steps are you doing to generate the navmesh?
If you are generating the maze at runtime, you need to generate the NavMesh after that too
i dont know how to that
NavMeshSurface.Bake();
Or .BuildNavMesh() unless it was changed in newer versions
i am gonna try ty
hello i have littel problem 😅
can someone help me I tried to hack to make it stop but it won't work
can i force a button state in code?
what's the desired behavior?
when i switch panels the button i press to switch panels hangs on their last animation, so i wanna know how i can avoid that
and like force it back into the normal state
I think if you disable navigation on the buttons they won't be selectable
hi, im making a room spawn system that spawns a series of rooms in a random order, the way i have it done is for each room theres an empty game object (or more) called room connectors. these spawn other rooms at their position and rotation. the problem is that some rooms have room connectors on all sides, and sometimes (most of the times) some rooms end up clipping through eachother. heres a pic and the code. if theres a way to do it without a grid system then that would be amazing
public List<Transform> roomConncections;
public List<GameObject> rooms;
public List<int> weights;
void Start()
{
int sumOfAllWeights = getSum();
if(roomController.rooms>0)
{
foreach(Transform roomConnLoc in roomConncections)
{
int roomRand = Random.Range(1,sumOfAllWeights);
int i = 0;
bool spawned = false;
while(!spawned)
{
if(roomRand<weights[i])
{
spawned = true;
Instantiate(rooms[i], roomConnLoc.position, roomConnLoc.rotation);
roomController.rooms-=1;
}
roomRand -= weights[i];
i++;
}
}
}
}
int getSum()
{
int s = 0;
foreach(int weight in weights)
{
s+=weight;
}
return s;
}```
sounds like the button you press is going into the selected state
clip of my issue
yeah try disabling navigation on them
You can also change this
to do Normal instead
but that would break keyboard selection
i'll try that, but its kinda necessary cus i need it for controller navigation
Ok both of those options will break controller navigation actually
maybe add an Event Trigger to it and set up a listener for PointerClick that deselects it.
I have a problem with my code :( my wheel position isn't correct when i load the game. Here is the Scene vs Game while running
Here is my code for updating the wheels:
void UpdateWheel(WheelCollider col, Transform trans) {
// Get wheel collider state
Vector3 position;
Quaternion rotation;
col.GetWorldPose(out position, out rotation);
// Set wheel transform
trans.position = position;
trans.rotation = rotation;
}
and it gets called from:
UpdateWheel(frontLeft, frontLeftTransform);
i already have a thing thats on all my buttons, how can i deselect?
EventSystem.current.SetSelectedGameObject(null);
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
applying that doesnt seem to work, on the click and submitt methods at least
try in OnPointerUp?
hey just looking for some help with a line renderer in 3d, i usually work 2d but have been trying to make a drag and shoot basketball game and using a line renderer to display the force and direction the ball is being shot in, with code attached to the empty object with the line renderer, although in game it does not pull back as intended it just appears on screen. Could someone tell me if my code is completely off tracks or if im just missing something simple in 3d. Thanks :))))
You sure cam.nearClipPlane is right?
You probably want to use Plane.Raycast and Camera.ScreenPointToRay in 3D
not Camera.ScreenToWorldPoint
still nothing
does physics.overlapbox return null when nothing is overlapping
No. It returns a bool
check the docs
Actually sorry it returns an array
again, check the docs
then why does this give an error if(roomRand<weights[i] && Physics.OverlapBox(new Vector3(0,0,0), roomDimensions[i]))
yea array
because it returns an array
yep\
This is what id use for 2d and thought itd work the same in 3d as the camera isnt moving anywhere or am i completely wrong
You can just use CheckBox if you only want a bool answer
ok
you're completely wrong
ty
oh sorry what would be the best 3d alternative?
(ingor my friend i was playing with)
man, this is a code channel. #1180170818983051344
ALready mentioned above
thougth this was unity talk mb
also its not that deep
#💻┃unity-talk still not right for that
i dont care
could someone assist me with this problem
obviously not, over entitled ...
its not that serious its just a discord channel man
but we have rules to stop chaos being caused by people like you
i just dont care enough man
you might not but the <@&502884371011731486> will
yes, and having been told where you should have posted you decided to behave like an ass
ok i still just dont care
Hey, so I'm getting a Null Reference Exception but when I go to the part of the code that's in the error message I can't find any of the usual culprits of a null reference. The code looks fine to me. It also compiles & runs & behaves exactly how I'd expect it to— except for the debug screaming null reference exception
{
bool isInRange = Vector3.Distance(transform.position, target.position) < weaponRange;
if (target != null && !isInRange)
{
mover.MoveTo(target.position);
}
else
{
mover.StopMovement();
}
}```
Line 28 would be `bool isInRange = Vector3.Distance(transform.position, target.position) < weaponRange;`
ohhhh
do you know any vids that could help me understand how to fix the code to make the line renderer in 3d? thankyou
wdym by "make the line renderer in 3d"? Line Renderer is always in 3D
I already shared my suggestions for calculating the correct world positions to use with it
{
for (int i = 0; i <= 99; i++)
{
var shooter = Instantiate(projectile, transform.position, transform.rotation);
shooter.transform.parent = spermFolder.transform;
shooter.gameObject.SetActive(false);
sperm.Add(shooter);
}
}``` i have this function that Instantiates a projectile to fire. i set it a max of 99. but i want it to shoot more. rather then giving it a higher value is there a smater way. could i detect it fires 3 and Instantiate another 3. feel like im hard coding it
If this is for object pooling, you would detect if you need to spawn an object and there's none left in the pool, if so, spawn one
That way the pool is by definition always the smallest it has to be to cover the worst-case scenario
ok thanks never hear about pooling
!warn 966393302389784607 You were directed to the correct channel. Use appropriate channels and don't spam.
quackkerssss has been warned.
ok nvm i give up u were right
ok pooling is def what i need. thats a way better way. thanks digihloic
what kind of game is this for
lol you dont want to know. I can show if you want its a mini game very simular to an atari adult game called beat em and eat em
Does anyone know how to remove these black dotted lines? My player keeps getting stuck on them, though it gets stuck for around 0.2 sec then falls through like its not there. They seem to flicker on and off while the player is running. They arent part of the platform itself.
i ended up writing my own sort of thing with the handlers, and the issue still happens even without using the state change on the buttons 😭, https://gdl.space/xotitadonu.cpp
My character only collides when falling through these lines, it doesnt collide when jumping
{
if (queueSprem.Count > 0)
{
projectile = queueSprem.Dequeue();
projectile.transform.position = new Vector3(transform.position.x, transform.position.y -1.3f, transform.position.z);
var spremshoot = projectile.GetComponent<CumCansProjectile>();
spremshoot.Move();
}
else
{
projectile = Instantiate(projectile, transform.position, transform.rotation);
projectile.transform.position = new Vector3(transform.position.x, transform.position.y -1.3f, transform.position.z);
var spremshoot = projectile.GetComponent<CumCansProjectile>();
spremshoot.Move();
}
yield return new WaitForSeconds(0.5f);
runTimer = false;
ChangeDirection();
}
``` so trying the pooling way. fires the first one then says the object is destroyed.
projectile = Instantiate(projectile, transform.position, transform.rotation);
why are you doing this
now the next time you call Instantiate you will be copying the clone in the scene instead of the prefab itself
var clonedProjectile = Instantiate(projectile, transform.position, transform.rotation);
Why when I use gravity on my rigid body, my vehicle flies away, if someone can help me please ??
Guys my cursor is not locked and is visible on a new project even though I used a script that deals with that already
I know for a fact it can't be anything wrong with the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerLook : MonoBehaviour
{
[SerializeField] private float sensX = 100f;
[SerializeField] private float sensY = 100f;
[SerializeField] Transform cam = null;
[SerializeField] Transform orientation = null;
float mouseX;
float mouseY;
float multiplier = 0.01f;
float xRotation;
float yRotation;
private void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
mouseX = Input.GetAxisRaw("Mouse X");
mouseY = Input.GetAxisRaw("Mouse Y");
yRotation += mouseX * sensX * multiplier;
xRotation -= mouseY * sensY * multiplier;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
cam.transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.transform.rotation = Quaternion.Euler(0, yRotation, 0);
}
}
This code for detecting the beginning and end of touches will only detect the first endTouch of an instance of running the app, and no subsequent ones
While the game is running, isCurrentlyTouching will correctly toggle on and off the first time but just stays permanently on after that point
Hm, if I have two objects with collider2D's on them that are both set to "IsTrigger", can I make those two collide? They don't appear to be driggering "OnTriggerEnter" when they touch. I'm getting some mixed information online.
Would it be a bad idea to try to do this?
Anyone? Please?
one of them will need a Rigidbody2D
I see, but I don't really want either of them to affect physics objects in the scene
rigidody2d can be kinematic for Triggers
So "Body type" Kinematic?
yes
Cool, I'll give that a shot thanks
Debug log Cursor.visible and Cursor.lockState in Update. See if they stay false and Locked respectively
one small thing to be aware of: in the editor, hitting Escape will always show the cursor
regardless of the cursor lock settings in the game
It works now for some reason
I restarted the editor
clicking in the game view will re-lock the cursor if needed
I don't think I pressed esc
Because when I clicked on the game view again it didn't lock the cursor back
I'm aware
Btw does anyone know any cool comic-book style shader for URP?
Most are for SRP
I can't just change all my assets back
URP is a scriptable render pipeline
that's what SRP stands for
or do you mean the built-in render pipeline?
BiRP is also known as Standard Render Pipeline
search the asset store for 'flat' lots of shaders will come up for URP
touchCount is current 0, but the function touchEnded is still not executing, even when all other checks have been removed.
the function will run once per frame the first time but once touchCount rises above 0 the first time it will never fall again
Ah, got it. That's an unfortunate acronym collision.
Got a strange one. i have the enemy player that moves left and right and speeds up based on score. around the screen i have box coliders. but as soon as my score reaches over 80 he seems to push either right or left of screen and goes beyond the box colliders https://gdl.space/mudobamico.cs
Im having some problems with multiplayer and netyworking
what type of transform you using
aight thanks
rb.addvelocity
or transform.position
rb
have you checked the constraints on the sode bpxes?
Vector3 temp = myTransform.position + directionVector * speed * Time.fixedDeltaTime;
myRigidbody.MovePosition(temp);
aight i got this problem now, supposed to be playing playerCrouchHit:
Also, code: https://paste.mod.gg/swdcvhbggqza/1
A tool for sharing your source code with the world!
could it just be speeding up so much as to ignore the borders and teleport?
Why should it be playing PlayerCrouchHit
Nothing in the code plays that state directly and you have no transitions
yh thats why i switched to continuouos speculative
but still pass through
just incase it was a speed issue
but its only one object moving not multi
MovePosition ignores continuous, it's a teleport that also provides collision callbacks
If you teleport all the way past something you never collided with it
Either check your distance manually with a raycast before calling MovePosition or move the object via velocity
is there a reason it detects it at smaller speeds i see it hit the collider
Because at lower speeds its not teleporting past the collider
Didn’t spam
hey guys i made a cube with legs and rigged it with blender does some1 know how i can make it move what dani has so i walk without animations and still ragdols
amazing. thanks did not know move towards teleports
Read #📖┃code-of-conduct and don't post off-topic
The TouchEnded function will not run, verified using the inspector that TouchCount did reach zero and isCurrentlyTouching was true
you set isCurrentlyTouching to false at the top of the Update method
Right, meant to remove that. The issue remains though, except now TouchEnded will run exactly once and never again
that line setting isCurrentlyTouching to false was part of my attempted debugging
Should work fine after that fix. isCurrentlytTouching will be reset to false after calling touchEnd
it'll become true again the next time Input.touchCount > 0 is true
Current script, console log after two touch events, and inspector after same two touch events
TouchCount went from zero, to one, then back to zero, but touchEnded never ran a second time and isCurrentlyTouching stayed enabled
does selectedItemGrid become null?
if you don't think it is, prove that it doesn't by logging its value
I see no other reason (other than an exception being thrown) for touchEnded() to not execute
one moment, adding the log line
THAT'S IT
when the touch is let go, the pointer is no longer on the grid and the selected grid becomes null!
I was trying to transition from mouse control to touch and didn't realize!
that'll do it (:
Thank you so much, this has been plaguing me for like six hours at this point I could kiss you
I have no idea how to solve it but it's not a magic ghost problem anymore
Always verify that the code is actually running! Logging or attaching a debugger can help with that
the script that handles selectedItemGrid is attached to a different object so it never even occurred to me
thank you again
fix was thankfully simpler than I was afraid of, I just made it wait 250 milliseconds to nullify the grid so I can keep all my other functionality that relies on this stuff
Doesn’t change the fact that I didn’t spam
Where’s the spam?
!mute 966393302389784607 1d ignoring warnings
quackkerssss was muted.
Every single message in that image, and every message since then.
I don't know if this question belongs in animation because it's not specifically about how to do it, it's more conceptual so if it does belong there, I apologize.
But can someone explain how animation works within a game loop?
So for example, let's say you have a simple scene with a cube in it. Right now every time a script's update() is called, I update the cubes position to make it move. That makes sense to me.
But let's say I've got a humanoid that has a run animation. I know the humanoid model gets rigged and whatnot but how does that conceptually work in the code? Would the update method just call the animation once? If so, how does it keep getting rendered each frame? Unless it calls it more than once?
My man can’t even behave in front of a mod. Even children know to wait for when their parents are gone. smh
Which is not to condone, but to highlight the lack of self control.
Imagine Animator has Update(Time.deltaTime) called in Update loop.
this advances the animation, if it is playing.
Also, i thought animator was really only for 2D sprites?
And you can see here what animation curves are being used https://docs.unity3d.com/Manual/animeditor-UsingAnimationEditor.html
that page describes when shit happens. It is an extremely useful page
I would not write Move this way
Inside. It's not really about optimization, but more to not clutter the class with members that are not used anywhere else
I would write Move as a function of the movement vector
Move should not be a function of input action callback context
The most efficient code is written in assembly
we can go further
Since the variables here are all value types (structs), then it spares a call to "load the memory address of this class instance" to retrieve the variable values. So, prefer local variables
Because it’s bad architecture/design. With respect to single responsibility principle, Move should solely be tasked with Moving by the amount, not both parsing controller input AND moving
also you don’t want to store more variables/fields in your class. it is actively bad
the fewer fields your class has, the better off it will usually be. within reason
It's insignificant. A few nanoseconds at worst
why are you concerned with optimization if you struggle with basic code architecture?
you are putting lipstick on a pig
focus on architecture/design before you even bother with optimization.
It being insignificant does matter. It makes literally 0 difference, any concerns otherwise are just ignoring how to keep your code clean.
Run the profiler if you truly need to see what's worse
You've spent more time thinking about the difference than the difference would be if it was run 1 million times
then you should speak as though you understand, and not like you still want to optimize your code at the cost of your sanity. Because that is the vibe I’m getting
revisionist history going on
Gone, reduced to atoms
Hey so I want to know if this is reasonable or insane overengineering. I've noticed that a lot of what I'm doing boils down to collecting some group of objects, filtering them, and then doing something with them. I wanted to try making a system where I could dynamically define how a series of objects were captured, and the filtering that would be applied to them, all in the inspector.
TriggerUnityEvents exposes some UnityEvents to hook into when something enters/exits the trigger. It has a filter which will make sure only gameobjects with specific conditions pass. In this case, a specific tag.
This uuuuh, too much?
(moderators can still see edits made to this channel though, so your deletions were logged)
Then why delete your conversation? Doesn't make much sense
quick question, would it be ok if i plcace the wait for second before the if? or inside at the beginning in the if
that wont do anything
how come
you are starting a new coroutine everyframe too btw
do a can shoot bool and run that in the coroutine timer
If you put it before, it'll wait then see if you're pressing F, requiring pretty insane timing to hit the key at the exact moment the coroutine resumes
Your wait does nothing and you're shooting every frame
Wow, my comments look toxic without that context now lmao
but then how do i do so
hold on i think canon should wait like thhat
🤷♂️ the description doesnt really even say what you're doing with them, so it's possible it is a bit over engineered. It might even cause troubles down the line when you want to use your system but it needs more than what unity event provides