#💻┃code-beginner
1 messages · Page 792 of 1
yeah its 2 in the editor
ok may i ask why you are not using a simple animation for this
that is why animations exist
@praetorblue muted
Reason: Too many messages with links sent.
Duration: 29 minutes and 39 seconds
evil bot
~~i did raise that concern here https://discord.com/channels/489222168727519232/1442873844317556798~~
oh this was links, i wasn't aware there was this separate rule
about time to overthink it
!unmute 179367739574583296
@praetorblue unmuted
was that one too many edits with a message with a link?
i settled on using the same post process volume im using for a hue shift and just slowly lowering the exposure
I know no off topic (sorry) but your role "resident" how did you get it?
quick question, i have a trigger that isnt showing up in my inspector (i have a door opening for a pressure plate type of thing and the pressure plate isnt showing up) to be more specific it does show up once then it just doesnt appear as an option
what do you mean "as an option", where are you expecting to see it?
like on the script im trying to pick the object as the trigger and it just isnt in the list of objects to choose from
i try to drag and drop it and it still doesnt let me
yup
what type is it, and what component are you trying to target on that other object
its just one door thats not cooperating
box collider thats a trigger thats ment to play a door opening animation
(go check, don't answer from memory, these are debugging steps)
one door works pefectly the other is giving me this problem
what type is the field declared with, and what component does that pressureplate have
i dont have it specified
im making a rube goldberg machine so i didnt think itll give me an issue
you have a serialized field that you're trying to drag the pressure plate object into, correct?
yup
what type did you declare for that field
trigger
and you have a class called trigger, or...?
yea
and that pressure plate has the trigger? (don't assume, go check)
and these are both in the scene?
you aren't trying to drag something from the scene into a prefab, right
yea
what happens when you drag that object in
WRong type
it was yeah
This is a code channel. Do you have a relevant question?
This is also such a specific question with no 1 clear answer lol
The equivalent of asking "how do i make a million dollars"
anyone know why my game functions so differently in build compared to editor?
its not a specific issue this time but so many things work in editor but not in build
Can you be more specific?
First thought is anything that is frame rate dependant being affected because build runs faster than the editor
clicks aren't being registered in the build for some reason
but its perfectly fine in the editor
im using the legacy input system so just
mouse 0
i could try switch to the new one
Not code related but no proper channel for it...
Anyway, is there a way to search for components. I have a capsule collider on my player somewhere but cannot for the life of me find where as I got a billion children.
Is there an easy way to do this?
have you looked at the player logs to make sure there aren't any errors that are causing this
Have you considered searching for a function that might allow you to get a component in children in the docs
nvm, it was a disabled char controller component.
i've found at that there is a missing script that isnt being created in a prefab
it works in editor but the script isnt there in build
how have you determined that the "script isnt there in build"
-# i'm gonna bet this is actually a script execution order issue causing an NRE
if (pointInfo == null)
{
audioSource3.Play();
}```
i have a noise set to play in build
Since you said not code-related (for the future) you can do t:ComponentType in the hierarchy to find objects that have a component type. Can do that in your player prefab easily, or can shift+F the player object in the scene (hides everything else) then do the same search and ignore the ones that have the hidden icon. Quick Search lets you do more refined searches too, but the prefab type search is the simplest.
so i will ask again, how have you determined that a script isn't there in the build. this does not prove anything related to that assumption.
if there is a script, then point info will not be null, and the noise wont play
the noise doesnt play in editor and the game works fine
but in build it plays and breaks
that doesn't mean that a "script isnt there in build"
that just means a variable is null and that the object you are calling GetComponent on does not have that component attached.
alright
have you actually bothered to read the logs to see if there are relevant errors or did you just ignore that part and pretend you can debug without doing it?
my bad, i got the editor logs mixed up with the build logs
where do i find the logs?
!logs
Editor logs
Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log
MacOS: ~/Library/Logs/Unity/Editor.log
Linux: ~/.config/unity3d/Editor.log
Unity Hub
Windows: %UserProfile%\AppData\Roaming\UnityHub\logs
Mac: ~/Library/Application support/UnityHub/logs
Linux: ~/.config/UnityHub/logs
how can you switch characters and their abilities i have some ability and gun scripts for characters but how do i switch characters and switch all the abilities
You have abilities and guns how do you not know how to switch up your own system ?
what do i look for in logs?
errors?
this is a lot of text, anything specific?
you need to look for errors. that is as specific as i can get because we literally do not know if there are any errors or what they are because you haven't checked yet
search function will help you out
[Licensing::Client] Error: HandshakeResponse reported an error:
ResponseCode: 505
ResponseStatus: Unsupported protocol version '1.17.4'.
found this
i went to the path on here
my bad, i assumed you knew how to read and use common sense and would click the "Documentation" link there since i said you needed to check the player logs and didn't say anything about the editor or hub logs
d3d12: failed to query info queue interface (0x80004002).
ArgumentException: The Object you want to instantiate is null.
this looks relevant
i have no clue why but the build also seems to be outdated
i'll make a change to the project and make a whole new build folder and its still an older version
i've tried clean build
maybe it would be better received if you had even an ounce of patience in the beginners channel and explained things fully to obvious beginners
point to anything i didn't "explain fully", other than expecting you to use your eyes with the bot message
maybe a beginner wouldn't fully understand the difference between an editor log and a player log
anyway im not having an argument here, goodnight
my guy, you literally started this
your attitude was off-putting and hostile
your lack of effort in troubleshooting your issue was off-putting and hostile
im a beginner in unity, in the beginners channel, am i not allowed to misunderstand things?
i have been stuck on this for the past 3 hours, believe me i have tried to put full effort into this
anyway fixed the problem, turns out it was the build settings causing the issue
@solemn cedar Heya, I saw this a bit late, but a plugin like this could really help in that situation
https://assetstore.unity.com/packages/tools/integration/log-viewer-12047
Lets you view logs in builds so you can log a bunch of stuff to narrow down exactly what's happening, or even see errors
oh thanks! sounds useful
It really depends who's around lol. I find AI is surprisingly good at debugging errors and stuff most of the time
any specific models you recommend?
gpt was just as lost as me 😭
Is it recommended to use public sealed class for a good maintanable code, for the classes that are not ment to be inherited ?
I do not see sealed often in scripts, so just wondering for the best practices
lol I use GPT, it's good at copy+paste random ass errors, but then again you need those errors. With that plugin you'd be able to see the errors better in game, describe how it was missing from the build, etc. I feel like you just didn't have enough info for it
Sealed is mostly important for things that get distributed as libraries. Game code isn't really used that way so it's not important. It's just something you'd do for organization mostly
yeah i see
to add on to this, there is also a very minor performance benefit to it, but it's so minor that it will make practically 0 difference
!IDE 👇 make sure your IDE is configured properly so you can autocomplete methods so you spell them right
nvm I mispelled it
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
yeah autocompleting does work
including for methods like OnTriggerEnter?
yeah I think idk why it didnt work
I mean I either didnt use it
or I removed the i by accident
Assigning it to a class field on start/awake and then just reusing that variable should fix it. The issue is that you're assigning a method which basically creates a new delegate.
How exactly I meant to do that?
I read that but... honestly could not understand much
https://stackoverflow.com/questions/20837187/allocation-free-delegate-or-other-way-to-call-method-by-address
public class Foo
{
public void DoSomething() { /*nop*/ }
private Action _doSomethingDelegate;
public Action DoSomethingDelegate
{
get { return _doSomethingDelegate ?? (_doSomethingDelegate = DoSomething); }
}
}
hm
I think I starting to understand, you tell I can assign them on awake?
this piece of code makes it to cache a delegate a first time it gets called
I think
Is this where I can ask about 2D collision issues & colliders?
can someone with some background help i am a college student were most of my calsses are in c++,
the only languages i really know are python and c++ so is transitioning into c# as a begginer in unity easy or ???
Assign all the methods to their own delegate variables on awake. Then at runtime just assign that delegate variable to your doState or whatever it was called.
are there even things which C# can do which C++ can't?
Hi Im doing the unity sprite flight course and so far I've got obstacles the player and a scoreboard that works and I don't just copy paste the code like I can point at almost any piece of code and explain what it does. But I can't write it myself, I just won't remember what to do exactly. So im asking whats a better way to learn all this?? What am i doing wrong
Microsoft have a short blogpost about this topic: https://devblogs.microsoft.com/dotnet/understanding-the-cost-of-csharp-delegates/
c# is a managed language so its not really fair to compare them in such a way
c# has reflection built in to the language but cpp does not
It's not as hard as learning from scratch. There are many concepts that are similar. C# is considered a C-family language.
If it's code related, perhaps.
I have to say I just use
private delegate void DoState();
private DoState doState
And have no clue what Actions are
Hey if I have a collider2D on my player and another object, which one triggers OnTriggerEnter2D?
that sounds like assigning a delegate to a delegate or something
like assigning float to a float
It basically is.
instead of a value
do I need a rigidbody2d on one of them? and does the function only run on that one?
I thought delegate is a type of a variable
OnTriggerEnter2D will be called on both objects involved, and yes a rigidbody is required on at least one of the two
And it's actually what happens when you assign a method. The compiler just adds the overhead behind the scenes.
A delegate is an object that contains info about a method. It is a type, yes.
why are you even allowed to do that
omitting a step
You're not. It's just implicit. Just how you can assign an int to a float without explicitly casting it.
I can't get it to call. Can you see if I'm doing something wrong?
makes sense
Yeah that link doesn't really say much
it takes you through everything you need to check. you just need to actually read it
apparently not
Here's the player collider, I tried with trigger on/off, dynamic/kinematic
And the damage ring, 'ExpandingRing' script should run OnTriggerEnter2D(Collider2D other) but doesn't
Both are on default layer
okay and what did the link i sent say about a kinematic rigidbody and a static collider with regards to OnTriggerEnter2D?
erm the collider marked as trigger gets the trigger message (the screenshots make me think you did the opposite)
both objects involved in the trigger overlap do
damn TIL
And tried both on
if only there were some convenient Trigger matrix (2D) you could look at to see what settings work to cause a trigger message to be sent
And opposites lol
Those links are always fully understandable to unity beginners
That's why discord exists, no?
if you won't bother putting in the effort to read the information in that link then i'm done helping.
it takes you through literally everything you need to check for this
unity huh how exists because the same things get asked all the damn time 😆
great less clutter in the chat, thanks
I think I understand now
so delegate variable is just a class
and I have to have pre made classes-delegates for method I would like to use or I would recreate them each time I reassign the main delegate which getting called in Update()
am I getting it right?
if you can't be bothered to put in the effort to read information then why should anyone else be bothered to help you?
we can define delegate types which define the "method signature" that this type can reference
Action and Action<T> are pre made delegate types in the .NET lib.
You dont have to make a delegate type but it can be better sometimes as then we can define names for arguments
I'm trying my best to read that shit man, you're not very nice nor helpful
I'm using a trigger, I don't know what a kinematic trigger is
pretty much yeah, the same can really be said for any reference type. it's cheaper to cache it and reuse it than recreate it
have you tried reading all of the information on the page?
I have a rigidbody with a collider trigger, and another collider trigger
You know how quickly the answer could have been given instead of this circle jerk waste of time
for some reason I was assuming delegate was a value type
Why does this discord even exist, just tell everyone to google their problems and read the docs lol
except there are about a dozen possibilities for what this issue could be caused by and it is much faster for you to check them yourself rather than require someone else to walk you through the steps that are already laid out for you
those should already be the first steps you take. it's literally in the rules for the server
why are you even helping blackhunter with delegates, all that info is online, send him some links
why are you still here if you don't want the help that was provided
it's just 2 gameobjects with a collider on each and a rigidbody on one. Can't see it being a super complex problem
both have trigger on, with a rigidbody
you can link me all over the internet, that page says it should work
it fits within the matrix
great! you made it through step two. have you considered going through the remaining steps
It doesn't seem to have been mentioned yet, but how are you even confirming if it's called or not?
You should probably have shared your code at the very start to make things easier for all of us.
As well as the debugging method.
Just a basic Debug.Log, Funnily enough, I think it's a problem with the HotReload plugin
If I hot-reload anything it magically starts working, but starting playmode it doesn't work, until I do some hotreload
Yup, restarted unity literally fixed everything. Thanks for this, made me realize it's probably something else
OK, so it had nothing to do with unity itself..?
Funnily enough, asking a simple question did the trick, instead of repeatedly telling me to read the docs like im a child
Yeah some weird caching issue with a plugin I guess, wasn't even using the latest compiled scripts lol
But yeah everything works as expected now haha, thanks!!
Well, that's also on you to be honest. We can't really make assumptions about what plugins you have or don't have.
It's 100% on me, but it's nice to know that everything should be working, instead of making me re-read the same beginner shit over and over like im an idiot
Sometimes all it takes is knowing that everything looks right, to figure out the problem is elsewhere
"that beginner shit" is what's supposed to tell you it should be working. The alternative is for us to just copy paste the same stuff that's on that page and wait for your answer on each one. No one wants to do that. No one is paying us to help.
any idea why this is happening? im adding a new button but it's not showing in editor or play mode
Hey im just talking about 1 guy who consistently gives people a hard time in here, nothing about you or anyone else man. 😛
The button needs an image on it too, could you post the components? You could also make a gameobject and add a button/image to it manually
Nah, boxfriend is pretty chill. I'm often even stricter than that.
I guess we all have our good and bad days 🤷♂️
boxfriend

public void OnShoot(InputAction.CallbackContext val)
{
if (val.performed)
{
Debug.Log("idk");
}
}
The could should print idk when i hold the shoot and stops when i stop holding
What does it do instead?
it does only when i click when i hold nothing happend
that's because that's not how input actions work. that OnShoot method is only called when the state of the input changes in some way (depending on how you set these up to be called). you're also checking if the input is in the performed state, so you only get one log
if you want something to continuously happen while holding the button, then you need to subscribe to the started and canceled events, flip a bool depending on which state the input is in when the method is called, then use that bool in Update or something that is called repeatedly
Looks like it's working as expected
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.InputAction.CallbackContext.html
GameObject instance = Instantiate(item.GroundPrefab, renderModel.transform);
regarding this, is this the same thing as dragging a prefab onto the renderModel? If so, why is it going way outside of where it's supposed to be?
take a look at the prefab, what is the prefab's transform position
it's different every time
i said the prefab
how do I check that?
by looking with your eyes?
you mean this area?
great, so it is at 0,0,0. now what is the position of the object you are spawning it as a child of, this would be the object assigned to your renderModel variable
before continuing further, does that object move at all or does it remain in that exact position at all times?
more specifically, is it possible that this object is being moved before the child object is instantiated?
something else is changing the object's position then
wait, is this not happening at runtime?
and when you cause this code to run, does it perhaps spawn close to the middle of where your scene camera is looking?
little under middle
hello guys, im trying to build my game on my mac m1 and im trying to download the windows standalone support, but the installer always fails in the end. does anyone know why?
it seems to always spawn just above 0
yeah so this is because of a setting in the editor for spawning things into the scene, there's a setting that determines whether a prefab instance will be spawned at the world origin or where the camera is looking. and because you aren't specifying a position and this is happening in edit mode, it's probably taking that setting into account
!install 👇 also not a code question. and you should translate errors that aren't in english
- Make sure you have enough space including on
C:drive. - Check that it's not being blocked by antivirus/security programs.
- Look through the logs for a real reason why the setup fails they are pinned [here](#💻┃unity-talk message).
If you still have issues, perform a clean install in another location:
- Install the Hub and Unity in a non-system drive or a clean new folder in the root of
C:drive. - Failing that use the recovery Refresh option or reinstall OS entirely then repeat the previous step.
well i can't see it regularly either (during runtime)
am i supposed to know what you mean by that
where should i ask?
ok so it is spawning where it is supposed to, i just need to rotate it.
#🔎┃find-a-channel
but the answer is in the bot embed
but it's not showing up in the render texture
yeah its not unity but the windows support package for build on m1
but thanks anyway
and yet the troubleshooting steps are the same
just because it is a module doesn't suddenly invalidate the steps that were provided. there's nothing special about modules that make troubleshooting installing them any different from troubleshooting the editor install
if you say so
ayy i set the render layer and it's working, but it seems too high now.
I deleted the instantiation after i used it, why is it still showing in the second iteration?
wait why is there 3 in the second pic?
i give up... idk why it's showing THREE axes
Anyone personally try any good Tower defense tutorials that were actually solid? I have no clue where to get started on the code for one 🤣 (also no idea if i shoulda asked here or in unity talk but yeah)
it's not destroying the last element before it resumes
(Fixed by adding a instance.active = false;)
and sometimes this happens too
ok so now there's only one like it should be, still sometimes red though
and even though the position of the two axes are the same, they are somehow different
Too many. Pick one and have at it. If you don’t like it, move to the next tutorial. I've always watched multiple videos on the same topic to gain different perspectives . . .
I'm trying to create a monobehavior script but it keeps making this error, how do I fix this? [Worker0] Import Error Code:(4)
Message:
Build asset version error: assets/_unity essentials/scripts/danger.cs.meta in SourceAssetDB has modification time of '2026-01-07T07:00:21Z' while content on disk has modification time of '2026-01-07T07:00:22Z'
All I'm doing is right clicking in the project window and creating the script there
This chat is dead lol
!ask @upper pebble
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
cry about it
ok we do not need that here
At what point did you think that was appropriate?
ok, let's not start this, it's not gonna be productive
True
@upper pebble have you tried googling the error message, as instructed in this bot message
in general research is the first step you should take
I did but it came up with literally nothing. I'll try searching it differently
also keep in mind that other people would encounter the error with different file names and different timestamps, so you could remove those from your search query
i googled SourceAssetDB has modification time of while content on disk has modification time of and got some concise results, for example
Is it harmful to lerp camera movement for small visual effects? I know lerp is frame dependant but I dont know the extent so I was wondering if something small like fov change or movement bobbing would be bad to lerp
Could I get some help on some code I'm tryna do from a tutorial that isn't working for me
So basically I'm following this tutorial
In this Unity tutorial we're going to look at how we can implement a robust ground check using Unity's SphereCast method. We'll then use this to prevent infinite jumping by ensuring the Player is grounded before allowing another jump.
This is the fifth video in our series showing how to make a full 3D platformer game in Unity.
The playlist for...
to stop infinite jumping in my game, and I'm following it as close as possible, but I keep getting all of these errors that the person in the video isn't getting. as far as I can see I've done it exactly the way they've typed it, but there's still issues. the main one being "the name '_capsulecollider' does not exist in current context" and the only way I can seem to get rid of it is by removing the underscore, but I'm worried it will mess it up.
Ok well I fixed the underscore thing but there's still quite a few other issues
lerp is not framedependant
wronglerp is
"harmful" is a very vague question
imo, you shouldn't use wronglerp for anything
harmful as in will it have any noticeable problems other than being ever so slightly timing differences on different frames
not sure what you're saying, note that it's framerate dependant
0.1if is invalid
also the awake message needs to be Awake
have you done unity essentials and/or gone through a c# guide before?
doesnt matter the graph is helpful enough
for smoothing camera movement its close enough
No but I don't have time for that rn I'm kinda in a rush
I'll do it eventually though
if you have inconsistent framerate then wronglerp would jitter around
How do I make it valid
doesn't matter
i feel like you're just being ignorant at this point ngl
The person in the video typed it the same way and there's no problem with it
they did not.
you're following a video?
Yeah
go check it more thoroughly
Idk man I'm probably wrong but it looks pretty much the same to me
look closer
That's a screenshot from the video
and i'm seeing the difference there already
"pretty much the same" is generally not sufficient
I'm blind as hell man you could put a big red circle around it with flashing lights and I'd still probably miss it
their code
Oh man
your code
well that solves the syntax issue, but not the other compile error
you haven't fixed the underscore thing
I solved those a bit ago I just used an old screenshot by accident
also note that learning first will generally be faster than stumbling around not knowing what you're doing
if you want to actually make anything yourself that is
You got a point but I'm doing this for an assignment due tomorrow for my uni game design class, I've only been in it a short while and I'm low-key kinda lazy so I haven't been paying attention very much
Also they haven't really been teaching us how to use unity they kinda just give us their own video tutorials to follow
ah yes, making a game with a month long deadline on the last day, very common occurance here
(joke, in case it doesn't come across that way)
Nah bro you're right on the money 😭
preparing for facing those deadlines
anyway I am curious why can't I assign a delegate before runtime
Objects in editor and objects in build are two completely seperate instances
You can assign a delegate before runtime, it just wouldn’t be on the same object
Hence why we serialize and deserialize stuff
what are you trying to do? a delegate by default isn't serialized, a unityevent is and can be assigned before runtime in inspector
Just downloaded cinemachine, and there's no "Player/look" option in select input action, anyone know why???
perhaps because you haven't made it?
being curious
also please don't use images of screens, they're terrible to look at
it seems like I have to assign my states to delegates at Awake which is less convinient than if I could just do that while declaring variables
I'm following a tutorial again and the guy didn't say anything about making it he said to just pick it from the list
unity doesn't serialize delegates other than UnityEvent. if you want to assign callbacks in the inspector, you can use those
You do want to serialise them
I can still assign private non serialzied variables in the script?
i honestly don't know what you're trying to do here
Learn how to set up a basic free look camera in Unity using Cinemachine and Input System in under 60 seconds. Perfect for beginners looking to add smooth third-person camera control to their game.
📦 Tools Used:
-Unity
-Cinemachine
-Input System
👍 Like the video if it helped
💬 Comment if you have questions
🔔 Subscribe for more quick...
iirc by default you get an inputactionsasset with quite a few actions, he's probably using that
The amount of misinformation [SerializeField] has done to people
you'd have to show what your setup looks like if you want help with the specific problem. What do you consider "not assigning at runtime" if you don't want to serialize it. It has to be assigned at a certain point
Serializing saves stuff to file, basically. The inspector shows you things that are serialized. Keep in mind these are two seperate things
I’d suggest opening a prefab file in a text editor in order to get an idea of what unity serializes
this is not really a problem-problem but
I would expect something like
private Action ChasingMovingAction = new Action(ChasingMovingLoop);
to work instead of
private Action ChasingMovingAction
void Awake()
{
ChasingMovingAction = new Action(ChasingMovingLoop);
}
the inspector shows you want it wants to show
if in normal mode:
- if custom inspector, show custom inspector
- otherwise, show serialized, non-hidden fields
if in debug mode: - show non-hidden fields with serializable types
He has a big list of them in the video and most of them are there for me but that one isnt
either way you're assigning this at runtime, the inline variable doesn't magically do it before runtime
it just happens with the constructor if it was valid
yes, those are from the default asset. you could open a new project and copy the asset over, or you could make your own actions
and please stop sending pictures of screens
but it doesn't show me private variables? or private pre assigned variables are technically serialized?
no
How would I go about doing either of those
if a field has a serializable type, and it is public and/or marked SerializeField, then it's serialized
like if that was an array?
you don't know how to create a project and copy a file?
i mean, one of those is clearly not true
Yea but where exactly am I copying this file from I dong have it
then I don't want to serialize and @sour fulcrum was incorrect?
it's such a loaded question
you can't do anything before runtime, because runtime is where things happen
but technically you're already in a runtime in edit mode already
but like you can assign a private float and it's not a serialziation
Consider what you're trying to access here, the error you get on the first line here tells you that you're trying to access something you shouldnt
oh my god holy x/y problem
the float is a value, the delegate and the function your wanting to add to it are references to objects
you're getting an error here aren't you
this wouldve been so much simpler if you just said so
what's the right term for defining a variable with a set variable then?
well its clearly an error because it isnt valid c#, they were using that as an example for something they cant do
just use () => ChasingMovingLoop() goddamn
that doesnt work either
well yes the error is that
sorry, (ThisType x) => x.ChasingMovingLoop()
you can't because of what this says
this explains fully why you can't do it
it's nothing to do with the action
this is crucial info
stop making us guess
Idk what to tell you man I've looked around and I can't find it
sorry, I just had an assumption people here have a solid grasp on such things
we are not compilers, we are not psychic, we are not looking over your shoulder
more specifics just help reduce the questions needed
it's your responsibility to provide adequate info
https://xyproblem.info/ go give this a read.
no, copy it from the new project into your current project
that expects something to call ChasingMovingAction passing the instance of the object everytime. i really dont think thats what they want
i dont see where the confusion lies, they were just asking why that line isnt possible while it has to be done in awake
What so if I make a new project it'll just be there
fair, that's the pattern i use with a static field. obviously i don't have context so i can't make an accurate recommendation based off of guessing
you are right but people omit things they consider obvious all of the time, if not that chatting would be impossible, and here I made a mistake thinking you would already knew about this error
"i have an issue" <doesn't say what the issue is>
so many errors are possible
you have to say which one it is
it wasn't even an issue, I thought I can't do the thing because of some language quirk and asked why I can't
and the error explains
if you said you had an error that you didn't understand, it'd be so much easier to explain the specific part you didn't understand instead of guessing what you're actually taking issue with
probably, i don't remember tbh. you could also make a new action, presumably you've already done that for the 2 actions you already have
consider a separate example, where u replace this whole delegate with trying to modify or access a different variable.
public class Program
{
public int a = 5;
public int b = a + 1;
}
this is the same error and is essentially what you're trying to do
it's less of a quirk when you see it this way, the delegate part might've confused you more here
oh that makes so much sense
usually if im getting confused with syntax around delegates, I just mentally replace it with a separate type to understand it easier
i got more used to it over time but there is the occasion where i'm not thinking straight
now I am thinking why would that work with statics
a static variable isn't associated with the instance, while a and b are both on the same instance currently
heap vs stack?
no
Entirely unrelated
Has to do with guaranteed order of initialization. Static fields would always init before instance fields and instances in general(the instance need to be initialized before any methods are called on it).
I think.
can i use this functions of a button like onpointerdown onpointerup etc? if so how i want to check if pointer down than do this.
those methods are for the button to receive from the event system to notify of UI events
if you want to detect when a button is clicked, use that onClick event
hi , i Instantiated my enemy because when i tried to destroy it unity said it was destroying the assets and couldn't do that but now the death script technically works without that issue but the Enemy object scene isn't getting destroyed (switched the gameobject for a var)
thanks, so that means i cant use those onpointer up and down from that button
why are you creating and immediately destroying an enemy
what are you trying to do?
i'm trying to destroy the Enemy via collision , the collision does work but told me i was trying to delete the prefab in assets so now i'm trying to Instatiate the Enemy as apparently from a unity Q&A Page it would fix the issue
i think i see the problem tho now that you mention the creating and detroying part
is the enemy the current gameobject?
yes
and you want the current gameobject to be destroyed?
yes but it seems i need first to instantiate it or it will go for the prefadb asset instead
you already instantiated it
it isn't "going for the prefab asset instead", it tries to delete what you tell it to delete
if you want the current gameobject to be destroyed, then tell it to delete the current gameobject
Destroy(gameObject)
why do you even have that SelfRef? 🤨
You are not destroying a gameobject, you are trying to destroy the prefab assigned which is an actual file on your filesystem
!code show some more code context
📃 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.
@naive pawn do i just send the page link?
sorry first time using posting code
after you've saved yeah, it should show a unique code in the url
you can try opening the link you've copied in incognito/guest mode to see if you've done it correctly
A tool for sharing your source code with the world!
oh mb ,tho that doesn't seem to change anything for the all destroying assets thing
show the full script of the class
wait no, this is coming from a public method?
sounds like you're calling Damage on the prefab instead of on the actual enemy in the scene
yes?
look through the stacktrace, for the line the Damage method. where are you calling it from? check to see if you're referencing the prefab there for whatever reason
i'm using a Instintiated projectile with a collider for the damage
ok, and what's Enemy
(also you should not be checking layers like that - it's not wrong, but it's easy to make subtle and hard-to-debug mistakes)
oh...yeah Enemy uses the Enemy prefab , i see now
instead of damaging the random Enemy, damage the thing you hit
also do you not want the projectile to be destroyed when it hits an enemy?
yeah i should probably destroy the projectile on collision aswell.
tho do you recommend just using the other variable then?
cause i don't tknow how to call the damage function if that's the optimal solution
yes, use TryGetComponent or GetComponent
no need to check the layer - just, if it has the Enemy component, call its Damage method
assuming layer 6 is a wall or something, you could just have the projectile destroyed unconditionally (and just not have it collide with any other layers)
if you do need to check layers, you should use a layermask instead, that way you can set it in the inspector and it's harder to mess up
also of note, the damage there, 2, should be a serialized field, so you can configure it in the inspector easily
@naive pawn just tried it , works now many thanks as for the other suggestion i'll keep them in mind tho first i'll try implement everything i need to first but thanks again
how do I create physics capsulecast the same size as capsule collider
pass the same parameters used for the capsule collider
if you're in 2d, you can also cast the collider directly, but 3d doesn't have an analog of that it seems
I see, thanks
Hey quick question, does unity have events like I make a event that I can call from script A and calls a function of a bunch of scripts without the main script having reference of the listening scripts? Like event game over and all enemies listen to that and die on game over
you are talking about static events / delegates. you can just have a public or static event that you invoke from your mainscript and the subscribes just need to += their methods to it
Ahh nice thx, I'll look into it and try to use it 👌
I use visual studio and I don't know how to set mouse click back to normal, I don't want it to select letters
looks like your keyboard is in replace mode (given that it's a line when you put the cursor at the end of the line)
press the insert key
oh thank you so much, that thing was real annoying
I need help with my dash script that i probably butchered cuz i didn't know the input thingy was updated and i just copied a movement script for basic movement which made this mess with me trying to copy it. Also i found out the problem was player input was missing. i honestly think i need to redo 6 hours of scripting if i don't manage fix this, since it's probably caused by me copying the input manager and not changing it when i made this dash thing
what's the issue here?
Player input doesn't work when i playtest
I honestly don't know what's happening
how doesn't it work? does it give errors, does it do something weird, does it not respond?
you aren't even using _dash or _playerInput in this code, how is it set up
it doesn't respond and like only gives the error when i play it
ok, what's the error
also that AddForce is not correct
it's only this and i don't understand it at all 😭
def butchered it fr
that can only be _playerinput, so the issue is that the object doesn't have a PlayerInput component.
the Dash.cs:24 means it's line 24 of Dash.cs
the first part of the line says it's in Awake
You've accidentally cut off the line numbers
generally you would look at the specific line, but there's only one thing that can be null and is being accessed inside Awake there, so it's that
oh actually... i guess it could also be _playerinput.actions
forgot to consider that, mb
so, do some debugging to see which one that is
I don't understand what that means 😭
do you know what line numbers are
That wasn't a solution to your problem but rather a remark about the image you had shown
this thing?
no, that says what line/char your cursor is on (and what your indent is set to i think? and what your line endings are set to)
I'm more confused now tbh
that was a question, yes or no
You've probably got this script on an object that doesn't have a player input component
Probably no
Oh yeah i just noticed that
in your ide, to the left of your code there's a region called a gutter, and on the other side of the gutter, there are numbers that count up for each line in the file
those are the line numbers
(this is a document/file concept rather than a code concept, but code uses this concept a lot)
Wait the numbers that are usually here?
tbh idek how it vanished
I havent used this for like 3 years now
settings > search "line numbers"
or maybe you could right click the gutter or change that from menu bar > view, idk, i haven't used vs
I found it and brought it back
and also i added the player input component where the dash script was and it just made my movement speed fast without me pressing anything except wasd...
should i rewrite this?
that's what your code said to do
Dang i really need to learn more ig
you should probably step away from code for a bit - figure out what exactly is the flow you want for this behavior, start from an english description, and be as specific as you can without getting into implementation details (it'll make it easier later)
from that description, write out pseudocode
from that pseudocode, implement it into actual code
with experience you can do those first 2 steps in your head - planning the behavior, planning the logic
but since you don't have that yet, writing it out separately can help a lot
i still do that quite a bit when working with stuff i'm not familiar with, or with complicated algorithms (not in games)
I'm kinda forced to learn this in a like... less than a week at best... but i'll try doing that when i can
good planning will save you headaches later
Why the rush?
You learn the best when you take your time
Cuz of my stupidity and writing it in a homework where i didn't read the part "this will be your product and is worth half of your grades"
Ah so last minute deadline for a project?
Makes sense we get about 12 of those a week here
Nah they just really made it so it’s less than a week 😭
But a weeks time is pretty good compared to what some others are starting with here
This was announced yesterday
A lot of people start the day before the deadline and get mad when nobody will finish it for them lol
I honestly thought i could finish atleast a prototype of what i put in that paper in like 3 days but at this point i would be even lucky to fix that dash script in a day 😭
why does unity always opens this when I end the run of the game? it is annoying to edit assets this way
Oh yeah 3 days for a prototype is very ambitious if you just started
Yeah 😔 but atleast i have more time than that tbh, if i didn't I'd probably beg to change what i wrote there for something simpler
If i were you i would grab some direct game course/tutorial that creates some kind of semi completed project
And just grind that out for a day
If passing is the only thing you care about
Thanks for the tip, I'll try to do that tomorrow
Mostly but not really
I've been eyeing game dev for like more than half my life and this was kinda a rare opportunity to force myself to learn it due to my lack of time
I'll probably comeback here soon
Thanks yall
I cant connect the out to the position. why is this
hi is there any chance for inputAction.WasPressedThisFrame() to just not execute properly if say the user lags out really bad or smth?
or like are there any downsides to using it?
i mean i assume it does what it says
what nodes do you have off to the left?
possibly you're using some fragment-only nodes
its connected to a sample textutre 2d
That's only for the fragment stage
As it says in the docs: https://docs.unity3d.com/Packages/com.unity.shadergraph@5.6/manual/Sample-Texture-2D-Node.html
If you want to sample a texture in the vertex stage you need to use https://docs.unity3d.com/Packages/com.unity.shadergraph@5.6/manual/Sample-Texture-2D-LOD-Node.html @chilly anvil
thanks
Would anyone know why when I put the sticks on navigate it just constantly scrolls through the options. like stick drift but I cranked up the deadzones on both and it had no effect
Do you have a controller plugged in?
unplug all controllers and see if it still happens
and use the input debugger
most likely a stray device you forgot about leaning against a cat
ok thanks Ill double check that
Okay yeah that helped I see the problem on thing is I don't see the controller in bluetooth. It says there a controller there even after I disconnected them all..
oh you can jsut remove the device I guess. I bet it was steam..
hey guys so im currently making a skillcheck lk those things from dbd, how do you on start make an object spawn outside the surface of a circle?
heres a visual:
so the object is the entire bar? if so its just a matter of setting some kind of pivot on the bar and spawning it in the middle of the circle, and just rotating it
the problem is that how do i make the rotation based on the circle rather than the bar's own rotation?
you set the bars pivot to the center of the circle, like i said
the dot is the pivot of the bar
now when you rotate the dot the bar rotates around the circle
these two axes are at the same position in their transform, but not exactly the same. I thik it's because they were offset in blender, is there a way I can fix this in editor or will i have to mess around in blender again?
means the root position is off somehow
did you apply transforms in blender before exporting?
i see, so do i make the bar a child to the circle or do i have to code to do it?
no.
you add an empty which is the parent of the bar
the parent acts like the pivot
you didnt since your scale isnt 1,1,1
got it
make it a habit to always apply all transforms before exporting
they are still offset
they are not offset in blender correct?
they are in the same location
no
so they are offset in blender?
can I prom my asset?
prom?
yes but their transforms are zero
yes but their origins are at the world origin....
should i origin to geometry then?
try that after applying the scale yes
I publish my first asset for unity in itch.io . Easy interactions is easy system for creating interactions
thank you
I am trying to rotate the player with the camera did I do it right? when I move my mouse the camera spins really fast. Is it because the tracking target is in the player it rotates the player and it repeats? How can I fix it
Not a code question btw
where would it fit? there's no #blender channel or anything.
!ask, should tell you (iirc) but bormally if you cant find a channel go to #💻┃unity-talk
There's no command called
ask,.
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
the comma probably confused the bot
"anything related to 2D, 3D, Audio asset integration into Unity."
this also seems like a #1390346776804069396 or a #🔀┃art-asset-workflow question
this channel is generally for like, logic issues or compiler errors, or software architecture
also that code seemed very ai generated idk why, maybe the excessively detailed commenting?
hello! am having a hard time getting auto complete into my Microsoft Visual Studio Code 2022 for unity can someone help?
ive installed Everything related to C# and Unity from the Microsoft VS installer
!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
hold on, are you using vs code or visual studio 2022 because those are two separate things
visual studio
If your IDE isn't providing autocomplete suggestions or underlining errors in red, then it needs to be configured.
tysm
with the way they're going they'll probably rename vs code to "Copilot Code" or something stupid like that
Codepilot 😔

that sounds not bad actually
hey i wanted to know how to encrypt asset do that they dont got ripped/extracted
not easy, not recomended
owh why
Because it's a battle you won't win
because it's massive amount of work that ends up being at most a minor inconvenience to someone who wants to rip the assets
and, no offense, but nine times out of ten someone asking about that hasn't actually made anything that would be worth taking
must be some really worthy asset you have here
is there a way to keep these projects loaded? icba to keep loading them everytime
what does that have to do with the previous message
and Visual Studio to Copilot 365 Code
(Formerly 365 Code Copilot)
public enum timeSignature { 4/4, 3/4, 7/8}
is there a way to set my enum variables like this as it doesnt like the '/'
no
sadge
They're variable names, so they need to follow the same variable formats (letter first, $, _, etc)
BUT you can set their display names in inspector:
[InspectorName("4/4")] _44,
[InspectorName("3/4")] _34,
[InspectorName("7/8") _78
}
yeah, you can't even get away with using a verbanim identifier here
e.g. @int lets you use "int" as a name
/ is simply not legal in an identifier
Hello! Can anyone help me please? I am trying to make infinitive world generation with premade tiles. The idea: You start off on the starting tile. Each time when you come closer to the tiles edge, a new tile spawns ahead of you if it's not already there. I have two scripts, "WorldManager" that is attached to the empty gameObject "World"(Parent of generated tiles). Each tile has a script "WorldTile" which contains the main logic and parameters. Here's a problem. i don't know how to explain it correctly, so i created am image. On the left side we can see 3 tiles and two arrows. Green arrow points to the direction where player is going. On the right side we see what happened after the player moved to the edge of the top tile. We can see that 3 additional tiles were spawned instead of 1. If the players moves up to the top tile there will be 2 tiles generated instead of 1 because there are 2 tiles in that row. This is wrong! To simplify this we can imagine our world of tiles as a rectangle with 2 variables(x and y). If the player moves to the x side, there will be generated the amount of tiles that equal to the amount of tiles on the x side. The same thing for the y side. This is wrong. We need to only generate one tile ahead of the player when he moves to the edge.
this thing you're trying to make is a pretty standard "world streaming" setup
Hi, Im new to Unity and to the server, hi to all of you!
I have a question tho, can I update a Cursor sprite in an update function? Its not changing even when I put a debug.log and I see its entering but not changing my cursor.
Heres my example of me changing the cursor:
Cursor.SetCursor(idleCursor, Vector2.zero, CursorMode.Auto);
What does it mean and what's the problem?
Having each tile keep track of which adjacent tiles is not the best way to do it.
The best approach is:
- keep track of which tiles are currently loaded in a HashSet
- periodically (maybe even once a frame), calculate which tiles are within a set distance (e.g. the "draw distance") of the player. For example if you have adraw distance of 1 you draw the tile the player is ON and the 8 tiles surrounding it.
- Once you have calculated which tiles are "in", compare that with your current collection of loaded tiles.
- Any tile which is in the currently loaded set and is "in", should not change
- Any tile which is in the currently loaded set and is NOT "in", should be destroyed/despawned
- Any tile which is NOT in the currently loaded set, and is "in", should be spawned in
Does anyone know?
Yes there is no problem setting the cursor in Update
in your case the possible issues are:
- YOu might have some other code changing the cursor back to something else
- You might have the wrong texture being referenced by
idleCursor
And if im not seeing it change in the play simulation what could be wrong?
For example, the pressed function:
public void SetPressed()
{
Debug.Log("PRESSED");
Cursor.SetCursor(pressedCursor, Vector2.zero, CursorMode.Auto);
}
It does the log. and it doesn't do the idle until I stop pressing. And the textures are these:
I explained the possibilities above
It's not really clear when "SetPressed" is being called though. Sharing your full script would be helpful
Yeah, here it is:
using System;
using UnityEngine;
public class CursorManager : MonoBehaviour
{
public Texture2D idleCursor;
public Texture2D hoverCursor;
public Texture2D pressedCursor;
public static CursorManager Instance;
bool isHoveringUI;
void Awake()
{
Instance = this;
SetIdle();
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
SetPressed();
}
if (Input.GetMouseButtonUp(0))
{
if (isHoveringUI)
{
SetHover();
}
else
{
SetIdle();
}
}
}
public void SetHover()
{
Debug.Log("HOVER");
isHoveringUI = true;
Cursor.SetCursor(hoverCursor, Vector2.zero, CursorMode.Auto);
}
public void SetIdle()
{
Debug.Log("IDLE");
isHoveringUI = false;
Cursor.SetCursor(idleCursor, Vector2.zero, CursorMode.Auto);
}
public void SetPressed()
{
Debug.Log("PRESSED");
Cursor.SetCursor(pressedCursor, Vector2.zero, CursorMode.Auto);
}
}```
!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.
sorry Praetor :)
Are there any tutorials for it? Cuz i haven't found any for my case
so which part exactly is not working?
Is none of it working? Or just one of the cursor textures? Or what
I'm sure there are but the basic principles will be something like what I wrote
The cursor is not changing to the other sprites, but its sending the Log, thats whats wrong
are the textures correctly referenced
show the inspector of the script in the scene
Also make sure you don't have more than one copy of it in the scene
and make sure you don't have any others that also change the cursor
checked, any of that its happening
Its a fresh installed Unity, maybe its not showing bec I have to configure something?
shouldn't be
Because the default cursor (the Idle one) it is showing
are those textures the right ones?
first two look the same
could just be the screenshot
yeah they are, they are very similar, see:
I didnt know how to do the hover on the hand, so I did that little change haha
can you show a screenshot of your console window (uncropped) after doing a full click-hold-release cycle?
And when I click it is showing the logs:
(It is showing them by 2x btw, maybe its that?
yeah that indicates strongly like I was implying befoire - you have a second copy of the script in the scene
probably the second copy only has the idle texture assigned in the inspector for all the fields
hahaha, thanks a lot @wintry quarry and @sour fulcrum it was that...
haha it is always the silly ones...
thanks a looot :)
classic error!
i somehow cant click on "PlayerLockOn". I remember deleting it but its still there now unable to be klicked on. could someone help?
Did you try restarting Unity after deleting it
i found it in the files and proceeded to delete it there, now it works 👍 (wanted to delete it all along)
but something else, is it 'normal' for unity to swallow such enormous amout of RAM? I think with visual studio its combined to 3.900 mb
Depends what you're doing ... I wouldn't say 4GB is a lot for a project and VS
overall that would not be considered a lot
okay all right
Hi all, I've started the Create with Code course for Unity but I think something might be off? The tutorial video has some differences than mine when I open scripts in Visual Studio including where the tutorial tab says "Assembly-CSharp" mine says "Miscellaneous Files" and some are lines are different. Is this an issue?
!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 Visual Studio displays "Miscellaneous Files", it doesn't understand that the file is part of a C# project
Thank you! Found the solution!
Had to update after I added the package, thank you!
one catch-22 is that the package won't start working until Unity can compile your scripts..but it can be hard to fix your errors until the package is working 😉
unity moment
The debug messsages occur but only for one item, and nothing is added to the handbookContainer. No error messages, it just silently fails.
handbookContainer is a Transform, not sure if this is my problem or not
lets presume item is null then. Attach a debugger so you can observe what actually happens when this loop executes.
If there was an exception it would be logged unless you caught them above and choose to do nothing with them.
hold on
i think i figured it out, handbookcontiner is null
forgot to set it in inspector
it's partly working now, now i have to figure out why it only runs once
debugger
how do i do that?
visual studio, vs code and rider all have usable debuggers with unity
learn more: https://docs.unity3d.com/6000.3/Documentation/Manual/managed-code-debugging.html
the basics are attach to the editor in your IDE, add breakpoints, play and wait for them to be hit
Then you can step through code line by line to see what it does (and inspect variables)
What am I doing wrong here?
void OnTriggerEnter(CircleCollider2D other){
if (other.tag == "Player"){
Destroy(GameObject.FindWithTag("Player"));
}
}
// Update is called once per frame
void Update()
{
OnTriggerEnter();
}
}
- Wrong parameter for OnTriggerEnter
- Calling OnTriggerEnter manually in update
- Not even passing a parameter to it when you try
It just gives me an error that says there is no argument given that corresponds to the rquired formal paramter 'other' of 'PlayerObstacle.OnTriggerEnter(CircleCollider2D)'
How would I fix it?
Use the function the way it's supposed to be used:
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Collider.OnTriggerEnter.html
Cool that's exactly what I tried doing but it gave me a different error
So then fix that one
And ask about that error instead of asking about the attempted solution you hacked together to try to fix the initial one
Alright I changed a bit and it's not giving any errors but nothing is happening when the player collides with the object
private void OnTriggerEnter(Collider other){
if (other.tag == "Player"){
Destroy(GameObject.FindWithTag("Player"));
}
}
You don't need to do find. In fact, you shouldn't. It might destroy something else if there are multiple objects with that tag. Instead you can destroy other.gameobject.
Ye that makes sense, thanks for the tip!
The Three Commandments of OnTriggerEnter:
- Thou Shalt have a 3D Collider on each object
- Thou Shalt tick
isTriggeron at least one of them - Thou Shalt have a 3D Rigidbody on at least one of them
I think I miiiight have done something wrong
Did that and enabled the isTrigger tick on both the player and object in the Inspector and now I get this error when they collide
Sorry for the music forgot to turn it off lmao
where do you assign that variable
Might sound stupid but is doing "if (coll.isTrigger)" not assigning it?
no. do you know what assignment means?
Not totally. I'm trying to get back into programming after quitting because of tutorial hell and I didn't realize how much i forgot
you should refresh yourself on the absolute basics, there are beginner c# courses pinned in this channel
also consider reading the full error message
What is coll
Collider2D. It's defined at the top (don't ask, it's just what was on the example and it didn't work when I went without it)
But what is it
What value did you set it to
Unironically enough when you pointed that out, I remembered something the thing suggested when I was throwing it together so I removed that part and changed it to other and now it works.
I am so cooked
you will not get credit when i realse the game
because i will forget your name or username
!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.
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
hey i'm making a 2d platformer game and just started making the prototype and almost finshed the movement script done but i have a bug where my rig or player is sticking to the edge of a box collider 2d here my code using UnityEngine;
using UnityEngine.InputSystem;
you will not get credit when i realse the game
because i will forget your name or username
The heads up is kind but people generally don’t expect credit for helping don’t worry
so i want the arm models of the character to do the same as the floating arms and i want the carmea to also follow the other character how would i do this ?
https://cdn.discordapp.com/attachments/497872424281440267/1458623121320841307/2026-01-08_01-46-00.mp4?ex=69605024&is=695efea4&hm=a79f7f255b61320dcf7daa4ece1cf39a2a2bf314e30cd4efaa962ca95354d369&
You cant. The arms and full body use different animations, and in multiplayer the arms model are disabled(hidden) for other players. Same for you, the body is hidden
ive been working on my vr game foir bit now but still havent rly learned c# or anything jus been doing simple stuff and a couple tutorials that i learned some stuff from but anyone know a good tutoria to help me learn c# i mainly jus wanna learn rn if theres one specific to vr tho that would be great
there are beginner resources pinned in this channel
oh ty
Anyone know if you can invert the y axis on cinemachine free look camera
I thought It would be in input axis controller but I can't find any option to do it
Also does anyone know how to make it so when you're looking in a direction with the camera pressing forward makes you move in that direction
multiply your movement by the direction vectors of your player
Uhhhh idk how to do that
do you understand what i said, to begin with
i don't know how much you know - if you don't understand some specific term, just ask
I don't understand the whole thing tbh, I don't really have any actual knowledge on unity I just follow tutorials and then it goes in one ear and out the other
riiiight change that last part then
don't treat tutorials as something to copy
actually learn from them
they're examples
Yeah Ik I'll do it after this project
if you don't learn then you won't be able to make anything beyond the tutorials
for example, this
Why delay if you can start now?
Because I have a project due tomorrow at 2pm and it is currently 3:30 am
Why do to have a deadline if you "don't really have any actual knowledge on Unity"?
huh?
Idk man I have a terrible memory, I'm very lazy and the people teaching my course didn't even really teach us how to use unity they just gave us tutorials to follow and kinda made us figure it out on our own
so i can not add animations to a other character ?
Can I fill these via code? Or is there some trick? It's tedious to fill this via drag and drop or selecter
You can, if you have some algorithm in mind. Just remember that the pc can't read your mind.
you can also select multiple objects at once to set multiple entries
child of gameObject xy, maybe. Everything with tag, or label? Maybe even just typing the gameObject Names
gotta lock the inspector first
you want to code from the inspector?
maybe in start? on build Time? I don't know. I'm new to this.
lock inspector and drag and drop multiple was already a nice tip
in Reset, probably (if you were to go that path)
but just setting them from the inspector is generally easiest to work with
I imagine this becoming annoying when one creates a real game.
if you reach that level you'll probably already have the necessary knowledge to research and implement it yourself, and/or skills to provide adequate info/context if you ask
yeah.. maybe
while saving info about player's state
I think it is more suitable to use JSON object and saving it for my game
but should i use both JSON and PlayerPrefs to store all the thing s
like use PlayerPrefs to store stuff like volume level/ High score
or should i only keep JSON Serialization since it is going to be there anyway for other things??
ideally player prefs would just be player (as in the application, not the controllable character) preferences
so volume level is a vibe but high score is better suited for custom json
Hi does anyone used UI Toolkit for mobile ?
I'm sure lots of people have. Ask a proper question in #🧰┃ui-toolkit and if someone knows they'll answer
Oh thanks i don't see that UI Toolkit section
General question on organizing code real quick: whenever you're doing longer code, such as with a player, is it better to put different things into different scripts, or to make a longer, single script? Curious as I am doing a talking script where the player sends a raycast to detect things, and didnt know if I should put it in my script with my movement and all that. (Please @ me if you respond, thank you so much!)
Update on this, it was extended BY A MONTH 🙏🙏🙏😭😭😭 I CAN CLUTCH IT FRFR
You got this bro 
What are you working on? Homework?
try to go by the single responsibility principle - each entity should do one coherent task.
that task might be split up into smaller subtasks, so that's where you'd have classes vs methods (for example)
if you have long code because you have a lot of disconnected things all handled in the same script, then you should split them up
if you have long code because this one feature is pretty complex and involves a lot of steps, you should keep it together
(and then notice that it being long is not really a factor at all - just whether it makes sense to be together)
Yes
Why is the button saying it can't convert Object of type, Object to my script even though no object is being called? Is it because the script the button is calling is on the button object?
can you share the script
can you show the stacktrace
A tool for sharing your source code with the world!
Stacktrace?
sorry i meant the one being called (Player Cash)
A tool for sharing your source code with the world!
Ah, here
i think they mean the whole error code usually tells you what line the error occurred (and the calls that lead to it)
Where this is what happens when I pull it up. Right on Line 70
Are you sure it isnt the profiler marker line?
no no i mean the error like example here
NullReferenceException: Object reference not set to an instance of an object
TabHandler.Initialize () (at Assets/Scripts/Menu/Browser/Tab Handler.cs:43)
TabHandler.get_Singleton () (at Assets/Scripts/Menu/Browser/Tab Handler.cs:29)
Menu.BroswerMenu.Close () (at Assets/Scripts/Menu/Browser/Broswer Menu.cs:21)
Menu.BroswerMenu.<Initialize>b__2_0 () (at Assets/Scripts/Menu/Browser/Broswer Menu.cs:13)
UnityEngine.Events.InvokableCall.Invoke () (at <07c12a9d8ce247d18a35c5e3e7bb065f>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <07c12a9d8ce247d18a35c5e3e7bb065f>:0)
UnityEngine.UI.Button.Press () (at ./Library/PackageCache/com.unity.ugui@4ee0fac0c6e4/Runtime/UGUI/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at ./Library/PackageCache/com.unity.ugui@4ee0fac0c6e4/Runtime/UGUI/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at ./Library/PackageCache/com.unity.ugui@4ee0fac0c6e4/Runtime/UGUI/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at ./Library/PackageCache/com.unity.ugui@4ee0fac0c6e4/Runtime/UGUI/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at ./Library/PackageCache/com.unity.ugui@4ee0fac0c6e4/Runtime/UGUI/EventSystem/EventSystem.cs:514)
Where do I found that at?
should all be here
Profiler marker line? I haven't use that unless it something that happens normally
Oh so this part is from unity's internal code. Nevermind the profiler thing
What action/method have you subscribed to the button?
(Although yes try restart first)
If TabHandler is your own script, looks like thats where the error happens
TabHandler.Initialize () (at Assets/Scripts/Menu/Browser/Tab Handler.cs:43)
no no i know about that one lol i made the bug on purpose to give an example of what stacktrace is
I'm confusing myself because of similiar-ish names 😅
That fixed it, it was a Unity problem. How FUN
Sorry, not good at naming these yet
I meant your usernames
https://paste.mod.gg/urnnyptgrkni/0
So I have issue and i'm not sure why this is happening. So when the game is in play, the button won't change colors now. I have scripted that changes it, But it doesn't change. I manually try to change it and it works, i'm confused on why.
A tool for sharing your source code with the world!
What's with the hidden errors?
That's cause the top button script doesn't get the number from the script right now. Trying to get one button working and i'll fix that
Unless that is interfering
Well, I(and probably you) can't tell without seeing these errors. 🤷♂️
In any case adding a debug log before the color change would help see if that code runs at all.
I seen them it's just a object reference for the current.ToString, future.ToString, etc
It does, the video shows the color changing when I hover over it
But the button itself doesn't change
Not to mention everything below runs fine as well. Cause if I rehover my mouse over the button the number do update
To be honest I've never used ColorBlock and I'm not sure if just updating it should update the button rendering state.
How would I update the rendering state of it?
Rather frustrating to see a stack trace with a line number, click on the script linked, and the line number doesn't even exist
Ouch, no line number for you
The MouseTextSelector on the gameobject called PlayerCash doesn't have some components assigned
I know, just getting it to work before I clean up
colors
The ColorBlock for this selectable object.
Declaration
public ColorBlock colors { get; set; }
Property Value
Type Description
ColorBlock
Remarks
Modifications will not be visible if transition is not ColorTint.
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.Selectable.html
It is color tint though...
Add debug that print the new color right before assignment
My guess is that this color is only used during transition. Which already happened by the time the event is called.
I don't get much just this
You probably don't want to touch the buttons colors. Set the graphic component color instead.
Hello everyone,
Little background before my question, I'm working on a system simlar to the Post system described in the Uncharted GDC talk. I'm also working in a Behavior Tree system (specifically BD Pro but not super important).
I'm at the point where I've got functional cover seeking system that I've been working on for a while, along with a task that revalidated the cover to make sure it's still viable. Now I'm working on bringing in animations and tying the system together in more of a wholistic way and I'm curious for some advice.
I need to make a repeating system that will determine when to duck in and out of cover. I'm considering a few variables on what to look for when to actually crouch behind cover (mainly recent damage, need to reload, and a bit of random peek duration) but my main questions are how you would broadly approach this sort of system. Would this be a sequence of tasks contained in the Behavior Tree and all of the functionality is contained within that, or would you rather have a specific script on the actual NPC which communicates with a manager and a select few tasks in the Behavior Tree? Kind of swapping BDPro to simply be an overall brain to the body (if that makes sense).
I'm asking this mostly to see what others would think as I think I'm leaning down the treating the Behavior Tree as just a brain with most core functionality actually being separate
Any advice would be appreciated of course.
Fair enough
I'm a little confused why you expect it to do anything, you change its colors when you're hovering it
it will not be in Normal Color, it will be in Highlighted
I also have no idea why you would be setting that via script only when hovered, instead of just setting the highlighted color in the inspector?
The highlighted color did nothing to the button when I change it
Did you then hover the button after setting it?
idk onPointerOver doesnt even register at all
idk if I'm doing smth wrong but yeah
flower script --> https://paste.mod.gg/jeiccfasoldn/0
A tool for sharing your source code with the world!
the bubbles use pretty much the same logic so I won't repost it
doesn't look like youve configured your ide
I don't see an EventSystem in your scene, which I believe is required for PointerHandler
is this the event system in question?
Yes, looks like you're using the new input system...?
I do not know if that makes a difference to PointerHandlers though, worth checking
and what are you supposed to be pointer entering on? seein the first video without context I have no idea
Also, as an aside..
Don't do this. Find is slow, and if you remove or rename that game object you'll get a null reference on the following line and it's not going to be clear to you why.
var GameObjectEnemyManager = GameObject.Find("Enemy Manager");
EnemyManager = GameObjectEnemyManager.GetComponent<EnemyManager>();
It's best to create exposed fields (which you already have) and then assign directly in the inspector, when you can. If you can't do that, then it's better to just do (when there's only ever going to be one of in a scene)
EnemyManager = FindObjectOfType<EnemyManager>();
Hay ! I try to apply software architecture in my friend project for training
My goal is to make a Player prefab/modules that can be used either if I apply network code with Netcode for gameobject plugin or if I just play offline with a friend
Like this I would make the levels/scene etc way more easily without worries about network structure/code
it's my first try on drawing the Player interface -> (image below)
I asked my teacher and he was more into specilisation of PlayerOffline by making PlayerOnline (PlayerOnline is a child of PlayerOffline) and I think it's a way better to tackle the issue is I don't know if I could fuse that with NetCode lib since PlayerOffline would be a MonoBehavoire and PlayerOnline would be a NetworkBehavoir
You should first consider what is the difference between online and offline? In the end, it is still a player. So what do those off and online things share? You can still move something local from network with wrapper classes for off and online. Other question is, if you really want to rebuild an offline version of an online structure or just make the local player the host to fake offline
What would be the most benefical ? I had the idea of faking offline but would take more ressources for the user(Host) ?
The difference between online and offline is the fact that they have different implementation (NetworkBehavior and MonoBehavior)
so I know that i will have the same methods for basic tasks like movement (running, sprint etc) or 2D Physics
The issue would be in the network version since we need to manage the way game update from both end (host and client) and that would mean using the network framework
my english sucks dang
It's a good exercise, but most multiplayer frameworks already implement an "offline" mode. Big advantage is the simplicity of not really having to think about how singleplayer logic is handled.
!collab @vague hatch
:loudspeaker: Collaborating and Job Posting
We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**
bro aint linkdin
Do you have some tutorial/ressource or example of a project ?
if it's possible to achieve/use a "offline mode" from Unity NetCode for GameObjects
I don't know if it has an explicit offline mode, but you can run in host mode and reject other connections.
Then if I add a "local" player what would happen ?
Host mode generally implies having a local player, unlike server mode.
As Danny said, most beneficial would be the local host mode to keep the logic at one place. Its just that your local pc would be the "server" and accept its own commands, thats it.
Noted I will try to make a new diagram by applying that stuff
So at the end of the day I could just make a interface named IPlayer and one Player class with a final attribute isOnline ?
What members would your Player interface require to be implemented?
All the action of a player like
running, jumping, having a collision that syncronize with the server etc...
Also a ScriptableObject for all the attribute stats of a character
It's what I planned to do
ScriptableStats on the picture is what i planned to use
Hmmm, those would seem more likely to be on something that isn't an interface. Normally you'd want promised behaviors to be on interfaces. But I'm not entirely certain anymore as new C# interfaces allow some level of implementation nowadays.
Hello, Im new here. Was wondering if its an appropriate time to ask for some advice? 
what
just ask right away wtf are u waiting for ? go ahead bud
oh i didnt wanna interrupt you guys lol
u absolutly can
feel free bro
love ya
I assume that C# Interface were the same as Java Interface ?
Just a way to specifies how method signature should be implemented
there's no queue system, just ask.. but use the correct channel. This is a CODE beginner channel, not a general beginner channel
which is cool i could change a new more optimized player script in the futur or fix some bugs without redoing all my project
thank you! anyways Im working on this 2.5d game and was looking for advice on what concepts i should learn to improve this movement script to make it less 'spaghetti' as ive heard that too many if statements can be bad. I've heard of state machines but not sure if it applies to this sort of stuff.
mainly asking because i got frustrated trying to get the attackstage to work properly
not sure if this happens to be more of a beginner question than a code one!
(ill just remove it if so)
A tool for sharing your source code with the world!
Interfaces in C# were designed to hold definitions whereas Java allows you to hold data as well. You cannot have variables in C# interfaces. Only definitions (methods and properties) to be implemented by whatever implements the interface. There is default implementation with an interface now.. so it's becoming more ambiguous but overall I mainly use interfaces to promise (a sort of contract for) certain behaviors. For examplecs IShape Area Perimeter``````cs Triangle : IShape float b; float h; Area => b x h / 2; Perimeter => {...};``````cs List<IShape> shapes = new ... shapes.Add(new Triangle(p1, p2, p3)); shapes.Add(new Circle(c, r)); shapes.Add(new Square(c, b, h)); shapes.Add(new NGon(...));``````cs foreach(var shape in shapes) print(shape.Area);//print the area of each shape (how they're implemented and the members that they hold are unimportant)
I def. have seen worse code and way more hierarchies of if statements 😉 From your structure, it also does not really look like much spaghetti yet. You got your inputs, your coroutines tied to them and you got your update methods handling the states coming from those OnXXX methods. I am just wondering about your queuedInput system. Why would you want your attack to attack again after the first one? Is it a core mechanic of your game or do you just thought, it is a good idea to keep the incoming inputs and fire them after the current input?
And you said, you got frustrated. can you explain why? We do not know, what your desired visual outcome is, so would be good to have some details 🙂
Ah basically I wanted to have it play an "attack 1" that goes into an "attack 2" if the button is pressed again within a certain window, but it ends up being just attack 1 over and over again. Im not quite sure if its because of how i structured my animator or if its a problem within the attack routine
Perhaps its because of the thing you mentioned about my queued input system aswell
Heres my animator for reference
I dont see any code thats calling something on the animator in your blazebin file. Or I am just blind
Oh thats because its on a separate script, i can send them aswell rq
A tool for sharing your source code with the world!
Ah, got it. And if you select your palyer while attacking, what is happening? Is it going back to default? And whats the setting of the arrow between attack 1 and 2?
Hello everyone, For the first time I have a service that wants to use another service. I can avoid this by having duplicate code in my code base. Does anyone have any thoughts on keeping a strict separation of services?
What is a "service" in your case? Its hard to tell without any code, where you are struggling? What prevents service1 using service2?
i notice that the isattacking state ends too quickly so it doesnt end up playing attack 2
also the arrow between is the attackStage integer set to 2
@midnight plover : I'm working within a service locator design pattern. In this specific case I have a level manager that, if I let have access to my save game manager, could save me duplicate code in my code base
Id rather use a trigger from attack 1 to 2. so as long as its attacking, you could go into an endless amount of clips with everytime you fire the trigger. Or you could use a blendtree using your attackStage to lerp between the clips
ah got you. And do you have any doubts about giving the level manager access to the save manager?
I'm just new at all this and want to avoid consquences that I am unaware of later in my project
never tried trigger before, ill def try it out! thanks!
can someone help me with level load script
Ah okay. Yeh, I have not touched the service locator pattern in that strict way myself, so lets wait for someone with more experience in that topic.
i have set the object to E for enteract key, but i go to it and press E. Nothing happens.
i have set another option moving into the object and it work and teleports me to starting point.
what am i doing wrong
How should we know, whats wrong without any code?
should i post my code here
What is supposed to make something happen when you press E?
its suppose to send back to the starting point in map, it only work if walk into it, not by pressing E to interact
So, again, what is supposed to be making it happen when you press E? Start by looking there.
My teacher didn't teach us that we could hold data in Java. That's new for me and perhaps bad since like you said we use interfaces to promise some sort of contract
java interfaces can't have variables. they have have constants, as can c# interfaces
you cannot hold data in interfaces in java, as it should be - that wouldn't make sense as you say
Since u're here
How should I structure a 2d online platfromer of 2 players which i can play offline or online ?
I got interested on software architecture since I got enrolled into a CS degree (especilly my Java Teacher there's a world I don't know about making up good code)
This is what i began to draw Monday a UML graph (not finished)
Since u're here
don't target random people for specific questions, just ask the room.
what room ? #1390346492019212368 ?
i mean, ask to the channel as a whole, not one person
that's the point of a community server
you want to support local multiplayer and online multiplayer?
Yup and I don't want me or my teammate to write netcode stuff later on making levels for example
wellll that's not gonna work