#💻┃code-beginner
1 messages · Page 115 of 1
If you're trying to check if the canvas is acative, why are you checking if this object is active
i dont actually know hang on
let me look at the original code because i deleted a ton of stuff before
https://hastebin.com/share/ejiqulukaz.csharp am trying to raycast from a camera to an object with a mesh and delete voxels from the mesh. works fine when clicking the bottom and 2 sides of the voxel but not when clicking the top or 2 other sides. I can link the spawner code too if needed
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
oh my god ive been looking at code that doesnt do what i need it to
stop using generative AI then
i need to essentially check if the canvas is active then turn off my script because my menu is open, if the canvas is off then enable the script so i can look around
after that im going to
that is horrendous
i really am sorry @polar acorn ive been so confused
plus its 3am, and ive been working on this since about 9pm
Well, Merry Christmas then
merry christmas to you you absolute angel
If anyone has some answers that would be sweet, also if i need to clarify or add more I can.
I would have done inline code but I dont have nitro
Your voxels probably have flipped normals on some of the sides, the ones that aren't detecting the raycast. If they're voxels, wouldn't it make more sense to use a BoxCollider instead of a MeshCollider?
It's one big gameobject thats generated with one mesh, they arent individual gameobjects with colliders
@polar acorn is it possible to code it so that picking up a specific item, sets a trigger, so i can enable a button?
Ah, MeshCollider makes sense then. If it's generated, then it's possible that some of your faces have backwards normals. MeshColliders are one-sided based on the normal of the triangle.
Unity is Turing-Complete, so the answer to every "is it possible to" question is "yes". But as to how it depends on what you mean by "picking up an item" and "sets a trigger"
and also what you mean by "button"
im gonna make a legend of zelda progression/ item system, so instead of having an inventory, i want to make it so that all of the slots are disabled in my inventory, so that when i pick up the flashlight, it sets off a trigger, and enables the button, which then allows me access to the torch whenever and where i want
Are you using Unity's CharacterController?
How would I know if any normals are backwards? The object generates correctly
What does your controller use for movement then? If not rigidbody or colliders, then how is the trigger message being sent?
If it's not an actual mesh file you can open in Blender or some other 3D software, there's not really any reliable way to view them
did you generate/calculate normals when you generated mesh
just UV vertices and triangles
I did add recalculatenormals
on my torch, there is an equipped checkbox, so could i use this to my advantage, to set a one way equip? meaning that once its checked it stays checked? in which i could then use that to keep the button enabled, in some sort of checklist?
Although I am only Recalculating normals after the mesh if generated, should I recalculate normals in my generation method?
afaik you only need to recalucate after you modfied the mesh/verts
yeah I also make sure to to that each time a voxel is deleted, do you think its worth the time to dink around with my vertices declarations for those faces and see if that helps?
how do i make checkboxes in my inspector?
boolean variables
ahh thats beyond any of my knowledge on generated meshes soz :\
what about one way booleans?
ones that once turned on, dont turn off unless done manually?
that would be a boolean
ohh okay
nothing changes unless you tell it to
ohh okay
im just thinking
imma have a script that controls my inventory items
using booleans, in which everytime a specific item is interacted with it will tick the checkbox, therefore unlocking it in my inventory
who cares about the checkbox, thats just the displaying bool inside unity inspector.
whats important is the value..
i think its an easier way of displaying the value for myself
so im thinking activating the checkboxes would be an easier way of going about what im looking for
in the editor ? sure.
cause all ive gotta do is activate a bool when i pick up an item, and it stays active in my inventory then
don't set it via inspector then
how would i reference a button in my code?
i tried this but ion know if it references my button?
You reference a Canvas component, an Inventory class, and a PickUpControllerTorch class
Depends on where you put those scripts I guess
I need to reference the torch button, that is below the image of my script
how would i go about that?
Depends on what you mean
It can be as simple as
public Button myButton
Yeah yeah lol
I am on a phone haha
i wanna directly reference that button
so would i just say public Button Torch; ?
Yeah, but do it like nav said
ik just bein a pisser 😂
No worries lol
I'll have you know it IS my birthday though. I demand respect for the fact I was born!
what does serialize field do?
it just makes private field show up in inspector ( good practice to not make everything public )
is it really? what a day to have birthday ! Happy Birthday then 🎂
Yep! And thanks
private void OnEnable()
{
button.onClick.AddListener(DoSomething);
}
private void DoSomething()
{
//Something happens here..
}
private void OnDisable()
{
button.onClick.RemoveListener(DoSomething);
}```
https://pastebin.com/dAnRch2F dont judge my code too much
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i just wanna enable the torch button
whenever you find yourself labeling variables with numbers like that
use a list/array
whats that?
oh i see
[SerializeField] private bool[] items;```
it acts as algebra
only difference is they start at 0 index
so item1 is items[0]
and i just wanna get this last thing finished before i got to bed 😭
why would that make it easier?
because you can store more info than just a bool, cause now you need to make a new thing for each different check you want
its gonna get you confused more
okay okay
later on
how would i create a quick class for my torch?
all you need is a file with public class Item : MonoBehaviour
hang on then
then change torch class to Torch : Item
everything should work exactly the same except now You can store torch inside
List<Item> items;
Buttery butter
so im assuming i activate the bool from here?
My name is John Smith Name
You dont really need a bool after this
you can check if the list contains this torch
to be fair on the pickup script, theres already an equipped bool, so could i activate that item1 bool, when its equipped, saving me the trouble
why does a pickup script have an equipped bool
oh boy..
you were gonna make a pickup controller for each object ? ?
you need to refactor this to be more generic
nah i was gonna just tailor the same one to each object
Which is basically what they said
ok well if you have the class i suggested you can make it a reality
(ideally we would use Interfaces but thats too complex rn)
im just trying to get stuff working tbf
so you see the RB and all that goes inside torch
yeah
thats not Item
look its not that hard
public class Item : MonoBehaviour { }
public class Torch : Item { }```
one in each file
i literally have 1 item at the moment so its just 1 class at the moment
You already made scripts.. hows this anything difficult
its fine..
ion kno
coding tired is never good
i just was hoping to have this 1 thing done today
its almost there after you prepare these two classes
it will make everything later on easier trust
but yeah im just a little confused on what your showing me, like what makes it easier, what are we achieving?
Remember this
does someone know how to make the question mark button and when i click it
it appears a text like a hint and takes like 5 seconds or 7 seconds now it dissapears
for example coin menu: you clicked the button: you need more coins to unlock it
You want to have a "Generic" but common class you can identify your torch and other items with
i think i asked this before
yeah so for all 6 objects i was gonna drag the pickup object code and just repeat what i did on the torch
: this symbol means these two are connected
yeah
so then anything that does public class Water : Item
is now inherently an Item
i think that makes sense
yes so anything with Item can be picked up and stored in the same list
eg like an inventory
are you asking about a timed action or
like display a text for 7 seconds and disappear right?
i think i know what you mean
yes
like a coin game (you need more coins) and text dissapear
yes
are there any analogies you can give me to help me understand?
in terms of what ? this is part of inheritance rn
think of it like uhh Biology and human being relationship
you inherit your parents that inherit their parents that inherit their parents
wwhy has stuff broken again now
wdym nothing in these changes should break anything unless you did it wrong
I would look into https://docs.unity3d.com/ScriptReference/Coroutine.html
for some reason my inventory state thing is breaking again
it turns off everything but it doesnt turn back on
you have to show what you actually did , and also lets make a thread because this is flooding convo
it literally disables my player
when using add listener can I add the listener to the top priority-wise. I don't fully understand this yet but it seems to add them to the bottom of the events. (This script is competing with an event set in the inspector and going second is my understanding)
I believe the order of delegates in general cannot be guaranteed, you might need to store and manage what is invoked by yourself
the order is guaranteed when you can move them in the inspector
But tbh this sounds more like a design problem if the order is an issue
No, UnityEvent doesn't have this feature
ok thanks i think i found a better way.
If u use the Inspector events it will Invoke the functions from top to bottom / Whatever order u have them in the inspector
no
yes, had plenty of times where second to last would run earlier
order is def not guarneteed
Oh really? is there a way guarantee the order in which the methods are invoked?
dont use the inspector
I thought that was true as well, since I had to reorder some things early on in my project and it fixed them. Im not using that system anymore though
depends
i usually cascade them
eg instead of 1 event doing so many thing
1 script listens to this script which listens to something else
and it keeps going down
its prob ugly but it works for me atm
I'm pretty sure it'd do them top to bottom. I haven't tested it but I'm pretty sure it uses an Event under the hood, and those are deterministic
Yeah im pretty sure ive tested it? i could do it now honestly
And show everyone the results
Yeah, I'd make a few functions that log a number, put them into the inspector in order, then run it a bunch of times to see if it prints them in the right order
i guess it depends maybe what is you're doing ? I always for example disable the script that uses NavMeshAgent and then disable the Movescript first and then Agent Component but for some reason script threw error that navagent needs to be enabled to call Move
Even if it is deterministic, it's not a great design to rely on their order.
very wise
I mean if u want to be invoked in a certain order going top to bottom isnt bad
Each subscriber should be able to work properly regardless of what else is subscribed to an event.
Thats true^^
But thats not always what u want For example if u have a button that disables itself but activates another button you would want that other button to be activated before the button you press is disabled
Having the methods invoked from top to bottom would just make sense
i got mixed results with this for some reason, so i stopped doing it 🤷♂️
I mean if ur getting mixed results then yeah for sure stop doing it
Ive never had problems with it on my end tho
If events are preventing you from doing it in the right order, you shouldn't be using them there. Or using them in a different way.
Why would you care about the order for that. It's all happening in one frame anyway
Oh, because the command might not run?
I think it still should?
thats the thing, the invoke is but what about receiving end?
I could test it and see
yeah but i think with different mixed components
eg Rigibody n other mixed frames items
Inspector is ugly way to have events anyway
you cant see in code what is subscribed to event
It actually will still activate that other button even if its disabled
compared to doing +=
So i was wrong
I'm trying to work with complex movement systems, and wanted to know if anyone used rigidbodies or controlled velocity at the root?
Lots of people have. It's very common
This is a cool chart for types of movement
yeah but with or without rigidbodies?
I've heard using Rigidbodies takes away control
Rigidbodies are required for forces. Velocity is a force.
You can simulate it without one though by coding it all yourself.
But AddForce and Velocity require a dynamic rigidbody
If you want more control, you can make the rigidbody kinematic and use MovePosition.
Rigidbodies are also required for physics messages like OnCollision and OnTrigger, although CharacterController works for OnTrigger and has an alternative to OnCollision called something like OnControllerHit or something
Merry Christmas to y'all
merry christmas !
Did you make this flow chart? 
No. Hariedo from UDC did afaik. At least i first saw it when they posted it haha
Instantly stole it. Along with this one that they DEFINITELY made
And it's wrong
Hi. I decided to do a camera shake (rotate the x and z axes), but I had a problem that now I can't rotate the camera on the x axis. I tried to change the vector number, etc., but nothing helped. How to fix it?
Yes, the camera does not rotate only on the x axis (up-down)
Yes, she trembles when moving
what's the best way to map DB data to client assets? E.g. in a player account there is "unlockedHeroes": {}, {}, {},.
Do people usually add "assetPath" field to "unlockedHeroes" in DB to load the prefab of the unlockedHero during runtime?
Or is it some kind of ID and on the client there is a mapper like switch (id) { case1: pathToHero1 }.
It's other
Oh, yeah. I accidentally wrote public float x = 0f... Thanks
And if you remove this, then swinging the camera will not work...
Somewhat unsure what you are asking for some of these things, if you're just storing IDs then it should be fine to store the ID and asset in some dictionary then just look it up based on that. Or store the ID on the asset somehow, and have a list of all the possible assets somewhere
In my RDBMS I maintain a Resources table which is created at build time, that way the DB can directly convert resources references directly back into usable Unity resources
I would just store id’s in the actual DB
thanks! good idea
check out https://assetstore.unity.com/packages/tools/utilities/sql-for-unity-database-115308.
All the heavy lifting is done for you
Line 31 prevents the camera from rotating along the x axis, and this line depends on the rotation value, which is in line 13. I tried to change Vector3.zero to other values, but swinging the camera does not work, but turning the camera works fine. How to solve it?
Hi hii I'm trying to get the value from the user in a text mesh pro input field
So like this is what I typed out
If I type like 5
it does say I got 5
but when I try to convert it then print it again
it gives like an error
change it to a TMP_InputField
Damn that's wild. It works now.
Big thanks
Hi
I got a animation that basically move the player UP
but when playing it in game it will "stick" to the ground, i think it might be because of gravity, because it stays up then goes down on the ground
is there a way to fix it without manipulating the rigidbody ?
i dont know where to put interface classess. do i make a script and put every interface in there?
im tryna get a particle effect to play when i turn around, but idk how, is there a way to check if my player is flipped
why not put Animation Event for each side ?
ty
wait so how would that work?
im reading the documentation
reference particle effect, create method to Emit particle . Animation event calls that method
thats pretty much all there is to it
best way is also to select the object that has animator when viewing animation window to add Event
this way it gives you a selection box for that method
wich is the common format for the bg music of a game on android?
which is the best config for the audio on the inspector for android?
and for sound effects?
i have this super simple editor script that is ment to set offsets for a held item to a scripted asset
i move and rotate the item to fit in the players hand and when i press the button the POS works fine, but the rotation is not even close how do i fix this?
thats whats expected
are you setting the localRotation or worldRotation?
ah nvm there is your code as well
guys can you help me disable a script when a condition is met?
can't you do if (condition) return; ??
what don't you understand about this process? What have you tried?
its not that its just referencing the correct thing
my code was working fine last night then randomly stopped working
so what im doing is im detecting whether my inventory is open, if its open, then initiate inventory state, which locks my camera, movement, and unlocks my mouse
the very nature of code is that it does nothing randomly
oh
and vice versa
why dont you go to camera script and do
if (!inventoryopen)
{
}
but for some reason instead of disabling the script
and all your code inside it
its just disabling my player entirely
show your code
can you show code?
For enemy types that have different enemy behaviour it's better to create prefab rather than using scriptable object?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
thats my inventory state code
no
show the Inspector for InventoryState
i've never used .enabled
...
maybe try going in to the actual scripts, and just putting an if statement, so the code of the script won't run
oh wait
im dumb
so what is wrong with PlayerMovement.enabled = false; ?
thats not working?
why not?
it opens my inventory for a split second then immediately closes it
so post PlayerMovement script
Hi, I have created a game objec with a script etc to handle my logic of my goblin and in my game manager I'm just doing this to spawn some goblin but the default goblin is always there and i dont want him to be present by default, i want to only handle the mecanics of spawn thought the script how can I delete him from being present ?
public class GameManager : MonoBehaviour
{
public GameObject goblin;
void Start()
{
SpawnScript spawnScript = GetComponent<SpawnScript>();
goblin = GameObject.FindGameObjectWithTag("Goblin");
if (spawnScript != null)
{
for (int i = 0; i < 100; i++)
{
spawnScript.SpawnEntity(goblin);
}
}
}
}
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
nothing in there that even references Inventory so your assumption must be wrong
so what do you think the issue is?
no idea but it certainly has nothing to do with using PlayerMovement.enabled = false;
lemme check some of my other code
it's much more likely something to do with how/when/where you set inventoryCanvas.gameObject to inactive
well i set it to be active by clicking tab, and its whenever i want to click it, so i assume its somewhere in my code
maybe as well as just if (inventoryCanvas.gameObject.activeSelf) you should check 'have I alreasdy done this?' as this code is in Update
drag the default goblin into your assets and delete him from your scene. To "find" him you need to add a
public GameObject myGoblinPrefab;
into your script and assign it via the inspector.
im not sure i understand?
you do know what Update method does do you not?
checks the code everyframe
exactly so if (inventoryCanvas.gameObject.activeSelf) is being run every frame and so is everything below it
Update is probably not where you want this code
okay... then how do i instantiate a scriptable object instead of a prefab with a script inside it
you dont
Okay, i need help! I'm trying to do that when the player sprints, and he turns, he "slightly drifts" to that direction instead of turning there immediately.
kinda like in mario games, its more realistic then just turning straight away.
Now, if you move the joystick a bit, it does the drift very well. but if you move it a lot, its just kinda trash. can anyone help me? here is my code:
https://hastebin.com/share/rinecadeco.csharp
Help is really appreciated!
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
what would be the best thing to put it under
I would add this script to the inventoryCanvas gameobject and put your code in OnEnable / OnDisable
but i cant
im enabling and disabling the game object
so once its disabled i cant run the code
so instantiate an empty game object then set sprite and parameter on it? if so how do i use method like follow player or go in circle to that game object?
yes, perfect
to turn it back on
i dont think its an issue with placement
its an issue with code
Alright thanks and also I had this line of code to get the goblin in case I forgot to drag it via inspector, is there another way to get it because I assume this work only if the object is in the scene
And is it better to assign the variable like goblin prefab or any other variable in the start or directly using the inspector ?
goblinPrefab = GameObject.FindGameObjectWithTag("Goblin");
the code is doing something its not supposed to
you miss the point. Have multiple SO's, 1 for each enemy type whicch define the look/feel of the enemy, then it's just a simple task of associating the correct SO with the generic instantiated prefab
was asking if the SO can also contain enemy behavior method and use it on the instantiated prefab
yes
You can only find objects in the scene, since the prefab is not in the scene but in the assets you should just drag&drop it via the inspector
Okay thanks make sense
can i get help?
Do not cross post, choose 1 channel and stick to it
okay i got it fixed
can i get help though?
I think you need to add a lot more Debugs into your code, it is impossible to say what is happening without data
to start with, which paths are being taken in your code and what variable values are they using. Basic Debug 101 really
and how would a video help me to trace a path through your spaghetti?
i was asking if you would like a video of the current outcome
- Movement Ability Check:
- Condition: canMove
- Path if True:
- Calculates base moveDirection using camera forward and input.
- Incorporates horizontal input for non-sprinting or zero previous input.
- Normalizes moveDirection and sets its Y component to 0.
- Sprinting and Drifting Logic:
- Condition: isSprinting
- Paths:
- Resets driftTimeElapsed if input direction changed and movement is significant.
- Updates driftTimeElapsed and applies drift effect if drifting conditions are met.
- Applies horizontal input to moveDirection in other cases.
- Speed Calculation:
- Condition: inputManager.moveAmount > 0 (joystick moving)
- Paths:
- Increments moveIncreaseSpeed if below maximum.
- Calculates moveSpeed based on sprinting state and input amount:
- Sets to sprinting speed if sprinting and input amount is high.
- Varies speed based on running speed, max speed, and input amount otherwise.
- Applies selected moveSpeed to moveDirection.
- Resets moveSpeed and moveIncreaseSpeed to 0 if joystick is not moving.
- Crouching Adjustment:
- Condition: crouching && !longJump
- Path: Adjusts capsule collider height and center for crouching.
- Grounded Movement:
- Condition: isGrounded && !isJumping
- Path:
- Sets gpJump to false.
- Applies moveDirection to player rigidbody velocity.
- Resets dive-related variables.
- Key Variables:
- moveDirection: Vector3 representing movement direction.
- canMove: Boolean indicating if movement is allowed.
- isSprinting: Boolean indicating if sprinting is active.
- driftTimeElapsed: Float tracking time for drift effect.
- inputManager: Object managing input values.
- moveSpeed: Float representing current movement speed.
- moveIncreaseSpeed: Float used to gradually increase speed.
- capsCol: Capsule collider component for character.
- isGrounded: Boolean indicating if character is on the ground.
- isJumping: Boolean indicating if character is jumping.
- playerRigidbody: Rigidbody component of the character.
ok, so tell me this, on the basis of what you have just posted is this
if (moveSpeed < runningSpeed)
true or false?
runnning speed is like the normal walking speed. sprinting speed is the faster one.
wdym?
what I mean is it is impossible to follow your code unless you try to debug it properly
@languid spire do you by chance know how id reference my PickupControllerTorch script and access the equipped bool?
that same way you have done everything else in your code
Nvm
i havent accessed a bool yet
ive used them, but i havent used a bool to enable a bool
im pretty sure i know how to access the script
i just need to know how to express it
`it's simple
declare a public variable
reference that in the Inspector
in code access variable.equipped
RaycastHit2D hit = Physics2D.CircleCast(transform.position, 1f, transform.right, 1f);
Debug.Log(hit.collider.name);
the spherecast hits the player that shoots it but it should become an multiplayer game so every player has the same layer so i cant just ignore one layer so that it doesnt hit itself
this should wwork i think
simple but it sounds viable
why when i trigger atack method it thinks that see collider is enemy?
fixed
i mean u have the whole picture and the system design here already
u just need to find out the exact code using unity documents
Talking to me?
oh debug
hi guys
im trying to freeze some restraints on a rigidbody, how would i go about it
so how would you do it if you were making a competitive shooting game?
ok so, it is true for 35 frames since you started walking (while acceleration is happening) and then when your at running speed its false
guys it wont freeze my rotations 😭
From the inspector
dont ask to ask
just ask
whats the porblem
change it in the inspector?
u gotta do * moveSpeed * Time.deltaTime;
not just * moveSpeed
wwait i figured it out, im freezing the wrong thing
u using a Charactercontroller component?
rigidbody then?
but it doesnt collide with things, is that right?
do you want it to?
well there are two choices. charactercontroller or rigidbody.
oh its a 2d game..
rigidbody2d then
thats what you gotta use
you didnt but now looking at your code its quite obvious
my bad
just check out a tutorial like this one https://www.youtube.com/watch?v=u8tot-X_RBI
In this Unity Tutorial we'll cover how to move a 2D character or player around the scene from a top down perspective. This tutorial won't cover animations, but it does cover how to move correctly using Unity's built-in physics system and input system.
This tutorial is a great starting point for beginners to get their feet wet with game developm...
okay guys i lied
nah im going about this all rong
thats how u freeze rotation
im trying to do it with code
why?
instead of being awkward and freezing rotation im going to just disable the gameobject
because its for a menu
when i open it i need my character to completely freeze
no movement, no camera movement, and the only thing that keeps moving is the item
well
"rotating" which is then messing up the direction the torch is facing
okay i got it working
so satisfying
ITS SLOWLY COMING TOGETHER
now guys this is where i need your help again
can u show the code?
heres some psuedocode i wrote
looks like u didnt follow a tutorial
move the input.getaxisraw calls into Update. put the rest into FixedUpdate.
because input must be in update. and physics things need to be in fixedupdate
u have no idea how to put any of this into code?
Velocity is an amount to be moved in one time step. You are passing it a position
you can change velocity to rb.moveposition
and do the update and fixedupdate thing i told you, too
if u have input in fixedupdate then its gonna be unresponsive and laggy
is that not a thing in 2d?
its just a command that sends your character to the position you give it
MovePosition(...); not MovePosition = ...
Are coroutines "paused" if Time.deltaTime is 0?
yes
Ah I see. Thanks
u mean Time.timeScale btw?
Oh yes
You probably had previously assigned it when the variable type was different
Just reassign it
You cannot drag a scene object into a prefab
Prefabs can exist anywhere. What value would it have if you instantiated it in a different scene?
yeah you can only put another prefab in there
i see
if you drag it into the scene, THEN you can do this
Or if you spawn it at runtime you'll have to set it in code after instantiating it
got it thank guys
so u decided to stick with velocity instead of moveposition?
well ur previous code worked with moveposition but it seems u changed it to work with velocity
you can just write rb.velocity = vt * moveSpeed; its shorter
and its the same thing
but apart from that yeah looks good now you can move around and collide with walls. probably
does C# allow you to have a set of mutable objects?
Yes, as long as those objects are reference types (classes) and not value types (structs)
Even if a collection itself is immutable the objects inside it can be changed freely
oh i meant the objects inside are mutable
i set target as player prefab inside SO and when i log it out the target position it always point to 0,0
why?
u are checking the position of a prefab?
yea
which u havent instantiated?
the white square is on the game scence in the pic
if u have a player and in the scene and want its position then drag that player in there, not the one thats in your folder at the bottom
well i cant?
In case i was weird with my wording, I meant actual Sets like Map
you have to put the prefab into your scene for that
do you now what are reference type and value type in c#?
or assign the player via code
i did then i put it in the scene but still cant drag it into the slot
yeah I believe so, was asking for the benefit of constant time access from a set type object
drag it into the slot of the one in the scene
without it losing the ability to identify individual objects
the on in the scene give me mismatch type error and the one in the asset folder return position 0,0,0
reference type (pointer) and value type (whole chunk of data) have no effect on O(1) accessing it in hash table
or O(data size)
guys can you help me put this pseudocode into actual code?
how will it differentiate between 2 objects if they are effectively the same? with reference "value"?
like in java u can directly specify a field on an object used for differentiation
cause im pretty sure this is the last functionality threshold i need to finish before my character is done i believe
first check the hash value, then compare the whole key
java has no value type
compare the two keys (the keys you passed into and the key stored in hash table) byte by byte
oh so literally lol
and the key would be the reference value correct?
not the value pointed to by the reference
Kinda weird question here: for what I know, a float cannot have a null value; it becomes 0 instead; the thing is; I want for 0 to be an actual valid input you can enter (since they are coordinates) and not entering anything just tells the class to place some default values for the variables needed; there is a way of doing that? Make a "no input" and "0" be differenciated somehow on class?
yeah i think scriptable object can only assign prefab only and not object in the scene
i got a question, is there any way to change the color of a image with an click event?
make it nullable
how do u do that?
so ik how to create the event and all but idk if i could change the color
ofc
how?
private int? nullableInt
can u do that for any value or reference type?
value type means the data is stored "inlined", and you know java so i dont need to explain what is reference type
int[] array=new int[10];//all 10 ints stored in this array, not the pointer to 10 int
its meant for values types
reference is pointer so it can be null
How does that work on the unity inspector?
yep dunno why i asked 🤣
don't think unity serializes them in the inspector
The idea is that I have a item I want to move and I enter the starting and ending coordinates, and it loops between then; if you enter nothing (or "0" rn...), it assumes their starting coordinates are their current coordinates and the ending coordinates are equal to the starting ones; like for example, you don't want the item to move in Z axis, so you just don't input anything there
so no inputs = 0?
no sure I understand what ur doing
Right know is basically just interpreting 0 as null as assigning the default values in its place, but I want to be able to place 0 as an actual coordinate if I need to instead that work around it; it is posible?
so what would determine it being null
typing wise
is it an input string? or where are these values inputted
is this how you use Scriptable object? been studying it all day now . not entirely sure of its use but i think i can create more variant of the Enemy_normal using SO
I wanted to create multiple moving plataforms that loop back and forth, so instead of making a pathway or an animation, I just made a script that moves to desired position and origin position constantly; this is initially not meant to recieve any other input than what you enter in the inspector; what is doing right now is just assuming that if you left the default value the inspector gives which is 0, you didn't input anything at all there and resorts to default values
make a custom struct then
I just want to know if I can give it some kind of "null value" from the inspector even though they are floats and are not meant to
with a bool
Like what? A boolean that indicates if those "0" are to be considered actual zeros or null?
something like that
nullable actually is a struct with an additional bool
this would be pretty easy if unity liked nullables
but apparently it doesnt serialize them
I think you should literally have a button next to the value in the inspector that makes it null automatically
that can be done
with custom inspector
but is it worth the time? does ur logic mainly rely on inspector for this feature?
maybe this?
why its dont work
Yeah, that would probably do it
do you have a script ProjecticleGun
public struct NameT>where T:unmanaged{
public T value;
public bool isNull;
public static implicit operator T(Name<T> t){
return t.value;
}
public static implicit operator bool(Name<T> t){
return t.isNull;
}
}
```it probably works, but idk what will happen if the T is bool
looks like u want a GameObject there? i dont see a script in ur scrip folder with this name there
no , but guy in tutorial don't have this error
show tutorial
probably because they have that script or you copied something wrong
I would have it on my mind for future stuff, I don't think it is quite worth the effort right now; is just for the weird cases where I want to specifically move it to 0 in some coordinate, and I can work around thay quite easily just was wondering if there was a simple way of telling the script that I want those values to be null if I input nothing
FULL PICK UP & DROP SYSTEM || Unity3d Tutorial:
Since I just started my series on how to shoot with projectiles in Unity, I thought it would be cool to share how to make a full pick up and drop system :D
Don't forget to subscribe if you enjoyed the video, and if you have any questions just write a comment, I'll answer as many as I can! :D
Link...
yeah you need the script
they literally said in the beginning they are working on a previous vid
just replace it with your own weapon class
Thanks though 🙂
following the official guide, in the videos there's explanations to the codes (picture 1)
but i cant see those on mine, anyone know how to fix/change this?
!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
did everything but still not working as i want it to work, still like this
"did everything" you have to be specific on wat
also it looks like its working
first picture clearly shows what does the hovered code do, mine doesn't, when i press alt+o it shows examples
"shorthand for writing vector3 0 0 1"
wat so this screenshot is not yours?
First is not mine as i also mentioned here
screenshot YOUR VS with whole window showing
including solution explorer
And what are you expecting to see while hovering Vector3
assuming this
That's hovering forward
which VS version is this 19 or 22 ?
Pretty sure that's a VS setting
yeah this is internal thing prob
doesnt work
being completely new, i feel like i should see this when i hover over something
so i can have better understanding as i progress
maybe something from here?
yes having Summary is important
as far as i know all these things about intellisense
your IDE did load it though which is the odd part
can it be these boxes?
how can i search this as? summary doesnt show up or what
yeah pretty much
aight ty
i have an Scriptible Object and i want for to have an function that every has but it is different so i thought of making a script but i dont know how to link it
You could either make that script also a scriptableObject or you use something like this:
https://github.com/mackysoft/Unity-SerializeReferenceExtensions
on build some thinks are missing (some materials and colliders and tags)
in the editor run everything is fine
does anyone know what can be the cause?
Hey, guys! If I want to save my quality settings with Player Prefs, do I have to use Dropdown class or DropdownOptions class which one?
If I want to get reference to that dropdown I mean like [serializefield] private Dropdown or DropdownOptions field;
you dont have to get a reference to the dropdown you can use a public void to get the dropdown value(int)
just like a button
So, you mean that i have to make a method?
yeah
@crude prawn Hey! How to add my dropdown to the inspector of my game object, I mean there is dropdown only and dropdown text mesh pro, for one reason I can't drop my dropdown game object inside the game object space. Why?
screenshot
do types match?
No!
Types don't match.
@rich adder Check it out!
When I make dropdown only in script it shows that dropdown on the inspector, but when I make DropdownOption then it doesn't show that on the inspector and tha'ts why I want the dropdown option to be seen on my inspector to drag and drop that game object inside.
I can simply make a dropdown game object in legacy btw but I want to find a way make that work with tmpro.
how could i check the color of an image? would it be if (image.color == color(255,255,255))?
I have changed it a bit i have a script thats on different objects in that is a onDeath funktion and i have another scrip and i want to ovverte that funktion so thet each object has a different death script but they can all be called with the same funktion
Nevermind, I found it I just had to add TextMeshProUGUI in order use my dropdown game object that is text mesh pro inside my game object space, for one reason I was using Dropdown class like I said before.
why dropdown option
oh thought you made a DropdownOption type
nvm thats ur variable name i see
whats wrog here?
public class selection : MonoBehaviour
{
public Image image;
// Start is called before the first frame update
public void select()
{
// Check if the color of the image is (0, 255, 0, 100)
Color targetColor = new Color32(0, 255, 0, 100);
if (image != null && image.color == targetColor)
{
image.color = new Color32(255,255,255,100);
}
else
{
image.color = new Color32(0,255,0,100);
}
}
}```
error = Assets\Scripts\selection.cs(7,12): error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Dropdown option type doesn't show my field on the inspector, like no matter which access modifier I am using.
Dropdown ?
what is Dropdown option type
It is a class you use in visual studio
you're missing namespace
private DropdownOption field; for example
thx
it should be TMP_Dropdown
There is something called like that?
Yeah! Actually, there is that's cool!
the only UI that doesnt have TMP variance is Button
that comes with a nested TMP_Text tho
but regular Button component
how can i make the sprint end after it not holding the shift anymore?
making a normalSpeed variable and sprintSpeed variable
is it the only way?
its the easiest way
make sure to have GetKeyDown
float moveSpeed = 0;
float sprintSpeed = 10;
float walkSpeed = 5;
private void Update()
{
var sprint = Input.GetKey(KeyCode.LeftShift);
moveSpeed = sprint ? sprintSpeed : walkSpeed;
}```
this is as simple and functional as it gets
GetKeyDown would only be 1 frame
kinda pointless for sprint
Hi guys, do y'all know where i can find all these classes or whatever they're name like destroy(gameObject), or translate.transform?
!docs
I think he meant that if the old code is changed to use GetKeyDown, it would then behave correctly
how so?
Oh.. upon second looking it now seems that it would also need the "else" statement replaced with "if (GetKeyUp()), THEN it would work correctly
Yeah exactly
What do you mean with only 1 frame?
I would use this approach if I was expecting some kind of effects system later on, like speed modifiers etc. so then it can stack easier
It means that the fixed code he put in here would only sprint for 1 frame because the shortened if expression would evalute false after it, leading to it using the normal speed instead
GetKey is needed for their approach
not even just normal speed, but because its in else it will keep/=
But there's no division used in your code, just variables am I right?
right they're fixed speeds
Yup
so if you need increase stats you just increase sprint speed or walkspeed
Ohh yeah I completely overlooked that they can be multiplied or divided the same way as in the old code.. stupid me
Bumping as I never got a re response and just woke up
is it better if i add private next to float?
or its unnecessary
dont rotate somehting with non-uniform scale
or you get skewing
ideall you want those to be [SerializeField] private so you can modify them in the inspector
The scale is uniform and that's not the issue
do you even know what uniform means?
the screenshot you shared the scales are not uniform
yeh i know, but whats the difference between writing private and writing nothing at all?
nothing at all, they're both private
oh ok
can u add me to ur friends?
All the scales are identical aka uniform, the object is not warping or sewing the only issue is the rotation transfer
oh no
Anyways I never ment to post it in this chat anyways so moving to the other, I'm not a beginner so sorry mods ig. It was like 5am when I posted so wasn't paying attention
New to custom inspectors, is there a editorguilayout method for tilemaps? Kind of like how EditorGUILayout.Toggle is for booleans, I need something for a tilemap. I looked through some of the methods in this link but not sure what to look for: https://docs.unity3d.com/ScriptReference/EditorGUILayout.html
how could i check for an animation has ended?
!mute 706939554627584020 3d Don't shitpost across the server, don't post off-topic.
n.e.v.e.r.d.u.l.l was muted.
Animation Event is an option, or a Coroutine with a while condition to check if its still in that state/clipname
so how could i add smt to a var when it ends? sorry im new to C# and im trying to learn but im looking online and i don't find much
Care to explain what 'smt to a var when it ends' means to you
Use an animation event
just adding a 1 to a int
thx
Basically your saying if you hold down the shift key it would only recognize that for 1 frame?
Yes, with GetKeyDown it only does it the next frame after the key was pressed down
GetKey does it for all frames until the key is released
no thats false with getkeydown it updates it every frame to see if the key is held down
Nah, that's with GetKey
hmmm my bad i confused getkey and getkeydown
Names can be misleading
Yeah
what does this error mean?
'zombie' AnimationEvent has no function name specified! everything is set so idk whats wrong
nvm fixed it
Hey, guys! How to make FullScreen mode and Windowed mode with a dropdown panel? I have seen some videos with only toggle fullscreen but dont know how to make with options. Any help??
do you mean how to insert options ? its just a list of strings
Anyone has any idea on how I can make a movement system like this?
I made that already and it's fine. Now, I want to know how to make the functionality of fullscreen and windowed mode actually work. I did something like that check it out but I am not sure.
simple rigidbody + joints
I sadly cannot somehow :(
why not
@rich adder Check it!
{
if (displayModeDropdown.value == 1)
{
Screen.fullScreen = isFullscreen;
}
else if (displayModeDropdown.value == 0)
{
Screen.fullScreen = isWindowed;
}
}```
use a box is prob easier to balance
Lemme try
sure but its more limited which makes me wonder why use a dropdown if it can just be a bool..
private void FixedUpdate()
{
Move();
HandleJump();
}
private void HandleJump()
{
if (IsGrounded && _jumpPressed)
{
_jumpYVel = CalculateJumpVel(jumpHeight);
_jumpPressed = false;
_moveVel = _rigidbody2D.velocity;
_moveVel = new Vector3 (_moveDir,_jumpYVel);
_rigidbody2D.velocity = _moveVel;
}
}
private void Move()
{
quaternion playerRot = PlayerObj.transform.rotation;
playerRot.value.z = _moveDir;
}
private float CalculateJumpVel(float height)
{
return MathF.Sqrt((-2 * _rigidbody2D.gravityScale*Physics2D.gravity.y * height));
}
void GetInput()
{
_moveDir = Input.GetAxisRaw("Horizontal"); // takes move input
_jumpPressed |= Input.GetKeyDown(KeyCode.Space); // takes input for jump using space
}```
this is the movement code @rich adder
Hello ! How could I approach adding turning animation when the character is not moving ? Here is what I got so far, everything works except turning parts which have their animation not played (it directly goes to the end)
its very basic
void Update()
{
input.x = Input.GetAxis("Horizontal");
input.y = Input.GetAxis("Vertical");
anim.SetFloat("MoveSpeed", Mathf.Abs(input.x));
if(Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(Vector3.up * (moveSpeed/1.4f), ForceMode2D.Impulse);
}
}
private void FixedUpdate()
{
rb.AddForce( Vector3.right * (input.x * moveSpeed));
}```
private void FixedUpdate()
{
rb.MoveRotation(Mathf.LerpAngle(rb.rotation, targetRotation, force * Time.fixedDeltaTime));
}``` limb
and yes the lerp is kinda wrong but I'm testing
Lemme try
well i'm not saying you need to copy it exaclty, just showing how simple it is with rigidbodies
its Animator
This is how it goes :,(
ok? you're doing something else though
your balancing is different
i have limbs that I use
Привіт
Привіт, but english only please
Ok
Hello, I downloaded unity version 2022.3F16, when I run the project I get the error "Unity running as administrator". Please help, fix it
Does unity run fine even with that "error"?
Because Unity running as administrator probably shouldn't be a cause of concern.. although it should be runnable in non-admin mode too
When I click "restart as normal user" it doesn't respond at all
Have you tried looking around the internet if anyone else has the same issue? Also, this the first time you're using Unity? Or did this happen after you upgraded your project?
I am using it for the first time, there is no solution on the Internet 😦
then its probaly corrupted files
Would you mind sending a screenshot of the error popup maybe?
Are you purposefully running Unity as administrator (like have you set a flag in the properties of the executable to run in admin mode, or something like that?)
Bc that shouldn't be happening
Unless you're doing it on purpose
Here's some resources I found on the web; maybe give them a read:
https://www.reddit.com/r/Unity3D/comments/103saf9/how_do_i_run_202221f1_as_a_standard_user/
https://forum.unity.com/threads/unity-2022-2-is-now-available.1363123/#post-8655807
I just ran the project and I got this error, the project only runs as an administrator
How is that?
you tell me
How to install Unity Hub correctly so that there are no errors?
check the UAC thing i mentioned already
also this is a code channel
unlrelated to your issue
thank you
How to do it?
Hey quick question,if i have "new Vetcor3" in a loop, do the old Vector3 get forgotten or am i creating more and more things for the computer to remember endlessly?
you create new one but structs are highly efficent
you create new one replace old one
So its not making a metric ton of vectors? Because i dont want a metric ton of them.
probably the last thing you should be worrying about
its literally floats you're creating
Thank you
Well there isnt much going on rn in my little game yet it makes my computer fan go crazy and im using a lot of them so i was wondering if that was happening.
How many iterations are in the loop and how many objects are running that loop at once? Profiler also helps in identifying the cause of possible performance issues
But structs are very performant (it's like creating ints for example) so that should not be causing the performance dips (if you even have those issues)
really doubt structs are the cause
anything 3D will get your fans running
Not sure what an iteration is but, i have about 6 objects each making a new vector about 60 times a second. Now that i think about it those numbers arent that big all things considered so its probably something else.
If it's just the fans running and no performance drops, just leave it as is. Editor play mode also consumes more performance I believe, than in a build
Could just simply be a bad pc/bad fans
yes you have to use profiler and check source
my old laptop start its lag/fans just by opening the editor in scene view..
Its definitely not the computer.
then its def not the structs
But thanks ill check the profiler
Yeah probaly just bad fans then
Prob not
local variable it would get cleaned up quick, a stored var is just replacing
float is about 4 bytes
What should I do if my visual studio shortcut does not have an image?
make sure path is valid ?
How to do it?
I click, everything works, just the shortcut does not have a visual studio image
this is like basic computer stuff not really unity related.. You go to the original exe foldeer and right click -create shortcut
I did it, there is no image
Urmm are there any PDF that contains every coding for basics controls?
I want to learn it, but just rarely have internet connection
Um well unity website
You search stuff and you find it
Text only no vid
unity has downloadable version of docs yes
and so does .NET / C#
Wait seriously?
yup
Kwel
Owww, nice. Thanks
tbh its kinda hard to learn coding & unity if u dont have internet because theres tons of tutorials and guides to learn but ig a book could teach the basics
page deleted
I know....but there's no way I can get internet every week.
yea...page not found
whys that?
Let's just say the school I'm in just doesn't allow that
I don't want to go into details
yeah no problem i understand
How bad is your wifi like you cant even watch vid?
i think the school turns off wifi
Not mine
yeah same idk weird school
They don't allow phones or modem
So straight up no internet connection
Wait you are in a campus
Yes
how are you connected now
so hows the page says
yea...page not found
where are you from?
confidential
so download the offline version lol
He has CH in his name, which normally means china
i mean idk what u want us to do its pretty hard to learn unity without internet
CCP
Ch in my name means Chlorine, just so you know
So there's no way?
i also think u cant use unity without internet
download docs
You can't?
u need to have internet once a week or u cant use the engine
not for long
But close to china
You can afaik, only the new version that comes out next year requires you to be online every couple of days.
pretty sure you can also just run it without hub no?
No idea how the new version next year is going to force it tbh, but you should be able to work with Unity like you guys said now if you just download the docs.
I don't know
wait if no phones are allowed how are u supposed to use unity?
How hard is it to get started even?
not hard if you're committed
depends on how much work you put in
And on your brain power 
We got it on weekends, or if there's a special occasion. But usually most students just brought a spare and handed over the fake one
I know how to use Packet Tracer. Does that help?
dont snitch on your comards :p
well i would just download youtube tutorials and docs
2 hours a day
2 hours a day is good?
I don't and I won't
yeah id say that is more than enough
None of them use discord
how the school doesnt have internet 😂
So I'm fine
they have secret basement wifi
The school DOES have internet, they just don't let us STUDENTS use it
weird country and school
Play some Stalkers first then learn 
no I mean teachers
internet just helps the school with knowledge etc.
knowledge is forbidden without control in those places
oh yeah true
They're cool, no worries
is there even game devs in ur country?
Just wait till I get into Diploma then I can have my phone. Free access no restrictions
Yea
yeah going from dealing with schools to governament , not big change usually lol
one conditions for the other
anyway going offtopic here :ima seee myselfout
yea too far
@twin wave if you have any questions about coding this is the channel
Oh, okay. I'll finish the mock up first
If I have any problems I'll be here right away
Thanks
Im having trouble making my enemy follow the player after spawning in.
Currently, they go towards the players spawn position instead of the player's current position.
{
enemy.transform.position = Vector2.MoveTowards(gameObject.transform.position, player.transform.position, speed * Time.deltaTime);
}```
^ The enemy's are the ones spawning in, not the player.
My Raycasts for the suspensions which hold my car into its "floating mode" are always falling back a couple of frames when i accelerate my car resulting in completely bugging my car and moving it really weird as soon as i accelerate a bit quicker. Any idea how i can make them stay where i put them?
code for the suspensions: https://gdl.space/uvupucirah.cs
back at it I see 😏
probably because of this being in fixed update
Debug.DrawLine(transform.position, hit.point, Color.green);
or the whole raycast
put it in update and pass those values to fixedupdate
okey ill try
Vector3 spring_direction;
private void Update()
{
didHit = Physics.Raycast(transform.position, Vector3.down, out hit, maxRayLenght);
if (didHit)
{
Debug.DrawLine(transform.position, hit.point, Color.green);
spring_direction = Vector3.up;
Vector3 tire_world_velocity = rb.GetPointVelocity(transform.position);
current_offset = spring_length - hit.distance;
velocity = Vector3.Dot(spring_direction, tire_world_velocity);
force = (current_offset * spring_strength) + (spring_dampening * velocity);
}
else
{
Vector3 end_point = transform.position + new Vector3(0, -maxRayLenght, 0f);
Debug.DrawLine(transform.position, end_point, Color.red);
}
}
void FixedUpdate()
{
rb.AddForceAtPosition(force * spring_direction, transform.position);
}```
please
this should prob b changed
from
enemy.transform.position = Vector2.MoveTowards(gameObject.transform.position, player.transform.position, speed * Time.deltaTime);
to
enemy.transform.position = Vector2.MoveTowards(enemy.transform.position, player.transform.position, speed * Time.deltaTime);
also what is player assigned as
gameobject
which one
Player?
I was thinking of getting the player's position using get component then the enemy's just going towards that position.]
show me how you assign it
public GameObject player;
thats declaring it
how do you assign it, show me the inspector if thats what you used
that fixed it! thank you so much
I'm assigning the prefab
which might be the problem
you have to assign the instance in the scene if you're spawning player in
The enemy prefab doesn't allow me to assign the player in the scene
yes ofc
and i have no clue how to change that
god this stuffs makes no sense
which part exactly are you not getting?
I dont even know
I have a script without a gameobject, and I need to run it without using a static method, whats the best way?
If not static, you'll mostly need a gameobject somewhere.
A MonoBehaviour could create a Poco which would run on its own
Dattebayo!! LOL! GOG! 🤣🤣😂😂🤣🤣😂😂






🤣🤣
^LOL in the chat guys. am i right or am i right!? xdddeezers
Licking Ohio Lollies 😂
im gonna do stuff lil bro
We don't need the spam @severe valley
ok mb
no problem fam
or is it? 🤔🤔🤔
thanks for the help btw jlm!!
no porblom
bogos pinted?
how to like and subscribe in unity gaming engine? or am i thinking too far for your guys brainzzzz!!!!!
👽 🤯
!mute 742458880511967292 3d Spamming
jllm was muted.
get muted 😆 kiddo got the like and subscribe from ohio cell
Did some kids just get Discord for Christmas
date the bay 👊 😂
how does one looksmaxx?
i need it for christmas
!mute 267702803831455751 3d spamming
siqius was muted.
helloooo, need some help with some code im trying to get working, i have not a single clue of what im doing outside of some general knowledge xD, is this the right place to post questions like such?
Yep
:D great, so im doing some stuff with optimizing my avatar i have in unity meant for VRC, so im using version 2019.4.3, Im in the proccess of putting toggles into blendtrees instead of multiple layers,
the only issue i have is that some of my toggle animations are animated to have dissolves, and since blendtrees dont play animations, rather just switch from the animations state they are curently in (so since it starts as soon as the scene goes into play mode, itll just switch from the last frame of the animation)
so im trying to make a custome script thatll detect when my paramater is set to a certain value than replay a certain animation when its set to that value
this is the script i curently have,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dissolve : MonoBehaviour
{
public Animator animator; // Reference to the Animator component
public string parameterName; // Name of the blend tree parameter
public string animationStateName; // Name of the animation state
public float detectionValue; // The value to detect
private float lastParameterValue; // Last known value of the blend tree parameter
void Start()
{
// Initialize lastParameterValue with the current parameter value
lastParameterValue = animator.GetFloat(parameterName);
}
void Update()
{
// Get the current parameter value
float currentParameterValue = animator.GetFloat(parameterName);
// Check if the parameter value has changed to the detection value
if (currentParameterValue == detectionValue && currentParameterValue != lastParameterValue)
{
// Restart the animation
animator.Play(animationStateName, -1, 0f);
}
// Update lastParameterValue
lastParameterValue = currentParameterValue;
Debug.Log()
}
}
the issue is, its saying my game object dosent have an animatior when it does, and it complains about not being able to find the paramater due to not seeing the animator
Use a bin site to post your !code or format small code blocks . . .
📃 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.
Hello! I'm just starting to make a little 2d game and I could use some help with movement. I've got a neat little movement animation, but i'm trying to figure out how to make the idle animation stay facing whatever direction the player was facing last (if that makes sense)
because right now the player snaps back to the right because that's what i have the idle animation set as
can anyone teach me how to add height calibration to my vr game?
Maybe ask in the appropriate channel:
#🥽┃virtual-reality
have you tried google
hii guys right now i'm working on a project that consist of a enemy patrolling , the enemy patrols between the waypoints(white cubes in the given video) and player if detected it chases the player and attacks it and the health from health bar decreases, but the enemy apparently goes for the ground component instead of player i dont know why its doing that , here are some information about the components attached to each objects 1.player= a capsule collider, health script,movement script and rigidbody 2. enemy= a eyepoint child component(to represent eye, sphere collider ( to detect if the player is in attackrange,enemyAI script (responsible for navmesh movement)and enemyEyesight script,navmeshAgent component)
You seem to be using the word "component" in some cases when you actually mean "GameObject". That's a little confusing, FYI.
As for why your code is doing what it's doing, definitely not possible to know without seeing the code and understanding what debugging steps you've taken so far.
sorry about the confusion i'll share the code
Please share code via paste sites as per !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.
Paste site
Since you're using the short circuiting version of your boolean logic operators (&& and ||) there's a good chance ClearView() is never even running.
Double check that with log statements. If necessary switch to the non short circuiting versions (| and &) since you require that function to run to set the position
Or switch the order of those conditions
i'll try