#💻┃code-beginner
1 messages · Page 793 of 1
online multiplayer is just.. very inherently complex, or so i've heard
that's wut i learned in Tuesday
There's a library called netcode for GameObject made by Unity that herit from MonoBehavior (and more?)
just seems like you'd have separate gamemodes entirely for online vs local multiplayer, and you could maybe have a base class for player control that can be extended to be the specific online/local versions
Nah I want to avoid that stuff
Before DannyWebbie told me a way of only making the online version and if i want to add local players with some kind of host mode ? I need to do more search about it
Programmers hate redoing stuff so it must be a way of avoiding that
I want to make prefab hallway that is made of 3 or 4+ sections, [entrance/exit, middle section, middle section variant, entrance/exit]
Then when I create the hall prefab in code to span some gap between rooms I can tile it.
Should I just make each section a unique prefab and deal with placing it all with code, or should I look into using splines?
really unclear what you are trying to achieve
try to explain it better
you could use splines to guide the placement of the hallways
or even deform the hallway meshes based on the curve of the spline
(this would require you to either modify the mesh or to write a pretty wacky shader)
Does Stop() pause an audio source to be resumed later again or does it stop it completely?
what do the docs say?
forget I asked
sorry kids woke up, Im spawning rooms with a generator and the connecting them with hallways, originally I just wanted one middle section that stretched like this
Fen also replied, you might want to read the message
but now im thinking i should leave each piece as a separate prefab so i could introduce some more variety
In my case, all of the hallways will be straight as well. so I dont think I would want to use splines if i dont need curves. I just saw that tool as a suggestion.
that does sound more like a game design thought, do you need variety in it? If you actually expect to have a ton of combinations then it could be worthwhile and you define the combination in some list.
If you don't expect to have a ton then making it all a prefab might be quicker
id go with whatever you feel is quicker and an easier workflow
i´d probably use a variation of predefined prefabs and use those instead of doing it via code
Someone's grumpy, btw the answer would've been given right there if you went to docs
It starts from the start when played again
Hello! I've been trying to fix this for hours. I'm a beginner programmer and game dev and I'm currently working on a small game that is a top down pixel 32x32 game and I just started with the player movements but I have an issue. When pressing the W button, the Walk_Back animation should play but instead the Walk_Front animation plays and I have no idea why! The transitions are as they should be. (I'm showing the Idle Blend Tree and the Walk Blend Tree in the first 2 screenshots) Screenshot 4 and 5 shows my components inside the inspector when I have chosen my character. This is my code: using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5f;
private Animator animator;
private Rigidbody2D rb;
private Vector2 movement;
void Start()
{
animator = GetComponent<Animator>();
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
// Get raw input
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
// This tells the Animator which direction we want to face
animator.SetFloat("MoveX", movement.x);
animator.SetFloat("MoveY", movement.y);
// If movement input isn’t zero
if (movement.x != 0 || movement.y != 0)
{
animator.SetBool("isMoving", true);
}
else
{
animator.SetBool("isMoving", false);
}
}
void FixedUpdate()
{
// Actually move using physics
rb.MovePosition(rb.position + movement.normalized * speed * Time.fixedDeltaTime);
}
}
when sharing code, wrap it in ``` like this:
```cs
blarg
```
that'll make it show up a little more nicely in Discord
Do all of the other animations play correctly?
Or are they all wrong?
hi is it possible at all to lower mouse DPI inside a unity window? and if so how would you go about doing it?
change the sensitivity in scripts that use it probably?
with an unlocked cursor?
not that I'm aware of: the cursor position is coming from your operating system
All of the other animations play correctly yes
wdym?
sad
if it's a locked cursor then you could do that
make sure that Walk_Front actually displays the correct sprites
You can preview the animations while you have the character selected in the scene
Yes, Walk_Front is as it should be and Walk_Back is also as it should be, I still do not understand why it does not work. One thing that is interesting is that I tried to change the Walk_Back to a copy of a different animation and that did not show up either so there is nothing wrong with the animation itself, it must be inside the animator or the script
I tried adjusting the order here in the screen shot and that changes the walking animation. I put the Walk_Back at the top and that switched their places?! Hm
It seems like the one at the top controls what animation plays
idk I've tried everything atp and it still just literally doesn't work
idrk wat I'm supposed to do
For IPointerEnterHandler, IPointerExitHandler and the others to work you need:
- A collider on the gameobject
- a PhysicsRaycaster OR Physics2DRaycaster on your camera
- an event system in a loaded scene
However if these are used in UGUI then only an event system is required
Once you fix this you will start receiving these pointer events in your monobehaviour
These inputs get blocked by UI by default btw.
ah!
you're using MoveX twice
hay I was just wondering how I can hook up my cinema machine free-look cam to a raycast.
thats too vague, how is this being used? you can still get the position of the current camera and do raycasts as normal when using cinemachine
Well the goal is to have the ray cast be projected from the position of the camera. Rather than the raycast need to find something that is directly in front of the player model it can find things the player camera is looking at.
my original idea is that I make the camera a component of the player script but that hasn't fully panned out.
Very typical. Perform a raycast using ScreenPointToRay
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Camera.ScreenPointToRay.html
The camera cinemachine is controlling should be used for this
thanks.
Example i stole from the unity docs
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
if (Physics.Raycast(ray, 100))
print("Hit something!");
That is using the current mouse position. You want to provide the screen center.
You can also get away with using the camera position and forward vector (from the cameras transform)
oddly this isnt even in the doc you linked -_-
tis in the raycast doc page trust me 😆
Can someone help pls? I'm trying to find a guide for unity's new input system, I only need buttons wasd but to rotate so it has to be button type, not value, I can't find any guide on this because everyone shows moving, even unity docs are useless
You would have an input action thats Vector2. you read this and then do whatever you want with the input data
This is no different to the old input system and reading horizontal and vertical
why would this be a vector2
I only need to check if button has been pressed
because A-D is the x axis and W-S is y
Do not fall into that trap
you want to avoid reading keys directly. you know if the user is pressing left/right/up/down based on the data you read
are you asking because in your code youre checking for individual keys? because when you switch to the new input system you will have to refactor some of your code
I dont have any code yet, im a beginner, Im trying to already learn the new input system
and skip the old one
but if I put it to value, then if I hold a button like d it will count as rotating several times
I read the docs, button type meets my needs
and all guides are for the vector value
You can check the phase and use many extension methods to know if the action was activated this frame
You can have the action type be button but its easier when working with pairs of keys/controls to use value
what kind of a hop jogging error is this?
check the stacktrace and show us the line in question ?
ItemSO[] itemSOs = Resources.LoadAll<ItemSO>("ScriptableObjects");
all i did was inside my scriptable object add this to allow people to get the name of it without usig a function.
{
assetName = name;
}```
SOs cant have constructor
why not?
because its a Unity Object not a System one so unity deals with them internally "their own way"
they are initialized in the C++ code
You can probably just do the same thing in Awake() though..it is comparable to a constructor
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/ScriptableObject.Awake.html just keep in mind it isn't just called once
i would not even use awake either since if you are using a asset version of it, its not going to call when you expect it too
if you need some sort of standard setup and init just make a public function and call it
true there is probably better alternatives to this
also like if something needs a constructor i feel maybe it should not be SO
but just a regular struct or object
ya could be original setup might be creeping into xyproblem territory
especially in cases where the SO's are referecned by other things and loaded via other things, the lifecycle messages can get pretty weird timing wise
don't crosspost . #🖱️┃input-system
i just made a custom attribute for a readonly attribute
why does it not exist already? :v
Why? Because I want to show the "assetname" of a SO in the editor even though it's just the name but people might not know that.
also a useful tool for myself for later
unity will lay off a thousand staff before adding small features to the core unity
wow
they also still havent made serialisable dictionaries, you need packages for them
because putting AI Tools pleases the shareholders..duh
priorities mannn
should i store inventory data in a scriptable object? Or do I need to make an external class handler?
a scriptable object is also a class. so either way you're creating a class for it.
just keep in mind that data does not persist between play sessions unless you write it to disk so you'll need to serialize the inventory data and write it to a file either way. so how you handle it (whether using an SO or plain class) is entirely up to you
Can anyone tell me how to solve this issue . I'm not able to solve it on my own?
whenever i try to move my player this error shows.. and if i don't make any any movement no error ?... its the unity sprite flight game ?
Is that line 43 of the player controller script?
yes
ui doc or root visual element is null
i'm new to this but ui is not null i've assign the ui doc in inspector window
Can you show us the inspector?
Can you show the game ui object?
Whatever you're referencing right there in the ui document field is supposed to have a root visual element that's likely null
Click on the game ui object and show us the inspector
Is ui document a class that you've created?
i dont think so cuz whatever the instructions it was in the tutorials /i was only following it
Looks like this component https://docs.unity3d.com/6000.3/Documentation/Manual/UIE-create-ui-document-component.html
Which tutorial are you following? Can you provide the link?
its on the unity hub >learn>sprite flight
I'm learing this first then i'll create something new on my own.
i'll try this now .let you now
Looks like you're on this step:
Step 9: https://learn.unity.com/course/2d-beginner-game-sprite-flight/tutorial/add-a-scoring-system#682ca523edbc2a013054e099
Explanation:
.rootVisualElement gives you access to the top-level container of the UI layout.
.Q<Label>("ScoreLabel") uses Unity’s query system to find the first element of type Label with the name ScoreLabel.
Make sure the name exactly matches what you set in UI Builder — spelling, capitalization, and all.
Prior to the line, place these logs:cs Debug.Log(uiDocument); Debug.Log(uiDocument.rootVisualElement);
Maybe your score label name is incorrectly spelled
Make sure you're doing everything exactly as they have done.
Hey guys I'm kinda new to this but I'm having severe jittering issues with my camera so I was wondering if there were any general fixes I could try the scripts are a bit convoluted so I won't share the code rn but I've tried the fixed, late and normal update combinations but nothings seeming to work please let me know if you have any ideas even if they're super obvious I could have just missed somthing
Try changing the rigid body interpolation mode
Interpolate should smooth out the issues
It helped a little but its still pretty obvious but at least now I could probably cover it up later with post effects
I'm unsure of your setup but here's a discussion I've had on this before #💻┃code-beginner message
thank you for the help I'll read through it and see what I can do
Take a proper screenshot using the pc
Ok
!code
Or post it properly as suggested by the bot
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
why are you coding in notepad
lol 😂 I can’t afford anything rn
get a proper ide, so it can tell you about issues in a easier-to-understand format
all the main ides are free
Oh ok
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
But visual studio for 6 is outdated now
Ok
much better than notepad anyways
Thanks
After you setup your ide (it's required to get help on this server) ||you're missing your closing brace for your Awake method||
Bruh I just did that and now I have more bugs 🐞
Cursed laptop 💻
lol 😂
that's.. not your computer's fault, but ok
Ik it’s just a joke
me too
are you trying to make a singleton?
honestly I'd setup the IDE first
this is no way of working
SOs arent dynamic
Whats the issue you got with the singleton pattern?
they're good for static data and thats it
if you need dynamic data then save it to JSON or xml
then you just unserialize back to a class and its easy to read and write to it during runtime
all of that will need a save system
so I'd also say you need SaveManager that sends events everytime you save the game
other objects that are subscribed will catch that event and write to the JSON
You can also combine SOs with data stored in any stoargetype (json, database) and use serialization to save and load into the SOs.
that too but its an extra step
Depends on the usage, as always. I have been using it to create a node based quest system taht you can tie together and the serialized data will then overwrite those nodes to get the players status of the quest for example
hm I see so you grab the SO data and overwrite it?
everytime you want a new value you'll need to create it twice then
for me everything that is dialogue is saved in an SO since i need localization
then in a json i save the dialogueIndex and other stuff like which emotion to show
or what objective to trigger
then it all connects nicely
The SOs basically present the default state when you start the game and in runtime they get overwritten by the serialized data stored somewhere. In that case I can also revert to the default state, because SOs reset on runtime restart anyways
how in gods name does 1 stop getting class errors
its all i get from every script i make
like how...the class name is the same as the script name
I remember my scripts once or twice not being.... refreshed in unity or something? so I had to make a minor change in a file and resave it and now it's working
not sure it's related
i tried everything
im just restarting completely...i had this issue with my college mobile project
you have errors (at least one) in your console... move the console tab so it's not hidden and read the errors
Hello where can I ask a question about character controllers?
Im having an issue with it being stuck too long when going over a ledge or an edge
If it's to do with the code, in here
Morning
i dont know if thats fixable with code or with some values, but i tried playing around with character controller component values and it didnt help
I got it from a guy on YouTube.
i want the capsule to fall a bit earlier.
I noticed in other games the character is being pushed or applied a forward force when they get too close to the edge and they just fall on their own
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
Eariler? Wouldn't that mean going through the floor?
Ah I see what you mean
You don't want it to hang there but drop instead
You can do a physics query like spherecast/spherecheck to check if there's nothing below you and then move forwards if so
Probably would need to check if the forward direction is free too
not the forward direction, the vector direction it's going to be pushed in .. if the character is going off backwards, forward dir won't be relevant
and of course I dont know how to do all those things in code ^^
break it down, and google
First thing would be to search "how to do a sphere cast in unity"
okay so I need a sphere cast physics check to check if theres anything below, and apply a force forward or backward if theres nothing
not forward or backward from the characters perspective.. because again, if it's side on, or at any angle inbetween.. forward/ backward won't look right
Yeah, i should say "move direction"
You will want to get the direction of the face ledge and push in that direction
Okay thank you I will try searching for answers how to do that
Hi guys, what do you think about using github for hosting unity projects? My concerns are about the project size that could easily go past 2GBs... Do you know any free/low cost alternatives?
the two big hosts are github and gitlab.. check the pricing on there.
I don't think there's a free hosting that is gonna give you enough for a Unity project.
Mid last year I bought a NAS and setup a local, self-hosted, git server.. cost ~£600 for the nas and 2x 14TB HDD's
in most cases you're fine, not uploading big assets (especially if its art)
if you're solo ^
I have over 45+ projects on github and yet to have hit free limits, as long as you use proper gitignore and reserve huge assets (over 1-2GB) for other hosts
If not, it is possible to host your large files on something like google drive and symlink (IIRC) them into the project.
Had a couple of friends doing that on their VR project years ago - I assume it's still possible
shouldn't the SerializeField Objects differ from an object to another? For some reason when I edit it for an object. all objects get updated too.
I have an NPC script which is attached to each npc. I use the SerializeField attributes to control each NPC behaviour from the editor
but when I update it for one. it updates for the others
What are you updating, exactly
the first 2
action. and male
I have different animations for female and male characters. so the bool decides which animation to play
the action decide if the npc is idle and stay still. or is moving and then uses the patrollingLocations
So you have multiple objects with the NPCBehaviour component in the scene and when you check or uncheck the male bool in one of them, the others change at the same time?
yes
same for action too
Can you show a video, because that shouldn't be possible with booleans
You have the inspector locked. It's showing the same object the whole time
I am still stuck on this issue and have no idea how to fix it. I am trying to rotate the player with my mouse input which works but the sensitivity is increased a lot. I tried lowering the sensitivity but it doesn't help. I think its because the tracking target is a child of the player and it will inherit the player's rotation and apply its own on top of that maybe?? Idk at this point. Should I not use cinemachine and just use a normal camera and not make it a child of the player and make it follow the player with a script?
Script: https://paste.ofcode.org/Hmai7FcYtPhDiEEw75eLBR
Why there isnt any tutorial about cursor. How to even change sensitivity? only thing i found is to have object acting as cursor, but then how to make it click UI
Try to have the player object follow the camera rotation instead of the mouse
-Show your !code and link the tutorial
-What components does car png have
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
And does the movement work code at all?
kind of, but its not right
See this message on how to post code
show the settings for your PanTilt component on the vcam
see this message on how to post code #💻┃code-beginner message
Whats a back quote?
considering you are trying to post a large block of code, that doesn't matter right now
And do i do it on discord or one of the apps?
You need to post the link to the paste site. The issue wasn't that we want different kind of screenshots
notice how it says "link to a service" and not "pasted on a service then post screenshots of that web page"
A tool for sharing your source code with the world!
Anyway this line is not how it is in the tutorial
You really like screenshots don't you
In this video you will learn how to create a simple but very effective 2D arcade style top down steering car controller in Unity from scratch. Download complete Unity project 👉 https://www.patreon.com/posts/top-down-car-49913192
With this tutorial series you’ll be able to make a physics based race game with lots of drifting in no time. Car...
sorry
If your going to say change the reference frame to something else thats a no go cause the headbob rotation effect will no longer work if I change it to something else.
no, but you're probably letting this rotate the cinemachine camera around the Y axis so it's rotating faster than the player is
if your camera is meant to follow the rotation of the player then don't let it pan, only let it tilt
I need help. Im very stuck into making Virtual cursor. I only found 10 years old github code, which doesnt work and is very complex for me to understand. How people make virtual cursor in this day of age?
depends what input system you're using
new inputSystem
generally
virtualcursor.position = Mouse.current.position.value
you might need to convert it to worldspace
I think new input system also has a "virtual cursor" you can drive
its very easy to move it, but SystemEvents wont work with virtualcursor
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.1/api/UnityEngine.InputSystem.UI.VirtualMouseInput.html
I think new input system yo ucan use this and still detect UI events
input system package I think has example
wait virtual cursor isnt same as fake cursor? All i need was change cursor speed
I know that VirtualMouseInput has a cursor speed that you can adjust
if you're using your own cursor you just multiply movement * speed
i created own cursor, but then cant interact with UI
you can if you use custom inputmodule
Ok so I disabled the rotate script just to check if I can rotate left and right which I can't so its working. So the camera is following the rotation of the player but the sensitivity is still to high and changing the value does nothing really.
is it because of the action properties of my input?
Its not very beginner solution. i opened documentation and its very long and complex
thats old Input system solution 10 years ago i told about
if (horizontalMove != Vector3.zero) // prevents unnecessary Normalize math from running
horizontalMove.Normalize(); // Prevents the 1.41 diagonal speed increase
if (playerInput.sqrMagnitude > 0.01f)
horizontalMove.Normalize();
which way is the better way?
top
sqrMagnitude cost more
My rationale is can the player input actually be zero with mouses or joysticks
if its 0.0001 then it wont work?
Note that sqrMagnitude of 0.01f corresponds to a magnitude of 0.1f (0.1 * 0.1)
Which isn't a very small number
Do you want the input always to be 0 or 1 length?
Be careful not to make all speeds the same. You probably want to have moving factors less than 1 (magnitude) too. For that, check Vector3.ClampMagnitude
Yes but i still have mouse inputs and joystick inputs which read between 0 and 1
Your clamping logic makes the magnitude always be either 0 or 1 as Osmal pointed out
void MoveCharacter()
{
Vector2 playerInput = moveActionReference.action.ReadValue<Vector2>();
Vector3 horizontalMove = myCamera.transform.right * playerInput.x + myCamera.transform.forward * playerInput.y;
horizontalMove.y = 0f; // Stops player from trying to move up or down when camera is looking up and down
if (horizontalMove != Vector3.zero) // prevents unnecessary Normalize math from running
horizontalMove.Normalize(); // Prevents the 1.41 diagonal speed increase
// if (playerInput.sqrMagnitude > 0.01f)
// horizontalMove.Normalize();
Vector3 movement = horizontalMove * movementSpeed + Vector3.up * _verticalVelocity.y;
myController.Move(movement * Time.deltaTime);
}
am I missing something
so did you try using the virtual cursor feature in new input system ?
idk, why but it wasnt reading any input from mouse
I changed the values and it stopped the fast sensitivity but now when I move around / look around it feels kinda weird and stutters when looking around.
Is it not what you want?
you might need to add another action for it in the action map that has mouse checked in
yes but then the if (horizontalMove != Vector3.zero) is cheaper no
my concern is if inputs are indeed dead zero, if some joystick would have like a little input of 0.002 if its worn out then the (horizontalMove != Vector3.zero) it would always run the normalize function when it wouldnt be needed
true, just like to learn as Im a beginner and would like to know how it runs "under the hood" ^^
Unity uses a small epsilon when comparing vectors with ==
[MethodImpl(MethodImplOptionsEx.AggressiveInlining)]
public static bool operator==(Vector3 lhs, Vector3 rhs)
{
// Returns false in the presence of NaN values.
float diff_x = lhs.x - rhs.x;
float diff_y = lhs.y - rhs.y;
float diff_z = lhs.z - rhs.z;
float sqrmag = diff_x * diff_x + diff_y * diff_y + diff_z * diff_z;
return sqrmag < kEpsilon * kEpsilon;
}
You can find ClampMagnitude etc. there too
i should change input code part with new inputSystem?
are you not using that already ? you're confusing me now
(The epsilon is way smaller than 0.002)
that code you sent me is based on old input system
I have to get myself a controller and test this out ^^ thanks
Mathf.ClampMagnitude only uses Sqrt (the "expensive" part) when the magnitude is greater than the max
yeah but then I said if you're actually using the new input system you may use the virtual cursor feature it could work then , you said but for mouse it wasnt working, and I said It might need to be added in the action map with the "virtual cursor" option on
You are correct in thinking about the joystick drift though. I'm not too familiar with the new input system, but the old one had some functionality built-in for this
Joystick deadzones and such
Im reading now that ClampMagnitude is the better way especially for analog joysticks
using the Normalize function wouldnt preserve the sensitivity, so the acceleration speed would go from 0 to 1 instantly even if the analog stick would be moved very slightly
ClampMagnitude preserves that
Clamping the magnitude is often what you want to do instead of forcing it to a value. The input systems usually have also some value for each axis to define how large the input needs to be before it registers so usually you don't have to care about that in your own code (I have no clue about the new input system but would be shocked if there wasn't one)
Are you still using the Input manager?
I mean there should be a registered deadzone built in the Input System for sure
Haven't bothered learning the new properly yet. I haven't done proper games with unity for a long time though. Anyways, there seems to be a Axis Deadzone processor
YOO anyone able to help me understand inheritence? im trying to make a base script for flying enemies and ground enemies and its not making any sense
My man
good luck 🍀
imo its best to just start out simple like this example
where the Player class doesn't contain a hp float.. but since it inherits from Human and Human does it'll appear in the inspector as it does
same thing applies to methods as well
i can understand something small like that. Once it gets more complicated where overrides are happening or protected classes start coming into play is when my brain stops working. inheriting from separate scrips also is confusing as hell for me rn
you can only inherit from one base class
im thinking i should go back to the fundamentals of classes then work my way up maybe?
virtual void Fart()
Anyone know how to fix this? is the issue from my input?
virtual methods allow for child classes to do something more specific than their parent
importantly, they allow for this kind of behavior
public class Foo {
public virtual void Hello() { Debug.Log("I am Foo"); }
}
public class Bar : Foo {
public override void Hello() { Debug.Log("I'm actually Bar"); }
}
...
Foo holder = new Foo();
holder.Hello(); // logs "I am Foo"
holder = new Bar();
holder.Hello(); // logs "I'm actually Bar"
non-virtual methods don't work like this: if your variable is a Foo, you get the methods of Foo, no matter what
imagine a method that checks if the enemy is out of bounds and should be deleted
The base class's method could check if the enemy is in a room the player isn't in
The flying class's method could check if the enemy is more than 50 meters above the ground
Now flying enemies get deleted if:
- They're in the wrong room
- They're too high up
public class BaseEnemy {
public virtual bool IsInBounds() {
return RoomIsCorrect();
}
}
public class FlyingEnemy : BaseEnemy {
public override bool IsInBounds() {
return base.IsInBounds() && height < 50;
}
}
it's great for when you want to add some extra logic to an existing function
importantly, this works correctly:
BaseEnemy enemy = FindAnEnemy(); // suppose this finds a flying enemy
enemy.IsInBounds(); // this checks if the enemy is too high up!
you don't care exactly what kind of enemy you have
it Just Works (tm)
This is what makes inheritance interesting.
FlyingEnemy is a specific kind of BaseEnemy with extra features
@swift crag BRUHH thank you this is starting to make more sense
my brain is on fire so ima take a break then do that unity inheritance course. after that im hoping this all clicks and i can continute developing ❤️
along with inheritance, you'll want to learn about composition
in my game, everything is an Entity
each Entity has a Locomotion that determines how it moves
e.g. HumanoidLocomotion for things that walk around
or FreecamLocomotion for spectators
this can solve some really annoying problems that inheritance introduces
imagine you have flying/walking enemies, and then those enemies can shoot projectiles/use melee
you don't want to do something like
- Enemy
- FlyingEnemy
- FlyingMeleeEnemy
- FlyingRangedEnemy
- WalkingEnemy
- WalkingMeleeEnemy
- WalkingRangedEnemy
- FlyingEnemy
it's not clear what order the inheritance should even happen in
and you wind up with lots of duplicate code
A composition-based system would give each Enemy a way to move around and a way to attack
of course, now you have to figure out how to make the attack module talk to the movement module
it can get tricky 😉
I think he needs to get sort of example actually to understand this one. I've got this(Not only me I guess) only though my own (painful but fair :D) experience.
Fen covered it pretty well ☝️
Yes but not clearly understandable until you try it self ;)
What is this?
a compile error
how can I fix it? I can't build my game
don't use something that doesn't exist
well wherever you copied it from probably has wrong API version
it is not. I didn't make any
your as in the one you are currently having issues with
I didn't copy it
the error appeared only when I tried building the game.
it is my first time seeing it
because you can't build with compile errors
something could be Editor only and its removing namespace / classes for it
go here
if it is a compiler error why I can run the game with no errors?
also you have a script, that you have no clue what it does, that you got from somewhere?
whats the point of the script
and why is it in your project then
something could be Editor only and its removing namespace / classes for it
we don't know for sure if you don't provide further context
So I should just delete it?
youre the one who added the script.....
I didn't.
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
shit
smh my head
so how did it end up in your project?
dyno used to work with commands inline this doesnt
I don't know. I thought it was something built-in or something so I asked here
well i doubt its built in since its in your assets folder
did you import any packages?
TextureMaker is not something build in
I did. I imported only 4 and I know their files
wait a minute I will re-check the files name from the package manager
whatever it is you added clearly put that there
it doesn't just appear out of thin air
hay quick question how do I set my Print() to print a layer's name?
for context I have a raycast and I just need to make sure its not seeing the player layer.
you don't "set" it to do anything, you pass the layer's name to the print method. you can get the layer by using one of the LayerMask methods (i'll let you look at the docs to find out which)
but also a raycast expects a layer mask not a single layer, these are different things
it doesn't belong to any asset
I will make a copy and then delete the file and see what happens
you haven't imported any samples from any packages/assets?
if you are talking about sample scenes. I did import them
you do realize that the samples contain more than just scenes, right?
I bet if you delete the .cs a bunch of compile errors show up
post your code,we might find something
more than likely some asset using it
nothing showed up so far
you mean the Settings files?
no, i mean samples from packages can include code
well then maybe the asset you don't have anymore or it put it there on import only . who knows.
try to build now then
if it does it should be inside the specific asset folder. not outside
here are the relevant parts.
the editor created another copy but empty this time 🤔
presumably some asset or package did that
So I just need to remove every script added with all the assets I imported right?. I don't use any of them in the game so I guess it should be fine
checking the docs usually you find the answers
thank you.
do note that you are using a layer mask here, not a layer index so that won't be correct 😉
tried setting virtual mouse, but recieved "
The bounds contain one of the following values: NaN, float.PositiveInfinity, float.NegativeInfinity. All values in bounds are reset to zero.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
"
So I just started with the Untiy Timeline feature and I don't like that you need the create a new signal emitter every time you want to do a new action. Is there a work around or better way? because I don't like to have so many signal emitters in my project
you can simply out the RaycastHit and see which collider it hits
if you check the docs you´ll see how to use it
also no need for the ~ if you declare the layermask via inspector
probably not, this is basically an improved system from the "Event" in Animation clip/Animator
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Physics.Raycast.html at very bottom this shows you how to use the RaycastHit, as you have it rn
then you can use
Debug.Log(hit.collider)
oh ya but you also do need RaycastHit to check what you hit
yes that is what i said
totally missed that in the screenshot of code lol
build done with no errors
thank you
congratulations
i think people should learn to read console messages
they do have a purpouse
especially error messages with a red color
yeah who knows might be something that got added during build process if the game was able to run with a compile error
just saying
but also could be something in that file might've contained an editor UnityEditor namespace only extension method
hell yeah thanks for this. ima do all these as well as the unity course
hay I'm just doing some testing but this line
isMonster = Physics.Raycast(transform.position, Vector3.forward, playerHight * 0.5f, whatIsMonsterdetect);
just refuses to work for me
I think its the Vector3.forward but i'm not sure why Vector3.down works fine
I'm not really sure why this is popping up but is it important to fix early on?
are you actually using the Package Validation Suite?
first, make sure that this code is actually running at all: use Debug.Log to print something out
you can also use Debug.DrawRay to visualize what you're doing
One possible issue here is that you're using Vector3.forward
This always points in the world +Z direction
It doesn't care which way the player is facing
to be honest i dont even know what it is
If you want the player's forward vector, use transform.forward – this is a vector pointing in the direction of the blue arrow
You can ignore the message. You probably don't even need to have the package installed.
Unity recently introduced package signing, which lets package authors add a digital signature to the package
(to prove who created it, and to prove that it hasn't been tampered with)
A lot of existing stuff will not have signatures on it
thank ya thank ya
hello unity community. I am currentlying experiencing a AndroidManifest.xml issue. the issue relys on READ_PHONE_STATE. i am asking if anyone can help me fix the issue and locate the issue.
Issue details: The upload could not be completed because your application contains the following Android permissions that are not supported: - android.permission.READ_PHONE_STATE Please remove the following permissions and upload your application binary again.
Which version of Unity are you using?
2021.3.33
I've tried to use this but its just working I have no idea why
Debug.DrawLine(camOrientation.position, camOrientation.forward, Color.blue, 999f);
here this is what I got
DrawRay, not DrawLine
This would draw a line between two points
If you don’t see anything, though, that suggests that the code isn’t running at all
I tryed this
Debug.DrawRay(camOrientation.position, forward, Color.blue, 999f);
but now its just going the wrong direction.
what is forward and why is it now different from your camOrientation.forward
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Debug.DrawRay.html
Vector3 forward = transform.TransformDirection(Vector3.forward) * 10;
its this line
if you wanted it longer you just do dir * length. Not sure why you copied the dir from docs
tried that it didn't work
Hey everyone! I'm doing this rollerball tutorial, and for whatever reason, the ball wont move. Ive copy and pasted the code from the tutorial, I've rewrote it multiple times, idk whats wrong. Can someone take a look at it for me please?
well its gone now.
and sorry I got it working now I just needed to change the (Vector3.forward)
!code 👇
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
camOrientation.forward * length would've worked fine
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"></uses-permission> where do i put this, on top of the manifest? bottom, or on that line?
did you check console window
can you be more specfic?
ok yea its empty.
during playmode?
& did you put this script on a gameobject
empty during playmode
script is on a gameobject
put Debug.Log in OnMove and check results in console,
check what you set speed to / screenshot inspector of your object in question
couldnt figure out debug. but apparently it was an input issue. now it just wont move on anything other than the x axis
Input is being read into a vector2 which is x,y
To apply force in 3d space you need to make a new vector3 like so:
new Vector3(input.x, 0f, input.y);
remember that z is forward in 3d space
ohh right thats a rigidbody not rigidbody2d. you trying moving up/down
forward/back
this was the fix
yeah but in code you sent you put y
thats up down
with gravity also toggled probably why it was not working right either
idk lol. I did this the other days with the movment of another tutorial and it worked great. I accidently deleted it and tried this way. Not working as well as the other way.
I appreciate the help though guys
Hi so I cannot find anything on how to draw a circle like have a DrawCircle function with color i can only find non filled but not filled and eather there is no tutorials for it or i am just stupid could someone please help me?
Moving with physics can be tricky so use whatever works best for you.
The way to get input doesnt matter so best to learn the new input system.
is there any read only areas with System.IO stuff?
or can i edit things in the "dataPath" with code?
use persistentDataPath
A file being writable (and readable) is down to the OS
ok
persistant data path is the best place for putting game/program data in a safe readable and writable folder
streaming assets can be used but only for desktop platforms
can someone help pls, why isnt this visible here?
you dragged in a text file instead of the gameobjects component
No you need to add "PlayerMovement" to a game object then drag in THAT
you mean this?
that is a component
do scriptable ojects have to be in the resources folder?
the gameobject that has the PlayerMovement script on it
you gotta put that in
Yooo
i got inheritance down however im hearing composition is way better. how would yall recommend learning composition
there is no "better" each has their own use
you can combine them too
ok yeah I found the function but it doesnt do anything
word, how did you learn composition and in which cases they should be used
its situational lol
every project / goal is different
You dont need the if because Rotate() is executed when the action is invoked
Did you assign the function in the unity event correctly?
I think so
to get an idea watch actual C# / microsoft MVP vids or stackoverflow sometimes, you will see plenty of examples / usescases described
epic
that is correct. as long as the action is in "Player" map it should work just fine
any ideas what might be wrong?
both a piston and a person Move, doesnt mean both should be part of the same heirarchy of parent but may both have the same component that move they can be more "freeform"
Right, kinda like how multiple objects in unity will use Rigidbodies and colliders
This should probably be "Value" type so you can read the input data but button should still activate once 🤔
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.17/manual/RespondingToActions.html#action-types
yeah I read the docs, however this is not a basic player movement
this is snake
I only need the input to rotate the snake
so from what I understood, button is the type I need
yea and how do you plan to know the direction the user pressed?
kinda, the importance is that you can certainly use both and achieve good results
well I will just store a variable and whatever button the player will click, that will be the direction
for s it will be down, for d right etc
no you would have the action give a Vector2 value which you then read and use to know the direction the user wants to move
You have assigned 4 keys for 1 button action
You therefore cannot know what key was pressed
its impossible to check what button has been clicked?
the default actions do as i state too
the code still doesnt work
Its common for beginners to think "i need to check if A was pressed to go left" but reading 2 dimensional input as a Vector2 makes more sense and is more useful
Your action maps some keys OR a joystick to a 2d input (ideally)
oh ok
but the code still doesnt work
id just follow the quickstart guide: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.17/manual/QuickStartGuide.html
I dont know what else you have done
in javascript there is a promise.all that waits for all of the async tasks to get done before code is triggered. Is there anything like that in C#?
Task class
UniTask offers such a function as well as Task
Do not use Task in unity
use unitask: https://github.com/Cysharp/UniTask
Its the best Task replacement suited for unity
Awaitable (from unity) is missing many features that Task has.
is it in the package maager?
sadly awaitable misses that one too.. only cases I found it useful was await some unity event or convinently switching thread to main
NO
you can add it as a package which is explained on the unitask github page
@golden notch
ohh
no one reads anything anymore 😐
it' not in the package list
READ THE PAGE
just used to Clicking "releases" and downloading stuff
it's way at the bottom
the main readme covers the main features including UniTask.WhenAll()
well... i'm a bit stuck. I can get all the filepaths in a folder, but connecting that to an addressable istead of Resource.Load is tricky
these are scriptable objects
how can i call the sprite manager and change the color to these blocks in the array
sprite manager?
ok better explanation, im trying to make a system that selects one of these squares at random via an array, how do i access and modify the selected block's sprite manager via that
with addressables you use addresses which can be anything so thinking this way is wrong
you can however use labels (tags) in addressables to easily load many assets in one go (e.g. tag many things "ItemIcon")
if i do tag them, do i have to change all the adressses to somethign shorter?
declare a SpriteRenderer component and name it, (make sure its assigned) use that variable to change color as needed
Up to you. Right click them in the groups window to use the auto simplify option.
wait it simplifies the names not the adresses. do we touch the path at all?
i know how to call it i just dont know how to get the specific chosen block in the array to change color
the set active script was just me debugging btw lol
store the sprite renderer in a variable and then modify its colour?
do we change these at all? or keep them long?
thats the asset path, its showing you this information so you know what asset this is 😐
would this work?
oh, i thought it meant you could shorten that to get "addressables"
if the squares are rooms, yes
yeah they are all in the rooms array
if you Room is its own component you can also just make a public get property for the renderer
lets step back. when you first make an asset addressable it usually sets the address to be the asset name
e.g. Assets/foobar => "foobar"
i can then change the address to be whatever i want such as "coolbeans123". I can use this address to load Assets/foobar still.
The menu option I told you about just automates making addresses shorter e.g. removing folders from the address.
oh yeah i forgot there's a channel for them
Yes but dont you want to then do something to that sprite renderer after?
SpriteRenderer renderer = thing.GetComponent<SpriteRenderer>();
renderer.color = someColor;
what?
if using asm defs you need to add the reference to unitask
well made packages/plugins actually use them
i dont see how thats calling the squares and not just itself, this isnt the code inside of one of the squares.
I have no idea what that means
is rooms[currentRoom] not getting the desired room?
I cant read your mind
ok yeah its getting the right thing but im not completely sure what you mean by this
i had to restart visual studio
then perhaps learning more about c# is what you need
man im trying 💔
thats okay, we all have to learn! I suggest this because its a critical concept to programming to understand getting an object reference and doing something to that (e.g. get some thing and modify a property on that)
SpriteRenderer[] boxes;
boxes[Random.Range(0, boxes.Length)].color = Color.red;
hay I'm just having an issue with my Input GetkeyDown. Despite all the prerequisites being true its vary finicky and rarely responds.
eh depends how you call ledgeGrab, and how set IsInAir / isLedge
well I call it in the update and IsInAir / isLedge are just simple bools.
I get that they're bools, but I mentioned how you set them not what they are
if its in Update it should respond fine, the only other two that can affect is the other two bools
all the prerequisites being true
how are you debugging this, and how about their durations etc.
Rare its something itself wrong with GetKeyDown
KeyDown isn't held so you need to press it and only triggers if all three are true in the same frame
I have some the bools public and some text that runs. but I think at least from my debugging its the GetKeyDown.
I did some testing it with out the requirements and its still funky.
tested in what way ?
removed the requirements then ran it.
so whats wrong with it
still doesn't reliably respond well.
So i downloaded Visual Studio Community, but still can't link it with Unity, any advise?
follow the rest of the steps
Where do you call ledgeGrab from?
Oh nvm you said update
I did, the file doesn't show up
how do you even determine that if its only logs, did you even uncollapse them ?
did you restart unity
pressing it like 20 times and seeing if it responds.
Yes, i restarted that, and then restarted my PC too
show you have the workload installed
so you don't got 20 logs?
nope.
how many
What does that mean?
1 - 4 sometimes 16 if I hit it more than 20 times
@hearty junco Can you help me
With?
Sorry i am in the same boat as you i amen't one of the helpers
I'm 2 days into using Unity lol
!input
To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling
• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.
ok I'm going to try and restart unity @rich adder
doubt thats related
you dont have to spam the same photo and you yet again cropped the part that shows if its installed or which size it is
Nav where do I find project settings
I tried making a new one and it also had issues so this is my best guess.
merry christmas, 1 more time to add to the spam
next you need to check the Visual Studio package is installed in the unity package manager
I doubt its GetKey. Are you sure your editor isn't lagging or something
check the fps counter stats
anyone know if this is correct to remove READ_PHONE_STATE
this is related to a VR Game sir.
so then #🥽┃virtual-reality
though android permissions is still mobile 🤷♂️
yeah idk why its asking
you think i should reset my project?
were would that be?
to a compatiable VR.
try the VR template by itself first ig
where it says stats in the game view
I know nothing of VR Development
thats arlight man, weird its giving me a permission error over a VR Game...
where did you see you need to set those permissions
somewhere between 400.0 - 500.0
maybe your keyboard is broken lol
ya no.
this is the error, The upload could not be completed because your application contains the following Android permissions that are not supported: - android.permission.READ_PHONE_STATE Please remove the following permissions and upload your application binary again.
so you removed it? seems to still be in the file
yeah, im gonna try to important into a project with Oculus crap in it.
where would it be in the file? in the manifest?
seems to be there but again I havent made anything for an oculus/uploaded, maybe you should check their docs for mention of this
thank you for trying tho,
do i set permissions in the manifest or in player settings?
If I recall unity does it for you in project settings unless you need something specific
perfect! any area you see that at?
like more specific
if not ill keep looking,
Maybe under Player somewhere
yeah im in player for via android
very strange, no add option on the installs, and the editor cant validate on install
did you use hub to install them
i might be blind.
lol
that answers nothing..
after trying to code for the first time, i feel ya
just cause hub detects them doesn't mean they were installed through hub therefore adding modules isn't option
i installed the visual studio from microsoft
just a manifest error, it's just blinding to see these permissions.
and then when i finally fix it, ima gonna be like. "this only took that long to see it"
so yeah
did you click the link
https://docs.unity3d.com/6000.3/Documentation/Manual/android-permissions-declare.html
here says how to do it
i did, wants me to download a studio. AKA, android studio
yes
thats how you modify it proper so unity doesn't add its own permissions
before build
awesome. sorry, my PC freezes alot, so it may take long to type stuff.
idk why
i see, visual studio wont let me look at the permissions
when you export project you do external so it can be finalized in android studio
1.3 gigs more to burn my PC in half
ehh its worth it if it helps you get something done
do i need virtual device? or should i just move on,
very true man.
anything to get this to work.
thats only if you want ability to test them in virtual environments
doubt you need it for vr
yeah no.
Anyone know how to use the new Unity input system I don't know what I'm doing wrong
thats not new input system
there are several tutorials pinned in #🖱️┃input-system and resources online
also dont grab input from fixedupdate
also you should not use deltaTime on addforce
that 500 is very high because of deltaTime
How else do I fix the framrate update thing
Didn't mean to reply to that
frameRate thing ?
addforce happens in FixedUpdate.. its a fixed timestep.. u dont need to scale or multiply it w/ any time variable
how do you export the file again?
I linked the docs for it you just have to read it a bit, and click the links
mb, closed all my sites to let this download quicker
Hello, i have this issue with a UI Canvas that i created, where whenever i try to scroll, a "ghost" layer of the texts i added appears. The way i append the text is with the function HandleNewMessage()
small question, Unity's Sprite atlass can help against stuttering when new sprites loads up in a scene for the first time, right?
hello. which one?
I had to add the selected line and it's still disabled, what is happening here?
it's only doing that in the handbook UI GO, nowhere else
You're enabling a component but are showing a inactive game object
To set an object active or inactive, use Set Active
my bad, why is it disabled though? the source copyslot prefab is not disabled
How are you determining this? The image you've shown only shows an inactive object
wait why is it disabled now?
Reminder that enabled/disabled is a term used for components (illustrated in the inspector). Active/inactive would be the term used for Game Objects (illustrated in the hierarchy). If we're using different terminology, I'll not be able to help you due to potential misunderstandings.
yeah i changed it to active now islot.gameObject.SetActive(true);
why do i have to do that to begin with? the prefab it copies from isn't inactive.
wait
why is it inactive i ust changed it
I've got no clue what you're talking about or have changed. Post your updated code, an image of the prefab, the hierarchy, inspectors and any other necessary information.
prefab
i enabled it and clicked save and then wen back to it and it's disabled again
The parent is inactive...
what the what? why can't i enable it?
prefab literally not active
Set the slot game object active
the parent is inactive and grayed out
the parent is temporary to display UI element
its going based of the UI child in this case
it won't stay active when i set it
unpack the prefab, keep it active and make a new one
Hey question,
I have a biom generator that paints the trees with a prefab that has capsule collider. I have written a few classes to recognise the tree infront of me from the terraindata tree and allow me to chop it. When chopped it down, I remove it from the terrain data but the collider still remains. What's the actual solution? I'm debating about doing a proximity check and whatever tree is in x radius, convert it to game object but I worry about performance and there must be a better solution no? Or track where the trees are and create empty game objects with colliders on their position and delete them as I go idk
ok completly made a new file, keeping the old one
Can someone help me with a program? I'm trying to create a script that rotates the player towards your mouse position.
I've created multiple renditions so far and this is my current one:
This is in a 3D space but the camera simulates a 2D space (top town orthographic)
ok so i figured out the issue, i was disabling the copyslot at the beginning of my code to remove the duplicate slot that i left there, and it suddenly started deleting it for ALL slots.
hi all, i need some help understanding a hierarchical state machine.
- at any one point, there is only one active leaf right?
- does that mean that all states in the path from the root to that active leaf run its state logic? or only the leaf runs its state logic?
- what is the flow of checking for transitions? on every tick, does the checking order go from root -> child of active path -> down to active leaf? or from the active leaf -> up to the root?
how exactly isn't it working?
- Generally, yes, state machine implies only one state active at a time. In HSM you can consider the whole branch as being one state.
- Generally, yes.
- Yes, but it's an implementation detail.
Programming patterns are just general guidelines. You don't have to follow them to a tee. In fact you often need to adjust and bend the rules to the needs of your project.
For example, you might want to keep the leaf state active regardless of the conditions of their parents, so you wouldn't check from the root.
if i am making a leaderboard
is it better to enable it on tab down, disable on tab up or
enable when tab is pressed down, then else statement that disables
or doesnt matter
whichever works for you.
toggle or hold can both work, but one might work better depending on the pace of your game or the context that it's in
you could also make it configurable, like what minecraft does with sneaking/sprinting
try both, see which feels better to use
the logic is the exact same
right
i mean
{
scoreboardUI.SetActive(true);
}
if (Input.GetKeyUp(KeyCode.Tab))
{
scoreboardUI.SetActive(false);
}```
or
{
scoreboardUI.SetActive(true);
}
else{..disable}```
i thought you were talking about toggle vs hold
do the former so you don't constantly activate/deactivate it
didnt actually need to use android studio, thank you again for the help.
why would you need android studio for doing stuff in unity
If someone can help me with this that would be really helpful, or should I send this to another channel?
seems like a #📲┃ui-ux question
Ty
Dunno if i said this earlier but thanks cuz i managed to fix the dash script by doing this. Pseudocoding is kinda hard to do tho since I'm still not used to coding 🙏
But still thanks this helps so much
I had to rewrite the whole thing but it took me a short amount of time compared to last time 😭
what does this mean?
You have an invalid JSON file
have you tampered with that file?
no i have no idea what it is
i dont know what it does
it lists all my packages
it's a lock file, specifying which exact version and url were used
you could maybe try having it regenerate?
close unity, pull that file out to some other folder (don't delete it just in case), then reopen unity
if it doesn't work, try that but also delete the library folder
potentially, maybe
willl it affect any of my packages if i leave the error there
most likely
does this mean anything or should i just delete library folder
i am still gettin the same errors
if i remove the linux modules will this go away
I'm currently making a level editor, and trying to implement certain editor fields that only appear when another field is set to a specific value
(For example, the float field "Homing Speed" should appear only when the bool field "Homing" is set to true (Enabled))
How would I implement this "condition"?
This is the current implementation I have:
public class EditorField
{
public string name;
public System.Type type; // this is used to define what type of UI element will be used for the field (radio button, text field, etc.)
public List<Condition> conditions; // every condition within this list must be met for the EditorField to appear, altho idk if i'll ever use more than two conditions at the same time, just made a list out of habit
public EditorField(string name, System.Type type, List<Condition> conditions)
{
this.name = name;
this.type = type;
this.conditions = conditions;
}
}
public class Condition
{
public object field; // the field whose value must be checked, I don't know if this works for value-type variables, probably doesn't
public object value; // the value the field must have in order for the associated EditorField to appear, should probably be expanded to a list to allow for multiple values when dealing with enums
}```
i believe that would go in #↕️┃editor-extensions
to confirm, you deleted the library while unity was closed, and then let it rebuild, correct?
yes
by the way, is there a way to remove a module from a unity version without having to reinstall the version?
Oh my days. NO way I didn't see that! Thank you so so so much!
is it not possible to use GoogleSignIn with firebase for Arm64-v8a?
batuhan dcgel
hi guys can some one help me? I can't dowland installs
delete everyting install again
Is learning coding hard
Türkmüsün?
nanelimonkabuğu türksen gel arkadaş olak
Depends on the person. Anything can be difficult in the beginning, there is always a curve with anything new
I know the generall starting basics but im having difficulty in generall on how to arrange codes and that 
practice
start small and make some simple projects
I’ve done it more than once!
Examples?
in unity or c# in general
calculator, to do list etc and unity flappy bird, temple runner
very funny when unity puts template grid gizmo in offset and you dont know how to fix it
i'm not sure what I'm looking at
is there a box collider here?
or is that a tilemap grid
its tilemap editing
tilemap is selected thats why its orange and it is intended to be invisble
Im trying to add my input reference actions from the unity input system onto a scriptable object this used to work a few months ago but now it doesnt work it just says none even tho its showing the inputs and letting me drag them in and my old inputs arent gone but if i try to change their input action it doesnt let me
using UnityEngine;
using UnityEngine.InputSystem;
[System.Serializable]
public struct InputEntry
{
public string Name;
public InputActionReference Action;
}
[CreateAssetMenu(menuName = "Scriptable Objects/Input Data")]
public class InputData : ScriptableObject
{
public InputEntry[] Inputs;
public InputEntry Get(string Name)
{
for (int i = 0; i < Inputs.Length; i++)
if (Inputs[i].Name == Name)
return Inputs[i];
Debug.LogWarning($"[InputData] No entry for '{Name}'");
return default;
}
}
idk it still just doesn't do anything 90% of the time
@swift crag where did you go? no helping
he started to help, but dissapeared
I Bubble the type that implements the pointer events?
Also I do not see EventSystem in your scene which is required
Create it from the gameobject create menu
oh sry it's there I just forgot to show it
ya
Im following a tutorial right now and they are suggesting that I make a variable that should be accessible by other scripts accessible through getters and setters for cleaner code, but to me it just seems like making a public variable with extra steps. Is there something im missing?
In this case yes it's not adding anything. But it's good practice because in the future you can add things to that getter or setter
You now have the ability to run any sort of code you want whenever that variable is accessed or changed.
For example, whenever the state changes, it could first run some sort of "exit state" code on the old one automatically
Often you will do some validation or perhaps fire off events or something in the setter
Confirm you have an event system please and if the component has a warning read it and press the button to fix it
Guys, I’m installing Unity 6.3 LTS via Unity Hub, but I only see Visual Studio Community 2022 as a dev tool. There is no Visual Studio Code option. What I need to do?
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
if you want to use vsc, just uncheck the VS install and download vsc separately
Like this?
seems like you already installed vs code and selected it already as your IDE
I selected now
make sure to configure it correctly so you get intellisense function
whats "intellisense function" means
code auto complete and code suggestions
oh ok btw how can I start to code
by creating a new script monobehaviour then double clicking so it opens up in vs code
Oayk I understand. Thanks for everything
Wrong channel. This is the beginner coding channel. Consider moving the post elsewhere #🔎┃find-a-channel
hello i got a problem that even the ai isnt helping basicly i got an error and i cant solve it i will send my script that im using for this
and this is saying that the Player.Cs i dont have the public void addcoin but i have
so i dont understand
and i want to make when i kill a enemy i will get 10 coins as a reward per kill i have from bob
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
also where is your addcoins function even implemented?
what
also this is very clearly ai generated code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
okok
You also have 2 scripts called Player apparently
thx guys
it is funny how people let ai do the job but when the ai is not able to solve a thing they come and ask here
So you would prefer that people dont take any effort in solving the problems themselves and immediately ask here?
i am saying beginners shoudl avoid using ai too much
it is clear they could not solve something really simple
If someone builds something and solves real problems, they will face major issues even with AI. Thats when they learn it. Used to be google, now its AI. You also suggest beginners not to use google?
i am not going to argue with you because you clearly ignore what i said
programming begginers shoudl avoid using ai generated code, for you
Also its about how you use AI. If you use AI and just want it to solve your problems, then you wont succeed in any way. If you use AI to mindstorm how to tackle issues(without it actually fixing it) AND actually think for yourself and critisize what AI answers you, then you might have a chance.
now explain how someone who doesn't know what they are doing is going to criticize the AI's output.
beginners need to be doing their own research and not relying on the output from something that just predicts what the next text should be without any critical thought
You got that point. You need to do the research anyway. You could compare what AI says with other sources and then make up your mind
or, just do the research in the first place and skip the redundant step where the gets-things-wrong machine tells you something wrong and you have to research it anyway
This is an English speaking community.
alright sory man
you're calling GetComponent<CharacterController> on an object that has no CharacterController
this is a code channel
OH MB
but double click the project tab
whats project tab
Thats the window you have maximised currently. I hope you can read and see that
yeah but when i dc nothing happens