#š»ācode-beginner
1 messages Ā· Page 347 of 1
That's definitely a power user perspective. Windows is mainly used for corporations and casual users so it's kind of bulky via indifference, I think
i mean should i commit all the files?
I don't know if you should. That's up to you. If you want to add those files to the repository, then commit them.
point is, we had that flexibility from Win 1 right through to XP, MS has eroded user control of their computers with each new release
while i wait for an answer in another channel , anyone here need help?
all of the commit
you must also push it, the button at the top
So I have implemented a floating joystick from unity asset store. Now I'm having a bug where when I touch the screen for the first time the joystick doesn't move but the player moves to the bottom left direction, only when I lift my finger and press it again then the joystick works normally. How do I fix this?
Le time do after some hours later because I will be at work. Push origin?
yes, right now you have commited it only. its not yet actually on github
once you've pushed it, it will be visible on github
I have started learning C# for Unity and try to do some with my experiance. But the Code doasn't work...
The Consol displays no errors.
Can anyone help me?
Hi there, you should configure your !ide. After doing that you will have much better error handling and we will be able to help you with the issue.
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
you should be checking for Input in Update not Start
What should he configure? He is using Visual Studio and if he didn't had installed the VS Tools for Unity, he wouldn't be even able to open the script/class without errors.
Also debugging is handled via attaching VS to the Unity Editor. (If you want to do it via VS, otherwise you can use Unity debugging in play mode)
Since there is no error in his code, nothing would be found.
that's vs code, not visual studio. and it isn't actually configured
I do it but it doasn't give me any errors.
It's just a general rule that you must have it configured to get help in here. The actual issue is what Steve pointed out
And I have tryed it as Update
and you've clearly not progressed far enough in the unity course you are doing that you actually have any clue what you should be doing here
That's not unity update. Are you calling it from somewhere?
Or are you asking ai to write the code for you?
And the Extantion from VS Code is installed
The Code have I tried by myself
ok, than i continue the course
But Thanks^^
Update() doesn't accept parameters.
hello, i cant hit a raycast at the backface of non convex collider
We know that. You don't need to report it to us.
but i need to hit a backface
it doesnt, i tried
So does that only work for convex? The doc should mention it then š¤
You need to learn about "local variable" "instance variable" "parameter"
Then ask questions properly. It seemed like you're just making everyone know about it.
Is the raycast originating inside the collider?
my mesh has couple of thousand vertices, and i need those for accurate armor protection/balistics, but the raycast doesnt work on backfaces so i cant get the thickness of the armor its trying to penetrate
yes
Well, you can't hit colliders if your raycast originates inside them.
I'd assume it's for "plane" like colliders where the back face is exposed. Not sure.
Or just meshes that have their faces inverted.
Well maybe post image of your mesh to show what it looks like
Yeah I just confirmed, queriesHitBackfaces only works for convex
@icy sluice Either use multiple convex colliders or just primitive colliders (box, sphere, capsule)
box collider doesnt even work
when my projectile hits the target
i move the hit.point 0.001 inside, and shoot another raycast
to get the thickness
What I do is shoot the second raycast backwards
but i dont know how thick the object is, and there are multiple components very close together
so i might get the value that armor is 5meters thick but in reality its 45mm
Why can't you define thickness as a number in code?
Because it depends on the angle, for one
nope, i can make a triangle, if the top triangle is thinner than bottom part it should penetrate the top part but not the bottom part, due its thicker
You can use Collider.Raycast to check only the collider you initially hit
Could do some math based on the hit normal and projectile direction
You'd have to assume that every face of the object is the same thickness. Not very desirable
I mean, you can check the hit triangle
It seems better than making several colliders and raycast hacks to decide thickness.
You could even have a texture that specifically defines the thickness of the mesh triangles.
Doesn't need several colliders and calling it a hack is a bit of a stretch
Having a texture for everything seems like an awful lot of work
Wouldn't it be nice to just rely on the colliders the objects already have?
One per mesh
I'm just not sure what kind of mesh you'd need to have. Is it detailed and hollow inside? If it's detailed enough, maybe that would be fine.
Idk about detail, but hollow is preferred yes
For solid objects, I use this for my projectile/ballistics calculations
For 'hollow' objects (say, a wooden crate) I pre-define a uniform thickness like you also suggested
To be clear, this is how the dual raycast works
Just need to make sure that the 2nd ray starts outside the collider
What keeps you guys motivated? I play this mobile game that is really fun, but super p2w and the devs kinda suck, and Itās been really stuck in my head to make a game similar, but make it better and actually implement the community feedback and things that theyāve been ignoring. Iāve been messing around in Unity but as soon as I get stuck or something doesnāt work I give up lol.
This task seems relatively easy, as itās a simple castle defense game, but coming from no coding experience itās giving me a headache. Give me some motivation please š
There is your first mistake, thinking game dev is 'relatively easy'. It is not, it is damn hard work
Nobody can give you motivation. And if you think motivation will drive you to spend a year making something, you're already destined to fail. Motivation waivers.
What you're looking for is to stay disciplined. Nobody can teach you that either, that's something you need to develop.
Well I didnāt mean developing in general. The game is relatively easy comparative to others
even seemingly simple games are extremely complicated to develop
Oh Iām sure, I just meant in comparison, it is not the hardest task in the book.
Just looking for some tips and advice like that to keep me going on this crusade. Feel like this project has some potential based on the community Iāve been talking with. Just need to keep my nose in this coding world to make it happen
if this is your first foray into game dev then don't do this project. Start small, pong, flappy bird, etc and build up your knowledge and skill level first
Cap
Start as big as itās possible
Ive done that too
Thatās what I meant when I said small, it feels like a project where itās good to start with. Designing a game to have monsters walk in a straight line towards a castle, idk how much more basic you can get than that
Ignoring all the extra stuff, Iāve been keeping at the basics of just movement and collisions and stuff like that
that is because you are only thinking about the rendering you see on the screen, to make all that happen under the hood is not simple
Well you just said to start with a basic flappy bird game, and this is one of those ābasicā games lol. Iām very positive there is more under the hood, but the basis of the game is a ābasic flappy birdā game
believe me, it is not
Make an cool 3d fighting shooter multiplayer with console ole support
So are you saying a basic flappy bird game also has everything under the hood and I shouldnāt even start with that? Iām confused
I was actually thinking of developing the next cod
š
huh? he said start with flappy bird, not avoid it
I'm saying even a basic Tower Defence game is considerably more complex than a basic Flappy Bird game
Yeah, but I said that this game is almost the exact same thing as the basic flappy bird game, if you exclude the extra stuff, and heās combatting it
no, you only think it is, it is not
ok well.
first of you need to learn how to spawn objects, how to move them, how to set the positions, how to get them to stay along the path etc.
thats a lot more than flappy bird
U can script an td game?
and then there is the whole NPC AI mechanisms
its easy if you know what your doing, i could make a basic one in 1-2 hours probably
Huh, yes, I have developed many TD frameworks
I mean not a basic one
With lua?
no
I mean if youāre talking monster walk in a straight line to base, monster hit base, base take damage, I have half of it coded already, just confused where the complexity comes in. Like obviously this is more complex than riding a bike, but the game is pretty āsimpleā, doodled graphics, monsters walk in a straight line, very little animations
why would I Lua is a language for amateurs
well no its not difficult at all, but if you are a beginner new to Unity then you should start with something easier
Yeah, Iāve gotten most of that minus the walking on a path, as these monsters walk in a straight line⦠I feel like itās been a nice and straight forward learning process so far. I just always get lost as to what my next task should be
your next task should be what you want
placing towers, currency, menus, UI, whatever the game needs
if your recreating a game then it should be pretty easy for you to know the next steps
Yeah for sure, I just never know chronologically, but I guess that doesnāt really matter. I still have a good bit I need to do to make the game actually running, but nothing so far that has made me shake my head.
there is no order in which something should be done
you can almost always start with something else and do something else next
I get the impression that you are just doing stuff as it comes to you, bolting carbuncle onto carbuncle without any real design of the whole going on first
it might not make sense, but you can do what you want
Gotcha, I try to go as they come, like I get the monster there, okay now the monster has to move, okay monster hits where it needs to go, okay now it needs to attack, okay now it needs damage. etc. Iām sure thereās some more efficient ways Iāll learn in due time, but the chronological process seems to keep me in line
Its a very nice way to learn if you learn the basics like this and then restart on a fresh project and improve it
but, without doubt, the worst way to develop. You really need to sit down and write a proper GDD if you are serious about this project
I recently restarted my game on a fresh project, it wasnt terrible to begin with, but I learned so many new things about how to structure my project, code and everything else that I can do it much better now
Its very satisfying
I made alot of mistakes the first time around but realized them at some point and ept going till I realized enough mistakes that warranted me wanting to start over
And now I notice less and less mistakes as I work, especially ones that would require me to do a whole restart of the project
Yeah iām looking forward to when I get to that point. Iām sure this project will have to be remade a million times before itās even remotely passable as a game
Dont restart often if you dont absolutely have to, continue no matter what to get it playable at least, fix what you can without rewriting the whole thing
That is the beauty of a GDD, it allows you to identify which are the core elements of your project and then you can build from there
I think a big thing for me right now is as iām doing stuff I try to bite off more than I can chew, get stressed, then walk away for the day, but luckily I keep waking up in the morning wanting to continue working on it. Just gotta keep it simple
just try it lol
I like this advice
Set a task that you can finish within a timely manner
but first you have to be able to identify those tasks, which is where the GDD comes in
If you cannot finish said task, take it a notch lower until you find yourself completing your tasks (games in this case) and are wanting more challenges.
I'm only referring to motivation and enthusiasm. Lack of knowledge and skills would definitely affect all levels of productivity.
i think my first game will be overwatch 3
I agree entirely, bite sized tasks are a must for motivation, I'm just pointing out how you can identify those tasks
Is Nuclino a good GDD website? Is there any information on them in the discord?
Hi guys, do you know some tutorials where I can learn about making AI for unity (an android platformer game) ? (collecting game data [deaths and time to complete a level ] and feeding it into an AI to generate the next level with a procedural generation algorithm )
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
yRotation -= mouseX;
xRotation -= mouseY;
yRotation = Mathf.Clamp(yRotation, -90f, 90f);
xRotation = Mathf.Clamp(xRotation, -60f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, yRotation, 0f);```
can you guys tell what's wrong here?
for some reason the rotation is inverted in the y angle.
For one you shouldn't be multiplying deltaTime into your mouse input
For two, that's just a consequence of how "up and down" in screen space are defined
Just invert it with a -
did you push the gitignore ?
uhh It's gonna be a + but anyways
thanks
i did click on "push origin"
that doesn't answer what I asked..
did you commit the .gitignore file ?
I don't know, i did commit like all the files that were changed

click on History
what about Initial commit
what's initial commit?
oh that one, it's nothing
so you're missing gitignore?
scroll down in the stage 1-1 after all the Assets folder. Do you have stuff from /Library in there too @hushed hinge
thought you said initial commit had nothing..
i guess it was still loeading when i went to there
check at the top if .gitignore is there then
you need it
Judging by the tiny scrollbar I'm guessing they did in fact not have a gitignore
hang on, iƤm getting the screenshot
fuckin-finally
ok so you're good to go..
just make sure you make a commit every time you want to preserve a "state" of your project as it is
jus be aware.
A scene will only detect its changed if you did save and don't have * on it btw
btw you could probably add the .DS_Store in . gitignore (right click add to gitignore)
thats like a macos file only. Its already being tracked though so that might be a pain to now add it to gitignore file type
so... do i need to do something in there since i have that gitignore?
ok
you don't have to do anything else setup wise
ok, but how does that help me with changing the stage 1-1 scene back to how it was before a lot of things were deleted and added?
it helps you if you need to be reverting to a previous state
obviously you don't want to be only committing major changes, you should also be committing small changes too
but also you don't need to revert ALL the files, just the one or two you may be interested in
eg a scene file
That's very unfortunate and as suggested #š»ācode-beginner message
I see no changes though
like this one?
you can rightclick any commit in the History tab on the left to revert it
Or start a branch starting from a specific commit
or this one?
i did right click on it, but i don't se revert option
I said Commit not individual files
you can replace individual files I said from another commit
just be aware this won't restore any files you haven't made commit on
I know,
can i?
the CLI can let you do it with a few commands, manually easiest you would have to download the whole ZIP of previous commit, and cherry pick and replace like that
how do i do that?
right click View on Github and you should be able to download that particular branch
right click view on github?
i did click on view on github, but it takes me to a website, and when i tried to sign in "even though it is my password", I guess i will have to wait......... man i really want it back so badly....
are you sure you want to be reverting to such an old scene
everything you did inside after Initial commit will be gone, might have to replace the .meta file that goes with it too I think.
......... sigh... i guess I will be restarting the building in the first stage 1-1 from the beginning... lik rebuilding for the beginners to play on the first one
time to restart from the begnning in making the first stage
at least this time you're aware of what you need to do to save changes on cloud when you want them
yeah
Is there a way to get the simulated rotation of something? What I'm trying to do is:
Apply recoil to the camera tilting it up. However, I do not want the camera to go past a certain extent in this case 90.
So I want to calculate how much recoil can be applied to the camera before doing so.
For example, if the recoil is 5 and the camera pitch is at 89. I only want to apply 1 recoil. Is there a way to get this value?
is it simply _simulatedRecoilY = transform.rotation.x + _currentRecoil?
transform.rotation.x is not something you ever want to touch
Are you asking about Mathf.Clamp?
If you want to know the angle between the current rotation and directly up, you can use Vector3.Angle(transform.forward, Vector3.up)
Its what I'll use in the final part
Gonna give this a try thanks
Unforunately its not giving me the number I need ill do some goolging
I'm basically trying to apply recoil but have it stop at a certain pitch, the guides that I've found dont take clamp into account
What number is it giving? Could you show your code?
What I think I need is the value of the current pitch of the camera. I'm mainly using this to see how close it is to 90
rotation = Mathf.Clamp(minrotation, maxrotation currentRotation +recoil)
_simulatedRecoilY = Vector3.Angle(transform.forward, Vector3.up) ;
At 90 in the inspector it returns 180
At 90 in the inspector returns 0
that makes sense
at 90 your object will be facing directly down
so the difference between that and up is 180
at -90 it will be facing directly up
which is... directly up, exactly matching world up, with a difference of 0
ah i see now i think i can use this
I just have to do -90 and it reflects what I see in the inspector
Is multiplayer possible with just unity actions? or would it be easier to hook up multiplayer using actions & player input component ?
using the unity input system
What
Are you talking about local multiplayer?
how would i make music fade in and out based on which area of the map im in, within the same scene btw
Then that has nothing to do with the Input System. Each client just reads its own input.
3d sound @molten dock
if you add the sound in hierarchy and select that, will see the 3D option in inspector
You're limited to just a spherical shape with 3D sound, though.
The falloff curve, yes, but it's still a sphere.
like in real live
thats a good feature to know about
is it the general consensus that I should be practicing using JSON instead of Scriptable Objects to store readable data?
Real life doesn't have a music track like video games. There are cases where you may want a certain track to start playing when you enter a room. Not necessarily because there's a speaker in the room, just in the background.
can use PlayerPreff as well for saving data
JSON is good if the data is:
- generated externally
- loaded at runtime
(either or)
ScriptableObjects are useful because you can directly reference SO assets
it meets that criteria
i think i know how to play a song when i reach a collider
confused how i would have it fade out and in
for example, I have a SO asset for each person in my credits list
i just drag them into the appropriate categories
regarding background tracks
if want fade in fade out can be coded
This would be more like "static weapon data" or "a table that is rolled against"
The above model I downloaded from grab cad hence I want to write the script for conveyor movement in unity.
Can any one help?
Probably some manager for that with serialized classes
is there any example you can point me to? beyond me.
If you don't need references to or from the data, then JSON will be easy
namespace Weapons
{
[Serializable]
public class WeaponData
{
[field: SerializeField] public string id {get; private set;} //guid requires some OnValidate/OnSerialization method
[field: SerializeField] public float Damage {get; private set;}
[field: SerializeField] public float AttackSpeed {get; private set;}
}
public class WeaponManager
{
[field: SerializeField] public List<WeaponData> WeaponDatas {get; private set;}
}
}```
**better idea
ty
as in, serialized references you set in the inspector
oic
you'll be referencing things by name (like public string weaponDataID on a weapon prefab) or not caring about specific references at all
like in a drop table: you just need the whole table
(although, how does the drop table know what items to give you?)
it'd have to use item names
That is one big problem with storing your data in something that isn't serialized by Unity: you have to figure out how to store references yourself
if you rename a weapon in one blob of JSON, you need to go fix the names in all of the other blobs
using GUIDs (or some other ID) can help with this
I see
I am trying to find the balance of what should be done in unity, and what in script, when there is the options. I am finding some different opinions out there. I recall reading one commentary a bit ago that went as far as "I find the best way to use Unity is to not use unity" implying that if it can be scripted then it should be scripted
you can do a lot without Mono/SOs, but if you want reusability then you start using Unity's stuff
as far as working in the editor goes
I've been trying to figure this out and look it up, but I cant quite get it... I have a monster spawner thats spawning monsters and they weren't appearing on the game scene, but they were appearing on the editor scene. The projectiles are still being shot at them and killing them... I think I traced it down to an issue with the projectiles/monsters acting in 3d rather than the supposed 2D, ie the picture. I've checked all the layers and they're all set to default (the same one). Is this going to be an issue in my code? Thanks in advance, I'm sure its a simple fix somewhere, but am lost
there is no 3d or 2d
check the Z layer on the projectile and make sure its 0 or above
yeah so they need to be above like i said
Yeah, so I have it so they just follow the monsters in a certain radius. I think the issue is stemming from the monsters spawning not on the same XY plane?
whats a monster got to do with this? i thought you said the projectile is the problem
or wait ist he white the projectile and red the monster?
i thought red is the projectile
I'm an idiot I figured it out by typing... The monster spawner was set to Z: -9 and I just set it to z:0 instead lol
Yeah sorry red is monster white is projectile
i did also tell you that <#š»ācode-beginner message>
Yeah I didn't realize you thought projectile was red so when I checked projectile (being white) it didn't matter the Z axis
but that sparked checking the actual one which was the one you meant lol
simple fix though thank you
So I've installed VS code and the Unity extension and also the Visual Stuido Editor in unity but VS code doesn't show up here.
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (winBattle)
{
winBattle = false;
StaticBattleEnemys.enemy.SetActive(false);
Instantiate(StaticBattleEnemys.rewardItem, StaticBattleEnemys.rewardItemPosition);
PlayerController.instance.gameObject.SetActive(true);
CheckCameraTargets.instance.gameObject.SetActive(true);
InventoryMenu.instance.gameObject.SetActive(true);
CraftingManager.instance.gameObject.SetActive(true);
InventorySlots.instance.gameObject.SetActive(true);
RewardsUI.instance.gameObject.SetActive(true);
PlayerController.instance.transform.position = StaticBattleEnemys.playerPosition.transform.position;
}
}``` is onEnable called before awake?
Anyone else having trouble checking the lessons on Unity Learn?
Could anyone link a good video to learn touch input for mobile?
I'm begging, I understand nothing
what does this mean?
It means DontDestroyOnLoad only works on root GameObjects, or components on root GameObjects
but that doesn't appear when I'm in stage 1-2 scene, but in stage 1-1 scene this warning appears
Probably because you're calling DontDestroyOnLoad on something that is not a root GameObject or component on a root GameObject
but i don't know what it is then...
So check
You know what script it is
Look at what it's calling DontDestroyOnLoad on
Show !code and say what your issues are with your attempts
š 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.
So look at what it's calling DontDestroyOnLoad on and find out which one of them isn't a root object
and either make it one, or don't try to DDOL it
Then how do you know the tutorials don't work
So show what you attempted and explain what isn't working
Then try again, we can't really do anything with zero information
I don't know which one it is if i can't tell since that warning doesn't appear in other scenes
So it sounds like you know exactly which one it is
since you know what scene it happens in
and you know what script does it
what more information do you need
no i don't. they both have like exactily the same things, and i can't tell which object is making that warning to appear
Again, you know:
- Which scene it's in
- What script is causing it
So look at that one
I need help. When I press w the player walks and the walking forward animation plays but when pressing s the walking backward animation doesn't play how can I fix this?
What is the condition for entering the WalkB Animation?
you can see in the picture I made the conditions the same for walking forward i thought that would fix it but it didnt
Your picture has the condition for exiting the WalkB animation
That isn't what I asked for
imo just use a blend tree
no I don't. they both scenes have the same things and the same scripts
Show the hierarchy of the object with this script on it selected in the scene the error occurs in
Okay, now show !code where you set the speed variable when moving backwards
š 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.
your conditions are also backwards
you should make it go WalkB when speed < 0 not Larger
you mean the playermanager object?
I mean show the hierarchy, with the object with this script on it selected, in the scene the error occurs in
Okay, and when walking backwards, what is velocity.z?
how do you check the velocity?
-4
And is -4 greater than 0.1?
so In the conditions do i put -4 then? sorry im still new to this
When do you want the backwards animation to play
when I press s I want it to play
but your condition to WalkB is "larger than 0.1" that makes no sense
These are two different scenes, and the object is only selected in one of them, and that one isn't the one the error occurs in. You should actually try reading what I asked for
what shall i put it as?
So what is the condition that you want to check for in the animator?
well if you're going in the negative numbers when press S, what do you think
What is the speed value you are expecting to be at when walking backwards
yes but when I put -4 the animation plays when im not even pressing s
ok
why did you put -4 exactly also which one did you change
to both of them
so you're just gonna do random shit and hope for the best or what?
rethink the logic of your transitions
what is the speed when you want IDLE -> WALKB
Think about when you want the animation to start, and when you want the animation to end. Whenever those conditions are met, it'll change animations
So, when do you want to start the WalkB animation?
To idle to walking backwards I put it as -4 but the animation does play when i go back
show both transitions you changed
Okay so I configured my IDE but I still can't get the damage script to work, the original one didn't show any issues in the configured IDE either, I've also tried this but the damage still isn't being delt, any ideas as to why that might be?
using System.Collections.Generic;
using UnityEngine;
public class Damage : MonoBehaviour
{
public int damageAmount;
float cooldown = 0f;
private void Update()
{
Debug.Log(cooldown);
cooldown -= Time.deltaTime;
}
private void OnCollisionStay (Collision collision)
{
Player player = collision.gameObject.GetComponent<Player>();
if (cooldown <=0)
{
player.TakeDamage(damageAmount);
}
cooldown = 1f;
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour
{
public int player = 100;
public void TakeDamage (int damageAmount)
{
player -= damageAmount;
if (player <= 0)
{
PlayerDead();
print ("is dead");
}
}
private void PlayerDead()
{
GetComponent<MouseMovement>().enabled = false;
GetComponent<PlayerMovement>().enabled = false;
}
}
So if the condition to start the animation is when speed is -4, when do you want it to stop
I want it when I stop moving
So what is the value of speed that you want to check for to have it stop moving
where is the console window?
are the logs printing
These are.
I want to stop the walking backward animation when the player isnt moving so 0
then use that
I put the condition as 0 but it doesnt do anything
So it's stuck walking backwards?
put logs in OnCollisionStay
no the animation isn't playing at all
So then that likely has nothing to do with your exit condition
and more to do with your entrance condition
since it's not entering
did you check its actually going in that state
so what is that condition?
Now there aren't any. :/
the condition to idle to walk backwards?
yes
its -4
then the function isn't running hence why it never damages
-4 is not a condition. A condition is a comparison
Meaning there is an operator and a number
still waiting on this šŖ¦
So what is the actual condition
lol why does discord blow up pngs wth
Okay but why isn't it running? It's on the sword, the sword has a colider, so does the player.
how do I check it?
With your eyes, Bert
at this point you need a crash course on Animator
instead of guessing your way through it
Okay, and is -4 less than -4?
do you have a rigidbody
Does anyone know how to check what caused this issue? I go through every game object and i dont see any script missing
your math aint mathin
holy shit im dumb
you had it fine before dude , it was just backwards
lmao š realised what I did
haha
more likely you saved script changes during playmode
On the player, sword, or both?
one of the colliders
also OnCollisionStay expects you to hold a collision
dont think its like OnCollisionEnter
wait the walking backward animation is playing but only half of it how do I fix this?
did you set the animation clip to loop? also what is the exit condition set to ?
Ugh... Thanks, would never come up with that myself. :'3
the loop is on and the exit condition is set to 0
so does it work if you hold S or only when you let go plays half way?
when I hold s the animation plays but only half of it
can you record a video?
select the animator thats on the object during playmode while you hold S
I cant I aint paying for nitro lol
send it via here if its too big
https://streamable.com/
show me your exit condition
What is the condition to go back to idle?
Pro tip when making a video take a second to show through all the transitions
#š»āunity-talk not really a code question
why is the condition less than 1
makes no sense
thats still smaller than -1
your conditions are fighting each other
what is it supposed to be?
would -4 be good?
why are you putting -4?
also whats gonna happen if you ever change your speed?
now your whole animator breaks
don't use exact numbers
you had the right idea before
it was just backwards
it should've been Smaller than 0.01 or whatever for Idle->WalkB
Greater than -0.01 should've went to to WalkB -> Idle
I feel like if I don't tell you directly we're gonna go all day here lol
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
check the pinned messages and start from there . . .
This is not a place to find a tutor. Here you ask the particular questions.
As in via Material.SetColor ? You need to use "_BaseColor" (actual property name) with it.
You should be able to set the color using the Material.color property
public Color color { get; set; }
One message removed from a suspended account.
color.set calls the SetColor
Material.color only works when property name is "_Color" or attributed with [MainColor]
One message removed from a suspended account.
What do you mean "how" I literally told you
One message removed from a suspended account.
set
{
int firstPropertyNameIdByAttribute = GetFirstPropertyNameIdByAttribute(ShaderPropertyFlags.MainColor);
if (firstPropertyNameIdByAttribute >= 0)
{
SetColor(firstPropertyNameIdByAttribute, value);
}
else
{
SetColor("_Color", value);
}
}
One message removed from a suspended account.
yo, how long has this existed?
i've been under the impression we needed to copy the material out in a variable to change its color
One message removed from a suspended account.
pingd the wrong person.. but im sure his response would be the same lol..
for a very looong time, haha . . .
unity 5 days . . .
gotta remember that one
Is it possible to create systems/mechanics that interacts with each other in Unity and if yes, is there like starting point that, you guys can recommend?
yes. you just code it
thatās an extremely vague question
yes; without either, you wouldn't have a game . . .
Yeah, it's mostly about systemic game design way and I'm not sure how to describe it better than that to be honest.
start with the flappy bird tutorial
work your way up
š“ 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...
which one? there are tons of them. pick another one . . .
and I already gave you a tutorial to follow
i doubt multiple tutorials all do not work . . .
if everyone else here can make flappy bird following that tutorial, then you can too
itās not rocket science. itās flappy bird
if everyone else can make flappy bird work, then it is a you problem. not a problem with the tutorial
This is an English speaking server
but I do wonder if a <@&502884371011731486> cares?
If you have nothing useful to say you can stay silent
wth your problem
idc anymore, because i blocked the guy. heās your problem now š
Why would you make people translate the sentences from the language they don't know if you can simply translate the sentences from your language to English?
what's the point of even being here? why do people waste their time?
you wasted your own time by not starting from the basics
you should start with the basics of c# first. that will help get started . . .
This is a really great purpose. You're gonna get far with it!
Sooo I'm trying to make a game over menu, I don't have the option for just a Button, it's either Button (Legacy) or Button TextMeshPro
The latter is what you want.
Okay cool so piss off until you have something to actually ask a question about
A Button is actually just a component that makes another graphic clickable. It doesn't do anything else.
yes Button is simply a Button component with a Text component, so you want TextMeshPro
ty
Protip: It's not the tutorial, it's you
also, if you have trouble with the tutorials, you should ask for help and provide where it went wrong . . .
So "Button - TextMeshPro" is a pre-made object with an image and a child text
I feel like that's when a moderator should be pinned, no?
!mute 894144860653781022 3d Stop being annoying
chalurr was muted.
speak of the devil
whenever in doubt with UI, Textmeshpro/TMPro is better than the alternative
this is why you need to ping mods early
hello guys
I'm just gonna go ahead and count it anyway. I doubt I even need to see it.
"I did it exactly like the tutorial so why does theirs work and mine doesn't" counter:
Number of times it wasn't exactly like the tutorial: 161
Number of times it was exactly like the tutorial: 5
Number of times the code literally did not exist: 1
2022-07-19 to 2024-5-15
or make your own buttons with IPointerHandler š
new server policy: please ping mods before you do something that would get mods involved
thank you
š
my spidey senses were tingling
yes
i felt an unrepentant troll vibe
;-;
hi
hi
if you donāt have a code issue, check another channel
such as #šāart-asset-workflow
Someone Need Help With The Texture I Make Like Heron
This is the same channel
yes
you didn't actually go to a different channel
;-;
This does not appear to be a code question
;-;
either way, this discussion does not belong in this channel
are you saying you made a new account to circumvent a mute?
Do questions about the textures belong in #archived-shaders ?
please go to the right channel, or the mods might have to escort you
I don't think they understood the question and are a different unrelated german guy
what?
oh ok lol
i also believe so
nothin
i believe this person does not english good
please post your question clearly in #š»āunity-talk
So give me a friend request if you want me to create the drawing
is it mod time?
Wait, were you trying to sell commissions and don't actually have a question at all?
We do not accept job or collab posts on discord.
Please use the forums:
⢠Commercial Job Seeking
⢠Commercial Job Offering
⢠Non Commercial Collaboration
I just wanted to do something with my life ;-;
then start by reading, and following the rules
You've been told many, many times this is a channel for code questions
;----------------------------------------;
<@&502884371011731486>
bye ;-;
What is going on today
idk, but Iām on fire

Pull out the community mod gatling gun
just so you understand, only after I ping the mods can he suddenly understand any words
which is why i do not feel bad at all
"Wait, my actions have consequences?"
Looks like they left
youāll get them next time, danny
This pfp looks so fitting for moderator š
!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.
these are all static variables
so you are SOL when it comes to debugging
there are a few things you can do, but itās quite limited
I figured your question would make more sense when half of it wasn't in spoiler tags but I still have zero idea what you're asking. Is there context I'm missing
sorry whats SOL
shit out of luck
oh lol
if you used a singleton, it would be easier to diagnose wtf is going on
and why it is null
yh sorry some are null and some are not if (GameManager.instance.battleActive && !loadBattle) { loadBattle = true; StaticBattleEnemys.rewardEXP = rewardXP; StaticBattleEnemys.playerPosition = GameObject.FindWithTag("Player").transform; StaticBattleEnemys.enemy = enemy; StaticBattleEnemys.enemies.AddRange(battleEnemys); StaticBattleEnemys.SplashScreen = battleSplash; StaticBattleEnemys.rewardItemPosition = gameObject.transform; StaticBattleEnemys.rewardItem = rewardItem; StartCoroutine(LoadBattle()); }
!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.
read
Then the ones that are null have been set to null
again
You are setting a lot of variables to things here. If it ends up null, then whatever you're setting them to is null
they are in marks what do you mean
my definition is digiholic explicitly asked you to use a pastebin, and you did not
no, digiholic was asking Ginja to fix the weird blob of spoiler tags
yes thats what i thought
that is not a huge block of code. posting it inline is fine.
it's just missing the "cs" after the opening backticks to give it syntax highlighting
ok thanks ill see if im setting then null some where but i dont think i am
let the man say what he meant
Actually I just wanted it in backticks because before he edited it half of it was redacted like the CIA found it. Although having the whole script in a bin would be nice
But a coherent question was the missing sauce there
you should verify that the references aren't null when you assign them
"i don't think" is insufficient.
wait, is the whole point of this method to assign instance variables to static equivalents?
its not null
so then what's the problem
to pull the static vars
im not calling null or changing it any but here
i have no other reference to it
Why do you think some of them are null?
I literally do not even know what the problem is
what is the tangible error you are running into?
You've just said "some are null" but not what "some" are or what they should be or even how you're determining this information
you don't get bonus points for being mysterious (:
So when i go into a battle the battle starter passes the some bits of data to the battle scene
2 ticks
then i do my battle stuff, then when i return to this same scene i want to get thing like the player pos, enemy so i can set it deactive and then the reward prefab
but not all of then seem to be saving to the static class
Okay, and how do you know that?
my satic class
You have not shown us an error or an example of any of these things being null
because when i enter the battle scene i get this
What, specifically, is not saving, what should it be, and how do you know it isn't
UnityEngine.Debug:Log (object)```
send us the classified documents . . .
{
Debug.Log("|Splash Screen " + StaticBattleEnemys.SplashScreen + "|" + " + " + "|" + "Reward EXP " + StaticBattleEnemys.rewardEXP
+ "|" + " + " + "|" + "Player Position " + StaticBattleEnemys.playerPosition + "|" + " + " + "|" + "Reward Item Position " + StaticBattleEnemys.rewardItemPosition + "|" + " + " + "|" +
"|" + " + " + "|" + "Reward Item " + StaticBattleEnemys.rewardItem + "|" + " + " + "|" +
"|" + " + " + "|" + "Enemy " + StaticBattleEnemys.enemy + "|" + " + " + "|");
}```
Do you destroy the enemy as part of the battle..?
no
i notice you have both enemy and enemies; what's the deal with that?
yes enemies are battle enemie prefabs
enemy is the game object form the main scene that holds the battle starter
and does that object still exist...?
no i guess not as its a new scene
well there you go. that object is gone
if i made it a prefab would that work
then wouldn't that be the problem?
that wouldn't make any sense, because it'd be some random prefab
not the thing you bumped into
So why would it remember the player pos but not the reward item pos, which is the enemys transform
both of them objects are not in the new scene
Okay this is miserable to read so I'm going to fix it:
Debug.Log($"|Splash Screen {StaticBattleEnemys.SplashScreen} | Reward EXP {StaticBattleEnemys.rewardEXP} | Player Position {StaticBattleEnemys.playerPosition} | Reward Item Position {StaticBattleEnemys.rewardItemPosition} | Reward Item {StaticBattleEnemys.rewardItem} | Enemy {StaticBattleEnemys.enemy} |");
perhaps the player was moved to DontDestroyOnLoad
what does $ do
String interpolation.
yes you are correct
It lets you insert expressions into a string
If you want to be able to return to the overworld after the battle happens, I would suggest using additive scene loading.
Additively load the battle scene, do the battle, and unload the battle scene
the overworld will be exactly where you left it
you'll just have to make sure nothing happens in there while the battle is happening
(you could deactivate all of the objects in it, for example)
thank you
ok, i think i do have moving objects in that scene. Does it just sit over the top?
imagine loading a scene means putting all of the objects in it onto a stage
additive loading means you combine multiple scenes on the stage
the battle scene won't be "on top" of the overworld scene
they'll just both be present
ok thats interesting, i will look into that but for the moment is there another alternative? i just want to keep a ref to the enemy
don't unload the overworld
that's it, more or less
if you unload the overworld, every single object in it gets destroyed
blimey lol
If all you care about is preserving the object, I guess you could DDOL it too
why do you even need a reference?
could i set a bool so say there are 10 npc and each one get there own number, could i pass that, then ref that as a unique id would that work
or is that to messy
sure, you could store an identifier
that would let you find the NPC after you load back into the overworld
if you was to pick one what way would you do it
i would try to do additive scene loading, since that also means the overworld doesn't need to be completely re-created every time you leave a battle
although, a sufficiently good save-and-load system would make that less of an issue
if I was going to do single scene loading, then I think I would use a ScriptableObject to uniquely identify each overworld NPC. Each NPC would have an NPCInfo field that references an asset
you could make a dictionary that maps NPCInfo to NPC when the scene loads
you'd store the NPCInfo in your battle manager so that you can remember who you just interacted with
Im gunna give the additive scene loading a go, would that mean that the whole game would be built that way
you can still single-load scenes if you don't actually need to keep the overworld open
ok cool, one last question if i was going to build a big game like say super mario world or somthing like that. and i added that all to one additive scene would there be performance issues, or is that way to big. the reason i ask is there is prob going to be a battle in every scene
my thinking was maybe make every scene 2 scenes
You could have many overworld scenes if you wanted to.
You'd probably just have one battle scene
unless you need very different setups for different kinds of battles
some battles different envirmoments
like paper mario
How to load multiple scenes at the same time, both through script and while working in the editor. Talks about some of the challenges of working with multiple scenes in Unity.
it says i cant ref things from 2 scenes, but static would work?
around the 50 sec mark of that video
you can't put a reference to a Scene B object in Scene A, no
but you can find things in Scene B from Scene A, or have a singleton that helps you to find things
thank you
SceneManager.LoadScene(1, LoadSceneMode.Additive); sorry what did you say about unloading a scene
i just walk back in, to find the solution being the singleton that was proposed an hour ago
I'd advise against trying to mash this into your existing project. Perhaps you should try it out in a smaller test project first.
(or pursuing a different solution)
If your overworld doesn't change very much, then it'll be easy to load back into it after the battle is over
SceneManager.LoadScene(1, LoadSceneMode.Additive);``` sorry i was missing code, sorry what i ment was do i need to add a second paramater
well this would completely unload whatever scene 0 is
the premise was that you would keep the overworld open as you load the battle scene
then unload the battle scene
i dont understand what the issue with my code is can someone help me please?
start by telling us what doesn't work and what is expected to happen . . .
if the Y position is less 2 than then the player position = bridge positon + (0,2,0)
sorry for not clarifying
the ")" is giving an "invalid" error
Because you have a random < right before it
its not random
look at your if statement . . .
its a less than
why is it there
what is 2<, that makes no sense . . .
Hi. I might need some help with this. I have two levels, one in which i dont have assigned the rigidbody thingy assigned and it works just fine. But now, i moved the players to another scene and it shows this error although it "works fine" but now is messing with other scripts.
becouse i want it to happen if the Y is less than 2
Then you should check if y is less than two
rather than equal to 2<
Which is utter nonsense
then why do you have == 2? also, that is not how you check if something is less than a value . . .
i suggest searching how to check if something is less than a value in c#. that's a simple search and basic c# . . .
hi i have an issue
okay
so i made some 3d moving code and everytime i press play i just fly in the air
i think i know whats wrong but i do not know how to fix
i have 2 seperate codes one for the camera alone and one for moving and i have a player controller on the Playbody that just dissapears once the game starts
make sure there is no semicolor in the IF statement if u have one
i made that mistake before
guys i'm have a trouble with my editor
it might help to provide your code. not sure how else we can tell what is wrong . . .
The code isn't auto completingf
heres a before an after
i do not use if statements in the moving script only one which seems to work fine š
!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
does it say Assemble-CSharp?
ty
i'm using rider
oh
!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.
then follow the link for Rider . . .
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
this is the Looking Script
Does the object with this script on it have a CharacterController component as well?
anyone won't answer there
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
no
again, as it seems like a coding problemāand this is a coding channelāit may sound crazy, but we need to look at the code . . .
i just sent the code
Then why are you setting CP to this object's Character Controller in start
it is already instaled, but i still haveing the same trouble
Then configure it using the linked guides
did you follow the link suggested?
Yes
Show the inspector for the PlayerBody
Amm the issue is that i am doing like a videogame and i have a weapon and this throw projectile, i added a script an then this has appeared
don't ask to ask, just ask . . .
uhm actually im having a wierder issue i just turned off the code and i am still flying
Show the inspector for the PlayerBody
all my things are like that, idk why
Hello! I am working on a game that uses different scenes for different menus, but the problem is that when I press a resume button on my pauseMenu scene everything in the main game scenes just sorta resets, the player position, all checkpoints gotten etc. I know I could probably cook up some code that saves that data but I was just wondering if there was any setting that saved it to the scene during the runtime
look at the scene view. is the character still on the ground or flying/falling through the air?
those are just warnings based on the coding style. look for the actual errors . . .
Noo i'm talking about the code isn't auto completing
errors must be fixed before you can enter playmode . . .
okay, did you follow/complete the link?
uhm the error fixed itself
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
you mean these steps?
close out the IDE and Unity, restart, open Unity, open a C# file (from unity) and your IDE should open up . . .
thats what the title says
yeah but i dont understand the code error
What does the error say
What is Enemy
The rat is the enemy
What is the type Enemy
That you are referring to in code
Show the code for it
What is Enemy
Basically your object with a tag "Enemy" wants to find a script attached to that object called "Enemy"(this script doesn't seem to exist or is not attached to that object?)
Class Enemy does not exist, there should be a red underline on line 27. Since you don't, you need to configure VSC to get the full programming tools the code editor provides
!vscode
helo can someone help me with something im stuck on
My script is to make the player crouch slide when press " C " but the transition to crouch is not smooth. What I need help with is smoothing out the localScale with the code I have since it snaps to crouching and back standing.
here is the code
you'll want to change the scale over time rather than just immediately assigning it to your desired scale. you can do that using lerp or movetowards in Update or a coroutine
thank you will try
I have another question. Im going to go with the additive load, now i wrapped my town scene in a empty object so i can just toggle it on and off. and when i end the battle i well unload the scene(detroy). But what if i also want to load into a house. would it be silly to also keep that in the same scene? and i would have to wrap that in an empty too becuase i dont want to delete that. So really the only purpose of using additive are for battles. would that look messy having some that can be unloaded and some that can not?
how can i fix it?
fix your animation transitions
how can i do that?
welll the death animation should probably not be loopin
Hey, I''m spawning an object using Instantiate(prefab, parent);, the gameobject reference is stored properly and even after few frames the scene and transform all seem right. But the problem is that the object is not showing up in the unity hierarchy at all, like it doesn't even exist
i know theres a or which is like II but idk how to get the long I
it's likely being destroyed if you don't see it in the hierarchy at all
||
wouldn't the reference in my script be destroyed then too?
thank you
its not
it would equate to null using the == operator, but the reference itself would still point to the same object in memory since c# does not have the concept of "destroyed"
okay so I can check if it's being destroyed by doing if(chunk == null) Log("destroyed");
you can also put a log in OnDestroy if you want to check if it is being destroyed
ah makes more sense i'll have a look
{
Speed = 10;
Stamina -= 1 * Time.deltaTime;
} else if (Input.GetKeyUp(KeyCode.LeftShift))
{
Speed = 5;
}``` hey guys i have an issue with my tiny code
when i activate running mode the Stamina only goes down once instead of going down periodically
Don't you want Input.GetKey?
GetKeyDown is only true for one frame
no im working on a spring mechanic
no GetKey is
wrong
nope only being called when I stop playing
What made you think that
You can just look these things up you know
What's wrong with what you have once you fix GetKeyDown -> GetKey?
yeah but its
emĀ·barĀ·rassĀ·ing
so if i change itt to GetKey instead it will work?
isn't it more embarassing to be publically incorrect?
i was thinkking maybe using a bool
oh u meant they KeyDown
It's blowing my mind that you are still here instead of trying it
sorry i just had to be sure
is the way im even adding springing good?
and yes it works 
I don't see anything related to "springing" here
then either you are looking at the wrong object in the hierarchy, it is being reparented to some other object, or you've put the ondestroy log on the wrong object š¤·āāļø
Oh I guess maybe you mean sprinting?
meant to say sprinting*
seems fine ĀÆ_(ć)_/ĀÆ
alr cool now i just need to make it so after some time it will regenerate
which seems easy right?
just another if sentence
whats the not equal sign?
!= right?
I mean i type in the correct name from the object in the hierarchy so should pop up if it's in the scene no matter where it is and I'm sure its the right location because when my debug log hits in the ondestroy when ending the play session it's the correct objects that i'm looking for. It's a bizzare issue and only happened after updating unity versions :/
at first I thought it was because it had invalid scene references but I fixed that issue and the scene reference is now same as the other objects in the scene
show the full relevant code
what do you mean by "combo"?
var instance = Instantiate(prefab, parent);
Debug.Log($"Click here during runtime to see where {instance.name} is", instance);```
like if running = true and or jumping = true
oh
For reference if you want if only ONE is true and NOT the other, that's called "exclusive or" aka "XOR" and it's != for logical exclusive or and ^ for bitwise exclusive or
https://gyazo.com/318e4e164404692151d5cc6d3db8ad9c idk everything seems correct to me, even the scenepath is as it should be but its just not there
click the log in your console and it will highlight the object in the hierarchy
https://gyazo.com/f66fb6f0db6e6c7823d3d3ba039ced76 not showing anyting, I just click the log once right? double clicking goes to the line of code obviously but otherwise nothing happens
whats wrong with this magnitude check? it doesnt work properly
Can you elaborate? What is improper about it?
its settingg the closest cell as the first one in the loop
even though its not the closest
what doesn't work about it? what is expected to happen?
Maybe you should add some Debug.Log statements
to print out what distances its finding
and what it's comparing them to
its expected to find the closest distance between the impact and the cell and set that rigidbody to not kinematic
i did that and the distance is being calculated proprely
so im at a complete loss
Well your code is setting kinametic false immediately
rather than waiting until you find the closest one
you need to do the whole loop first
then set kinematic = false at the end because only then have you found the closest one
yeah i did that for testing purposes my bad
otherwise you're just doing it on each one that is the "current closest candidate"
There might also be only one object, so the loop is executed once
but its only setting one to nonkinematic anyway
no multiple distances are printed
Ok and how do you know that's not the closest?
what distances?
because its not lol
show us some more info
log each cell distance with their GameObject name. then you'll have the output for the closest one. compare it to the first cell and you can see if it's correct . . .
we're in the dark
the distances from the impact point and the cell
okay hold on
ill send a video or something
btw your code is also only printing distances for the ones that are not closer than the previous
create the log, run the code, send a ss of the log from the console . . .
it's not printing the distance for the ones that are closer than the current closest distance
basically - once you actually debug this, I'm sure it will become obvious what the issue is
putting that print outside a conditional would be a good first step
that is true. also, did you want to set kinematic to false for every GameObject that is less than the current distance?
okay ill debug more
no it was for testing im gonna fix it now
narrowed it down to the cell having a fixed position because its parented to an empty
so it doesnt matter where i shoot i get the same result
but position is meant to give the world position so idk
hey guys im in unity andi have a post processing effect in my game and im trying to acsess the field of depth through my script how can i do that?heres my code
is it even possible to acess depth of field from script?
if it is how can i?
use the GetSetting method on the PostProcessProfile
https://docs.unity3d.com/Packages/com.unity.postprocessing@3.4/api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.GetSetting.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_GetSetting__1
@slender nymph like this?
PostProcessProfile is not a component
did you even look at what your previous code was?
oh yeah
oh
ok i tihnk i igot it
lemme check now
@slender nymph thank you
it works now i fixed
little update from my issue, I found them back in the hierarchy now after changing their HideInHierarchy flag, not sure what caused that to turn on but probably the same reason that they are greyed out even though they are activated and their activeInHierarchy is true as well, can't seem to re-enable them either through the editor so not sure what is going on here?
are you using version control?
i found a thread saying this guy hadn't checked out certain assets and they were greyed out until he renamed them.. which they became visible (b/c of having a different name associated with it).. thats the only thing i see off hand
Anyone know if its possible to transfer custom normals between meshes within Unity itself? I have an imported FBX of a mesh with weights and blenshapes. And another without those, but has the custom normals. I want to transfer those normals to the first mesh (they have identical vertex order.)
I have a problem with my spherecast that I am trying to use as a groundcheck. For some reason, ground is only detected for a fraction of a second and then the spherecast returns false.
//only showing relevant code
public Transform orientation;
public float playerHeight;
public float playerRadius;
Vector3 direction;
RaycastHit hit;
public LayerMask groundLayer;
direction = transform.up * -1.0f;
grounded = Physics.SphereCast(orientation.position, playerRadius, direction, out hit, playerHeight, groundLayer, QueryTriggerInteraction.UseGlobal);```
no matter how large I set the player radius to or how tall player height to be, it still returns false
just github so that shouldn't be the case
Iām trying to load a scene from a video and every time I do it there arenāt any textures
It only purple
I download the shaders he had to and that didnāt work
not a code question, but if all of your materials are magenta then you are using shaders that are not compatible with your render pipeline. you need to convert the materials to shaders that are supported on whatever pipeline you are using
How do I do that
depends on what render pipeline the materials were designed for and what pipeline you are using. but you can usually just change the shader on the materials to one supported by your pipeline and reassign any properties that weren't automatically remapped
are you sure that the spherecast's initial position is not intersecting the ground?
my second question is if you disabled any mesh collider optimizations
I was able to find an asset to visualize the spherecast and found out that for some reason it only works when the radius is set to 0. It works fine now, though.
that shouldn't be the case
Man idk how to do that
well how about you start with providing literally any useful details, such as what render pipeline you are using, and what render pipeline the tutorial uses
I donāt know what a render pipeline
And weāre in the beginner chat so donāt expect everyone to instantly give details
then you can easily google that
I'm using SpriteRenderers' bounds.Intersects() function in order to detect if an object can be placed in a spot in a grid-like placement system (to ensure that it does not overlap with other objects). However, this function seems to return true even when the objects aren't touching; when they are directly next to each other, the function still triggers. How can I fix this?
void Update()
{
Vector2 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (Input.GetMouseButtonDown(0))
{
if (mouse.x >= 0 && mouse.y >= 0)
{
GameObject model = Instantiate(selectedBuilding.model);
float newX = selectedBuilding.dimensions.x % 2 == 0 ? (int)mouse.x : (int)mouse.x + 0.5f;
float newY = selectedBuilding.dimensions.y % 2 == 0 ? (int)mouse.y : (int)mouse.y + 0.5f;
model.transform.position = new Vector3(newX, newY, model.transform.position.z);
Renderer modelRenderer = model.GetComponent<Renderer>();
int amountOfBuildings = buildings.childCount;
bool survived = true;
for (int i = 0; i < amountOfBuildings; i++)
{
GameObject building = buildings.GetChild(i).gameObject;
Renderer buildingRenderer = building.GetComponent<Renderer>();
if (modelRenderer.bounds.Intersects(buildingRenderer.bounds))
{
survived = false;
Destroy(model);
break;
}
}
if (survived)
{
model.transform.parent = buildings;
}
}
}
}
bro my jumping isnt working anymore
neither is my dashing
ive tried to find whats wrong but cant
if someone can help me ill give them more information
show relevant code
and Don't Ask To Ask. don't wait for someone to be available, just ask the question and provide relevant details at the time you ask your question so that whoever is helping you doesn't have to try and persuade you to provide the details that #854851968446365696 says you should include
oh and do not DM users without permission. i will not be accepting your message request, you can get help here
ok im sorry
its one of my other scripts that are messing with the jumping
ill try and figure it out and comeback here if i cant
you can share your code here if you need help
question
let's say there exists a function
{
transform.localScale = a;
}```
how would i extend this function to work on any compatible property (position, for example)
pseudocode describing the desired effect
```arbitraryFunction(targetProperty p, Vector3 a)
{
p = a;
}```
To try to fix this, I just tried playing with the OverlapCollider function, looked at its documentation, and am stumped because it is not working. Can someone help?
Collider2D collider = model.GetComponent<Collider2D>();
ContactFilter2D filter = new ContactFilter2D();
List<Collider2D> colliders = new List<Collider2D>();
if (collider.OverlapCollider(filter.NoFilter(), colliders) > 0)
{
Destroy(model);
}
else
{
model.transform.parent = buildings;
}
Well, if targetProperty is a reference type, then the latter code would work as is.
oh, thank you
Assuming it has overriden the assignment operator such that vectors can be assigned to it.
sorry, i don't follow
hello everyone
for example
{
float timer = 0;
Vector3 initScale = transform.localScale;
while (timer <= animationTime)
{
if (animationTime == 0) break;
transform.localScale = (initScale - targetScale) * Mathf.Pow((timer - animationTime) / animationTime, 2) + targetScale;
timer += Time.deltaTime;
yield return null;
}
transform.localScale = targetScale;
}```
I have a card animation that locks dragging movement. I wanted the drag movement to resume after animation is over. Is there something to do that?
how do you lock it?
do the same to unlock it
oh nvm, it works without lockign
i would like to extend this to work with not only localScale
right now i am storing this in a specific MonoBehaviour class.
The solution I am thinking is to store this IEnumerator in a ScriptableObject so other classes can access this, but I'm having trouble finding a method to replace the transform.localScale with a more general version.
Is this a good solution? If it is, how would I change it to accomodate any valid property and if it isn't what would be a better option?
(it is at times like these i wish i could use pointers as implemented in c)
Hello, ive been trying to figure this out all day, but im still pretty new to coding. I have a script to make the player crouch slide when press " C " but the transition to crouch is not smooth. What I need help with is smoothing out the localScale with the code I have since it snaps to crouching and back standing. I tried adding lerp, but im having a hard time implementing it from the code I have since im accessing the playerobj