#archived-code-general
1 messages Β· Page 347 of 1
Is the debug.log in there ever triggered?
also where is your console window and why is it hidden
show inspector for goal n ball
Forgive me friends, I wanted this to be how to make pong in 5 minutes, but it would have been a little too crunched. I think some areas, like the UI score got condensed more than I would have liked, but overall, I think it illustrates the point of how you can make pong really quickly!
Pong is a must make for beginner game developers, regardless...
the tut
basically i started yesterday just learning of other tuts on different subjects
pong in 6 minutes.. lord..
and thought you exactly nothing
not a fan of BMo videos.
you still haven't sent what I asked #archived-code-general message
lmao first video i saw def took longer than 6
so uhm idk how to open inspecter. 
Oh
I'm dumb
Ball
Goal
the insectors of the objects mate not the scripts..
Do not take pictures of your screen
I just started ok ππΌ
maybe you should start with the essentials pathways
it wil teach you how to navigate the editor
capitalize the goal in public class goal
lets not worry about that rn
doesnt that ruin the script?
isnt it case sensitive
no
oh nvm then
Would a screen record be good?
tecchnially they need to match but afaik newer unity versions don't mind
Unnecessary, and honestly harder to deal with
I'll js screenshot
filename must have the same capitalization as the script name, atleast it was like that some time ago, otherwise unity didnt find the class
There's two goals
these
so what happened is until i added the code for it to return it was fine
is this what you mean?
i cant make them protected because then i get an error when i try to call them in CombatManager
Does your goal class trigger any logs into the console when it should score a goal?
Debug.Log("player1scored...");
like that
ill check
unrelated but you should organize your project more, its a hell of a mess right now and thats a bad practice
- also your scripts
better to get used to it from now so it can stick with you later down the line
got it
tag ball is not defined
heres the ball code
public class goal : MonoBehaviour
{
public bool isplayer1goal;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("ball"))
{
if (isplayer1goal)
{
Debug.Log("player1scored...");
GameObject.Find("gamemanager").GetComponent<gamemanager>().player1scored();
}
else
{
Debug.Log("player2scored...");
GameObject.Find("gamemanager").GetComponent<gamemanager>().player2scored();
}
}
}
}
ur missing tag
can you show the full inspector of the ball cause its cut off
why the hell are you spamming this shit
can you use the link like it was told to you multiple times
u said
ok ok calm
wdym? I said show the inspector not send the scripts
what does it mean 
- the
balltag is missing
- it is not assigned to the ball
do you know what tags are ?
. I SWEAR I SET THE TAG
you never even created it in the first place according to the error
must be bug i tagged it now
still showing same thin
thing
how do i assign it???
or define wtv
at the top the dropdown where it says "Tag"
yep did that set it to ball
in the screenshot it is still untagged
have you set it on the prefab or the object in the scene?
Show a screenshot showing that you set it before hitting play
also stop play mode, then set tag, then start playmode
oh.
Ah yes. Changes in playmode are not kept
that looks better, does it completely work now?
i suggest you go through !learn courses
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
instead of some crappy 7 minute copy a whole game video
sure it works but its not teaching you anything , just copy n paste
nope still dont appear back in middle after score.
thats why i loved https://www.youtube.com/@mixandjam just shows an outline of what he did and some examples for the more complicated things
your player1(2)scored functions in the game manager dont call the resetposition
how do i fix that
well... call the resetposition inside the player1scored and player2scored functions
just got back, will do
so like in code?
how would it be done in code 
copy this and show me and make a link.
btw im pretty sure this convo belongs in #π»βcode-beginner
but that channel seems too active anyways
so nevermind
ik thats why im doing it here sorry
nw
its fine if its active, this indeed belongs in code beginner
i just need a solution man i been stuck forever
That's why I have mentioend that protected methods can only be accessed within the class and its derived classes
yes im aware so thats why i removed them
and also i got an error when i made the class abstract so im trying to find out why
abstract allows function bodies right?
No, it doesn't
That's what the error should tell you
wait what? doesnt abstract allow it and but interface doesnt?
or do i have them mixed up
Yes, it does
im confused now.. im just going to google it
It doesn't allow directly using the abstract class, but it DOES allow default implementation.
Sashok maybe confused it with the current .net level of interfaces?
i am sorry, this is not how this works, you should try to solve it based on what we are telling you, no pre-prepared full solutions here
ohhhhh i see..
okay thanks
Do I need to put a sphere collider on sheep or dog(player)?
Well, when you create an abstract method within the abstract class, you cannot have a body for it. You must create a body when implementing the method in derived classes
public abstract class Foo
{
protected abstract void MyMethod();
}
public class Bar : Foo
{
protected abstract void MyMethod()
{
// the logic goes here
}
}
The object that scans should have the sphere collider which represents the scan area, the other should have any collider that can interact with the sphere collider
You know, I think yeah I am just wrong. I could have sworn you could
Apologies
It happens with everyone 
Ah, you can make a non-abstract method inside an abstract class which allows a body.
That's what I was misremembering
abstract class Animal
{
public abstract void animalSound();
public void sleep()
{
Console.WriteLine("Zzz");
}
}
Yep, you just cannot create an abstract method inside of the non-abstract class, as it doesn't make sense to access a method without a body
ohhhhh.......
thank you for clearing that up
abstract class is very similiar to interface
except it deals with inheritance instead
If I set script execution order of base class, do children inherit that if they dont specify any priority override for script execution order?
why not just 
iirc they don't
if you're messing with execution order though you might have a design problem
I believe they do if you use the DefaultExecutionOrder attribute though
Do I have to set sphere collider tigger?
When using JsonUtility, how can i override the instance ID value with another one?
I have a scriptable object which holds a persistant ID, to the texture in question, how can I change it?
Thus far the best solution I have come up with is to manually subtring/replace the string, any other ideas?
Don't use JsonUtility to serialize UnityEngine.Objects
and/or use a different serialization framework
Open to suggestions, Newston wasnt working
Newtonsoft works fine
it has its own rules you need to follow of course. It's very flexible/configurable
i tried messing with it, couldnt get it too work
hey my button clicks aren't working, does anybody have any idea why?
`public void warrior()
{
Buttons.SetActive(false);
Warrior.SetActive(true);
}
public void mage()
{
Buttons.SetActive(false);
Mage.SetActive(true);
}
public void archer()
{
Buttons.SetActive(false);
Archer.SetActive(true);
}
public void druid()
{
Buttons.SetActive(false);
Druid.SetActive(true);
}`
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
also start with checking if you have Event System
if thats there, debug it by inspecting it during Playmode and uncollapsing its window at bottom of inspector
if you have the new input system it will only register on clicks unfortunately
yeah and its saying the button is being pressed
puts logs inside the functions and see if they print
alright
Debug.Log($"Hello from {name}" , this);
i'll try that now
thats working
let me try something hold on
nvm i know what the problem is thanks guys
Hey, I'm trying to set up a dialogue system that takes individual lines from a text document and displays only one line at a time in a dialogue box, I have the following code: https://hatebin.com/rmhzylkajs but i have no idea how to add only individual lines from the text file to the queue, ive been researching this for hours but can't find a solution, any ideas?
There are many ways, but basically split the string up based on the newline character
I see, so I can use a special code at the start or end of a new line to mark a new line?
btw this is a nightmare
StreamReader("Assets/Dialogue/" + characterName + "/" + dialogueFileName + ".txt");
use TextAsset type
Also since you're not doing any kind of streaming stuff you can just use File.ReadAllText no need for streamreader etc
Oh yah that too
Okay, Ill look a bit into that
thanks
How would I go about making unity recognise a new line by a special character in the text document?
No need for a special code in the text, no
no?
Just use the existing newline character
New lines are marked by a special character already that's how the computer knows there's a new line
does unity automatically recognise \n?
It's just data
Oh, I see, so theres no need to force unity to recognise a new line, as it already will
Unity has nothing to do with it
Also
This exists
whats on line 70 on combatmanager
enemy.CurrentHealth = enemy.MaxHealth; i think the issue is that i have a scriptable object but i didnt set it to a gameobject in the hierarchy
so the values are null
but why wont these values show up in the inspector?https://hatebin.com/jrjqhftqgv
theyre part of an abstract scriptable object class
enemy is null yes
yeah thats probably why
If enemy's reference is not set, then you can't access .CurrentHealth or .MaxHealth, hence the NullReferenceException.
its not even a probability its fact
i fixed the null reference exception but now i have another issue:
why wont these values show up in the inspector?https://hatebin.com/jrjqhftqgv
theyre part of an abstract scriptable object class
because they're properties
ohhhh i remember [SerializeField] doesnt work on properties
i have to use [Serializable]?
you can use
[field:SerializeField] with autoproperty iirc
ok thanks
I normally just serializeField the private field
not common i touch properties with inspector at all though
[Serializable] is used before class/struct definitions to let your compiler know it should be serializable and lets you use [SerializeField] for fields of that class/struct. It's not an issue in your case, but this knowledge might be handy in the future.
void Update()
{
switch (state)
{
case States.Initialization:
Debug.Log("Battle state: Initialization");
break;
case States.PlayerWait:
Debug.Log("Battle state: PlayerWait");
break;
case States.PlayerAttack:
Debug.Log("Battle state: PlayerAttack");
break;
case States.PlayerItem:
Debug.Log("Battle state: PlayerItem");
break;
case States.PlayerTalk:
Debug.Log("Battle state: PlayerTalk");
break;
case States.EnemyAttack:
Debug.Log("Battle state: EnemyAttack");
break;
case States.BattleWin:
Debug.Log("Battle state: BattleWin");
break;
case States.BattleLose:
Debug.Log("Battle state: BattleLose");
break;
case States.BattleDraw:
Debug.Log("Battle state: BattleDraw");
break;
default:
Debug.LogError("Battle state: NULL");
break;
}
}
how can i make this debug only ONCE then debug again ONLY if the state was changed again
ohhhh i see
what does [Serializable] even do tho
how do classes and structs get.. serialized?
My guess is that it recursively serializes all serializable fields. You can open your game assets in some notepad to see how the scripts look after serialization.
i see
interesting..
a scene essentially is just a serialized(making things neat) yaml file
like most assets
does anyone understand abit about prefabs?
its just lets whatever is assigned to it show up in unity editor without being accessible by other scripts unlike using a public method
i had a prefab object that i accidentally modified outside of the prefab and everytime i change that value in prefab it wont get applied or updated in the modified object, how i can i reset it to the prefab
Revert that object changes in the inspector, you can right click it
this isn't a code question
dang that was an easy fix XD
thx alot man
my bad i thought the fix would be through coding
np
Someone save me from Coroutines π’
I am probably using them wrong, but at the same time it does exactly what I want it to do.
Pseudo code for a turn based auto combat(player does no interact during combat)
void StartCombat()
{
isBattleStarted = true;
isTurnReady = true;
}
void Update()
{
if (isBattleStarted && isTurnReady)
{
StartCoroutine(DoBattle());
}
}
private IEnumerator DoBattle()
{
isTurnReady = false; // prevents Update from calling another coroutine
yield return StartCoroutine(DoTurn());
CheckIfBattleIsOver(); //this sets isBattleStarted = false to stop Update from calling another coroutine
}
private IEnumerator DoTurn()
{
// some logic, might have yield break; to exit early
yield return StartCoroutine(attackerSlot.DoAttack(defenderSlot));
isTurnReady = true; //Enable update method from starting next turn
}
This makes both sides of 1 to 5 characters attack each other with the logic I wrote and it seems to work fine.
But I feel like I have to have IEnumerators everywhere in order to execute code in specific order.
I cant see how I could remove DoBattle IEnumerator, as I need to wait for turn to end before I can execute CheckIfBattleIsOver since logic is delayed inside coroutine.
attackerSlot.DoAttack is also an IEnumerator which has the delay for animation to finish etc.
Just to add to the above as I am working on it:
public IEnumerator DoAttack(CombatSlot target)
{
MoveTowardsTarget(target);
yield return new WaitForSeconds(0.5f);
target.OnAttacked();
yield return new WaitForSeconds(0.2f);
target.ResetColor();
MoveTowardsStartPosition();
yield return new WaitForSeconds(0.5f);
}
The flow is:
Update -> DoBattle -> DoTurn -> DoAttack
All 3 of these are coroutines calling next one and waiting for it to be finished before the previous one can continue.
honestly i find it very unclear what you're actually asking. i dont even really see a question. if you want to go with a coroutine setup, then why do you want this removed?
I just started using Coroutines, but yesterday someone said that I might be using them wrong(based on how I explained it at that time)
My question is: Is the above code a good use of Coroutines for what I am trying to achieve(turn based auto combat with no player input(yet))
Or should I avoid nesting coroutines like that.
if you feel its suits your use case then its fine. you can do the same things in update that u can do with a coroutines, but overall coroutines will be less performant.
and as you're somewhat experiencing here, everything will need to be a coroutine or you'll have to use like WaitUntil
oh WaitUntil seems interesting I could actually use it if I do it right.
I can waitUntil next turn is ready for example.
Would it be faster to have a list of strings and do a bunch of string comparisons (~20 comparisons) or have a Dictionary<string, int>, find the int via a string and then do int comparisons?
What are you comparing? Length of a string?
anywhere from 5 characters to 100 characters in length
this is incredibly vague, what are you actually comparing?
you can just use the profiler to find out whats better
Dictionary iirc is always faster (for larger collection )
Use a dictionary. Make life easier . . .
π€·ββοΈ it does matter what the actual comparison they're doing is. Like if this is just comparing the length of the string then theres no point in storing the lengths in a dictionary
It is comparing the strings themselves to find if there are matching strings between 2 different lists. so anywhere from 10-100 strings per list. Each string can be anywhere from 5-100 characters in length. Each string will be unique so it could be assigned a number in a dictionary...
Why use strings?
The user defines the strings/text.
So user input as text? What is the int for?
Well I was trying to debate if it would be faster to look up the int via a Dictionary<string, int> (because the strings are unique) and use the int in the comparisons vs just comparing string to string in the lists.
What is the int for?
Your response did not seem to answer that (or the other question honetly)
Yes user input is text. The int would be for an int to int comparison. It would be a unique number specific to that string.
So an ID?
yes
You are assigning IDs to random user input, and checking if they have input the same thing before?
Whats the int gonna do? if this is just a list of numbers, you'll still need to go through it anyways to find a matching one. you should really just use the profiler here and see that this will likely be instant anyways unless this is done like 1000 times per frame
if you can sort the strings, or use some other collection that'll make the comparison faster
Yeah you're probably right that it doesnt matter. I am just over complicating it.
Does anyone have an example of a centralized input manager for their player? The main advantage would be managing states and activating/deactivating the player from one place.
I understand how to use events to represent actions such as mouse click but movement scripts, for example, care about the inputs every frame. I don't think it's correct to use events if they're meant to be invoked every frame so how would you notify the observers?
Is there a "correct" way of making a rigidbody object face a certain direction constantly?
As in Quaternion.Lookrotation equivalent for rigidbody
Because I was told to not mess with transform once you have a rigidbody
Quaternion.LookrRotation has nothing to with transform or rigidbody, this is just a quaternion. For rb directly you can use torque, or MoveRotation
Sounds like a question for #π±οΈβinput-system, though you should specify if you are using the "new" input system or the default Input class, with the "new" one, you can subscribe/unsubscribe to the events of your actions once, they only fire when Unity detects the input values changed, so it would not be done every frame unless your polling the input yourself
any idea why this gpu instancing implementation aint working?
matrices = new Matrix4x4[size];
renderParams.material.enableInstancing = true;
material.enableInstancing = true;
for (int i = 0; i < size; ++i)
matrices[i] = Matrix4x4.Translate(new Vector3(-4.5f + i, 0.0f, 5.0f));
Graphics.RenderMeshInstanced(renderParams, mesh, 0, matrices);```
I am developing a mobile app in Unity and need a script to save the appβs state when it closes, then restore it to that state when it reopens. Thire is oonly one scene.
How can I achive this?
If your state is a separate class you can serialize it and save as a JSON into persistent memory or PlayerPrefs. And on load just read this data and import the state.
Iβm quite new to this, so thank you for your help. How can I save prefabs that spawn later, especially when I donβt know they exist from the beginning?
You need to keep track of them yourself, save all relevant information manually and instantiate them back on load
hey guys, have an issue with iappurchases, i filled iapcatalog but when i check catalog items they dont have payouts which ive set, anyone faced that?
I have this PrefabRegistry with all the objects that can spawn inside the app is this correct to do?
And then I have some other objects but they stay the same so dont know if I have to save them?
hard to say, it depends on your goal
If they are always the same and their state doesn't change you don't need to save them
When a user presses a button one of theses spawns in a scrollveiw inside of the canvas and then I want them to be thire again when the user opens that app again.
Dosent Unity have a save scene or something like that that just saves everthing in the scene?
I don't know how your app works but I can assume that you can have each object serialize it's state, then get all of the states in one list and save it. On load you'll just read this list and create an object based on the state that was saved. Your checkbox would probably have only one bool in the state and on load you will need to Instantiate it and set IsOn accordingly.
No
It helps to think about it one by one. If you only have checkboxes with custom names in the app you can have a save file that looks like this:
[
{
"name": "checkboxA",
"isOn": true
},
...
{
"name": "checkboxN",
"isOn": false
}
]
Thank you. This is what it looks like when it is opened the first time. Then when the user press the Add button a gameobjet (MainTaskAndSubTasks(Clone)) Spawns and inside of that one thire is a button called Done that then spawns (MainTaskHolder(Clone)) Inside of the MainTasksScrollview content.
Dont know if that makes senes.
@waxen socket
Hello, I have an error using ServerAuthenticationService.Instance.SignInWithServiceAccountAsync() I have a bad request error and I tried to resolve it for 2 days but I am really stuck, can anyone help me ?
it usually helps to share the actual error, but that sounds like it's an issue with the account you are attempting to sign in with and not a code issue
@somber nacelle Here is the error
And my code: ``` await UnityServices.InitializeAsync();
try{
await ServerAuthenticationService.Instance.SignInWithServiceAccountAsync(
" id",
"secret key");
}catch(ServerAuthenticationException ex){
Debug.Log(ex.GetBaseException());
Debug.Log(ex.Message);
Debug.Log(ex.Data);
Debug.Log(ex.Source);
Debug.Log(ex.ErrorCode);
} ```
why are you passing the literals Id and secret_key rather than values from variables?
@knotty sun I changed them to send them to you, in my code they are correctly copied
How do I retrieve the old version in my unity project?
Like how do I access a project version that I worked on 15 mins ago?
do you have some sort of version control set up?
Nope.
well then i think you have your answer
How do I set it up?
!vc
Unity Version Control
Git
Get the latest .gitignore file from here. It should be placed at the root of your Unity project directory.
@somber nacelle so do you know how to help me ?
don't ping people into your questions. #πβcode-of-conduct
ah wait, that's about that error i told you was regarding the UGS service (or whatever that sign in service you are using is) and not the actual code
I am using the Service Account from unity
okay so then you need to check its documentation and maybe ask for help in #archived-unity-gaming-services (if the documentation is not sufficient) because it is not an issue with your code, but rather an issue with the request
Ok thx
what's the go to way of triggering visual effects (hit splash, sword slash, particles, etc)? especially when there will be a lot of them. I've tried using vfx graph but sending events is super finniky or maybe I just don't understand it?
Sending events to the graph is the way for VFX graph
If you're using a ParticleSystem you'd use Emit()
I know but it doesn't work well
or I assume I'm doing it wrong
You're doing it wrong, presumably
!collab π
We do not accept job or collab posts on discord.
Please use the forums:
β’ Commercial Job Seeking
β’ Commercial Job Offering
β’ Non Commercial Collaboration
how easy or hard is it to protect variables from being changed with cheat engine by non-hackers that just read a simple cheat engine tutorial?
it is impossible to protect variables. Period
I'm not asking for 100% security, I'm asking how to hide a variable from complete noobs who watched one cheat engine tutorial
How long is a piece of string? What tutorial, what cheat engine?
You can obfuscate or encode it so that they don't know what the string means, but nothing more beyond that
Even that is pointless, it is so easy to monitior the memory of a game and when the score, for example, changes to see which memory address is affected
I mean, yeah, but that would take actual effort
but is it easy for someone who watched one or two Cheat Engine tutorials?
I want to prevent the most basic and easy ways of cheating, not all cheating
I want to ask a question. If it's not an online game, why does it matter if people cheat?
think about your question. There is no way to quantify it
I was thinking to just add a random number to it for example
my health is 500
I generate a random number between 1000 & 100000 that I add to the health and then add that to health and save it?
yes, absolutely. there are tutorials for cheat engine that teach how to do exactly that.
But I don't know if CE detects that
That seems needlessly complicated
it's going to be nearly impossible for you to prevent cheating with cheat engine if everything is done on the client
As you have already been told, multiple times, if it matters assume that all data on the client is corrupt
What about this asset?
https://assetstore.unity.com/packages/tools/utilities/anti-cheat-toolkit-2024-202695
π Obscured Types βΆ tutorial
Keeps your sensitive variables away from all memory scanners and searchers.
All basic and few Unity-specific types are covered.
Detects cheating attempts.
I mean, yeah, based on what I've just seen it could work
any idea on how to make a cutscene with dialogue like in undertale? i already have a dialogue system but now i want the player to be frozen and i want to control the person whos talking but i cant find an efficent way to do it without sphagetti code
A complete and utter load of bollocks
mate you're not trying to help me, you're trying to prove your point, which is mute because I know and agree
I don't want to prevent cheating
I want to prevent people with absolutely 0 knowledge who watched 1 or 2 CE tutorials from cheating
but this is what I'm trying to tell you, how can you or I know what someone can or cannot do
I got this snapshot from the profiler because i'm trying to find out why there's a framedrop to 15fps. The jobs are mainly staying idle and the main thread is not showing anything else then EditorLoop so i'm not quite sure what it's stuck or waiting on. I"m new to using this profiler so if anyone could point me in the right direction to find the cause it would be greatly appreciated
@golden wave You are throwing statements around like 'who watched 1 or 2 CE tutorials from cheating' which have absolutely no quantifiable answer
stop typing if u don't wanna help pls
https://www.youtube.com/watch?v=rBe8Atevd-4
Here, watch the first minute of that video, that is what I want to prevent
is your game online or something?
yes
what you shown probably just works on singleplayer, multiplayer you wouldn't store anything on client
all games store tons of things on the client, that's why so many games have cheaters
the player health is a good example again, I don't want my server to need to check the health after every attack - it would probably be better if I did, but that's not an option
You are going to get the same answer, client side anti cheat is futile, put your sensitive stuffs (data, logic, etc) on the server.
so by that logic you cannot do anything about it π€·ββοΈ
why do you all insist to not answer my question but instead give advice that I am fully aware of already?
"tons of things on the client" is false
take a look at games like Path of Exile/ Diablo. They do not store playerdata on the client thats why you are connected to their servers
but I'm not capable of writing a server like that and I do not wish to learn it at this time, so that is not an option
so it doesn't matter
we call this "wanting the cake and eat it too"
so you want some magical solution to prevent client side cheating by without using any server verifcation methods.. Got it
well goodluck with that lol unrealistic expectation
no, I'm just asking a very simple question here, that would probably prevent 90%+ of hacking attempts in my game
but instead I'm being told to go spend the next 3 months to learn how to build and adminster servers
again that is not what I am asking
the exploit video you shown shows a single player cheat π€·ββοΈ
yes, I know, that is what I'm asking
if its singleplayer who cares about cheating, if its online deal with using servers to your advantage π€·ββοΈ
I've also explained to you why "preventing 90% of wannabe hackers from cheating in your game" is not enough, when you said your game has an in game economy. It matters that just one single cheater can ruin your game economy so preventing 90% or 0% doesn't matter, your economy is going to get ruined either way.
yike so you want ingame economy but don't wanna as you say "build and admin " servers, makes sense.
I agree with you. There's nothing wrong with making the trivial attacks a bit harder.
and that is all I'm asking
no one saying there is something wrong with trying to do that though
but I asked how to do it and didn't get single helpful reply
I even suggested a method I could think of
I am π
all was said was getting your priority in order
because there is no "on click solution" to this complex issue
it all comes down to how you are going to manage the data..
my priority is getting my game released, there is no time or budget for a server
so I'd rather have a game with lots of cheaters and a shit economy than no game at all
why not have something good by putting the minimum required time to do so ?
well I gave an example, my player health will be stored on the client
how do I hide it from the most basic CE searches?
because there is no time
alright
For one, your "adding a random value" idea doesn't work.
why do I have to explain my entire project and life story to get an answer to a simple question lol
thank you, why not?
cause its not a "simple question" lol
Assets like you linked should work to prevent basic Cheat Engine cheating, but you should also be wary of using an off-the-shelf solution, because all of this is security by obfuscation. An obfuscation method becomes less effective the more popular it becomes. Cheaters only need to solve it once and then apply it to all games that use it.
you're asking wat took very experienced engineers years to perfect...and even then still not good enough
its not a "simple question"
yeah I'm aware, so the asset does work?
I haven't used the asset you linked, but there are proven methods that make using Cheat Engine more difficult.
I'm asking how to stop someone who watched a 1 minute YT video from hacking my game, you may assume my game is single player if you like
CE can search not just absolute values, but also relative values. So your solution will prevent people from "seeing 500 health, search 500 health" but it will not stop people from "my health decreased, search all decreased values in memory, my health increased, narrow the search results to ones that just increased, repeat until I find the health."
That approach is extremely basic too, anyone that uses CE beyond a toy example will know it.
so is there a simple method that would work? like encrypting the value? probably won't work too?
Nope
If there was a simple solution, Valve and all these giant gaming companies with practically infinite money would've solved cheating years ago, don't you think?
I'd actually like to install CE and test it out on my game a bit, but I'm afraid I'll get banned from other games I have on my PC lol
Why did you jump to the idea of solving cheating? We're just talking about making it less trivial.
AGAIN I'm not asking to solve cheating
I'm asking how to stop someone who watched a 1 minute tutorial on Cheat Engine
Sure, let me rephrase it: any anti cheat solution gives you exactly the amount of protection you paid for it. A free protection offers you zero protection because someone already cracked it because so many people use it for free, a $20 solution is probably already cracked (if not, will be cracked in the near future) because a lot of games can afford a $20 solution.
yes I know, that is not what I'm asking
But "cracked" could mean a really specific, obscure program is necessary, or a special plugin for CE. That alone could deter some percentage of cheaters.
Here's another suggestion:
Every time my Health variable is updated I generate a random number between -10000 and 10000 and add that to my health, so it could go up or down.
No, that doesn't work either.
Security by obfuscation is very effective for small games, and basically useless for popular games. You need someone that knows what they're doing to sit down and figure out how to bypass your protections. The smaller the game, the less likely there will be someone who does that, and vice versa.
People can still find your health value by "scan the memory, move around but don't change your health, narrow the result to values that haven't changed" or "scan the memory, change your health, narrow the result to values that have changed" combine the two and repeat multiple times to find out where your health variable lives in the memory.
that already sounds a lot harder than what was shown in the 1st minute of that video
I would agree except the common things you can come up with, CE tutorials past chapter one pretty much already shows you.
probably still not enough though
but I'm ok with that, I doubt most wannabe hackers get to chapter 2
I feel like if you keep coming up with potential solutions, this chat will turn into me teaching people how to cheat in games π€£
I guess I'll just go buy the anti cheat asset π
my fireball does not go to the left instead it goes to the left and falls as if there was gravity but the fireball has no rigidbody or anything that gives it gravity
since override completely overrides the function, is there a way to just add functionality to it instead of overriding everything?
Call the base method in your overridden method.
in the function that overrides the base one, use base.FunctionName() and then add your modifications
thanks!
thank you
How do I ensure that all scenes are loaded in Unity? Currently when I start a play session 2 scenes are loaded; A preload scene that lives in the game always with a couple of elements for all other scenes and then the actual scene I play in.
However I have 2 other playable scenes that are not registered anywhere other than in the buildSettingsCount. That's it. So if the build indices are 0, 1, 2, 3 I can only access 0 and 1. How do I get Unity to load 2 and 3? According to the SceneManager those scenes don't exist.
screenshot your build settings
well done, obscured the name when I was going to tell you to load by name
I mean, I can still use the names just because you can't see them
how have you confirmed that the SceneManager thinks those scenes do not exist
sceneCountInBuildSettings 4
so it sees that the scenes exist
But when I use the count and GetAt methods it says that the index is invalid
did you actually look at what those are?
Yep. I can check again.
You should read the documentation for them
and this does not work?
newSceneIndex 2 is correct
activeSceneIndex 1 is correct
sceneName comes back null because 2 is invalid index
and again, have you read the documentation for that method?
GetSceneByBuildIndex, you know, the one that is returning null
Yeah it says I can't return a valid scene if the scene isn't added to the buildingsettings and is already loaded.
I specifically asked up top
How do I ensure they are loaded
before we go any further, is there even a reason you need to get the scene name? you can load by index. but also you have to actually have the scene loaded for that method to work
I feel like we are having two separate conversations.
How do I load
How do I ensure the scene is loaded
for what purpose
I need to switch scenes.
and have you just been completely ignoring the part where we've been telling you to load by the index? you don't need to use that GetSceneAtBuildIndex method at all
you do not need to get the scene name to load it. if you already have the index
hi guys! Need a tip.
Some of the item i can pick up in the game go into the inventory and stay there for a fixed amount of time giving you every second X amount of resources, then it disappear. Since you can get more of these item in the inventory i have a variable that checks how many "ticks" i get each seconds. So lets say one item gives you 1 resource per second, the tick is 1. Then if you get another the tick is 2. When one item expire the tick is subtracted so when there are 0 item the resource is 0. I did this in the update function checking if tick > 0 and checking every seconds.
My question is, since im checking in the update an if condition that might be not fired at all (if the user never get the item for whatever reason) is there a better way to do it?
I felt what I wrote kept being ignored and not addressed. I was well aware I needed things to be loaded before. I even said as much as top when I asked how to ensure things are loaded.
Anyway, going by index at least did something.
to ensure a scene is loaded you have to actually . . . load the scene. it's literally that simple
your issue was that you were attempting to use a method to get an unloaded scene just so you could load that scene. if you have the scene's index, just use that
"Using the index would be enough to ensure the scene is loaded" could have been the answer.
I felt I wasn't being heard. But at least a solution was found π
maybe coroutine
though update should still be fine
#archived-code-general message
you can load by index
#archived-code-general message
shows the sceneBuildIndex parameter for the method
and finally: the docs show you that you can load a scene by its index
if you didn't feel heard, how do you think we feel when you ignored what we were telling you
If you propose to help, then it's on you to also address what is being said rather than trying to brush it aside as if what is said is a given. I felt the answer "how do I ensure things are loaded" was never answered, and it wasn't. Instead it was about being coy.
"have you read the documentation?"
"Yeah what does it say?"
That's not helpful. That's sneering. So of course things get adversarial.
That didn't show up on my screen during the conversation. So partial blame on me on that one.
if we had just answered your question about how to ensure your scenes were loaded, the answer would have been to use SceneManager.LoadScene(Async) for each scene. So do you think it would have been appropriate to answer your question with that, or do you think getting more information then providing the info about using the index like we had done was the more appropriate course of action to solving your issue?
And now I have the issue I've had to solve before that I forgot how I solved.
You load Scene A and B additively.
You unload scene B while loading C additively.
B does not get unloaded as you'd expect. But if you then then load B again and unload C it seems that C does not get unloaded π€
I realise Unity does some stuff to save on resources there but I'm sure this is a well-known problem solved by many before.
Asking me to read documentation the way you did was not helpful. It was condescending.
and yet this whole thing would have been avoided had you read the documentation
No. Because I already had and I even quoted it back at you to underline that I had read it and that my question had not been answered; how to ensure scenes were loaded.
Should probably move on though.
this is very C#, but if you want to remove all subscribed Actions/delegates from a class when it is gone (or Destroyed for Monobehaviour) is there a cleaner method then unsubscribing every one at this point (in OnDestroy on Monobehaviour). Perhaps there is a pattern to manage event subscriptions?
multiple, custom too
EventAggregator pattern maybe?
Ah, The penny drops.
Did you perhaps think that because you had declared the scenes in the build settings they would automatically be loaded?
This would account for the confusion amongst those of us who know that is not the case
In my project the entire state is driven by reactivity system so things automatically unsubscribe and no fear of leaks.
It's a bit high of a buy in if you don't start the project with a reactivity system in mind, but you can easily achieve a good enough version of the automatic unsubscription on destroy.
Make a MyMonoBehavior class or whatever you want to call it, let it keep track of a list of subscribed events. Have a SubscribeTo method, which subscribes to an event and puts it in the list to keep track of. On destroy, loop through the list and unsubscribe.
Now to use it, instead of inheriting from MB like you usually do, you would inherit from MyMB instead, and you subscribe to events using the SubscribeTo method, and that's it, on destroy it will automatically unsubscribe everything.
There are some limitations with this solution unlike a reactivity system, but for simple use cases you don't need to worry about "oops forgot to unsubscribe now I have a hidden leak that might lead to hard to detect bugs."
so basically this lol but I thought using a dictionary instead but yea
Probably a List<Action> so it's more flexible, but yeah.
This solution kind of sucks that you must subscribe using the method or else it won't be tracked which limits your flexibility, unlike a reactivity system.
Anyone have some suggestions for the best way to tell if a player is moving an object in one of the cardinal directions? Like are they moving up, down, left, or right?
Use Vector3.Dot with Vector3.up, forward, right etc.
Ah. You know, I forgot about that. Let me do a bit of review.
What confused me most of all was that I've not had this issue before with scene loading and as such I felt the engine was almost mocking me. But I couldn't remember how I solved it last. So I came here to ask.
There was a lot of confusion and misinterpretation going on on both sides, so let's write it off to experience
Hi there, I've got an issue with terrains, i don't know why i have a couple of terrains that does not appear when building the game, in playmode everything is okay but whenever i build the terrain, the floor is transparent...
hey guys, how do i get 0-360 degrees from transform.rotation.eulerAngles.z ?
i know about rad2deg but that is just a value and i think it pushes the value just to 180/-180
Below 0, add 360, above zero use as is.
so if the degrees is negative i do rad2deg * eulerangles.z + 360 and if its positive, i just do rad2deg * eulerangles.z ?
@cold parrot
Euler angles are already in degrees
This is an XY problem. Can you explain what you are trying to accomplish with this information?
There are probably better ways to approach it than reading euler angles from a Transform, which has a lot of pitfalls
Yes I think will do something like that just to make it secure and cleaner.
That looks interesting, need to read up on it
Delegates just seem bad design as hold references to classes
Why not get from transform.eulerAngles? But is in degrees
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
For some reason start and update dont work in my code but fixedupdate does
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collidable : MonoBehaviour
{
public ContactFilter2D filter;
private BoxCollider2D boxCollider;
private Collider2D[] hits = new Collider2D[10];
private void Start()
{
Debug.Log("F");
print("A");
boxCollider = GetComponent<BoxCollider2D>();
}
private void FixedUpdate()
{
//print("GDS");
}
private void Update()
{
boxCollider.OverlapCollider(filter, hits);
for (int i = 0; i < hits.Length; i++)
{
if (hits[i] == null || hits[i] == boxCollider)
{
continue;
}
print("G");
OnCollide(hits[i]);
hits[i] = null;
}
}
protected virtual void OnCollide(Collider2D coll)
{
Debug.Log(coll.name);
}
}
Wdym by them not working? How did you check?
i put print function in each one of them and only fixed update one worked
Show a screenshot of your object's inspector with this script attached, and the console window open in your editor while the game is running
Also the FixedUpdate print is commented out
so showing the code as it actually is when you run the game is essential as well
(btw there is no print in Update right now, except for the one inside a conditional statement)
started working mb
I am working on spawning the enemies. I have a function to do it, but I want to make a check for if the position is a bad one (has colliders blocking)
public static Enemy SpawnEnemy(Vector3 position) {
CapsuleCollider check = I.enemyCheck;
if (Physics.CheckCapsule(position, position + Vector3.one * check.height, check.radius)) {
print("Tried to spawn enemy in an invalid position.");
}
return Instantiate(I.enemy, position, Quaternion.identity);
}```
I have done this, but now I want to find the closest "valid" position. Is there algorithm to do this easily?
Is there any situation where is it useful to set HideFlags.NotEditable on top of HideFlags.HideInInspector ?
Check Physics.ComputePenetration
No
Count the punches, if 0 then left, if 1 then right. To alternate forever: if count % 2 == 0 then left, if count % 2 == 1 then right
You should also call the invoked methods directly through a reference to the script component that has them.
I think it depends on the scenario. Mentioned Physics.ComputePenetration could work assuming you only need to push spawned enemy away from the initial collision. The thing is, the collision can occur again, with another object. You can repeat the process in the loop, but I think there would be a risk for this loop to be endless (unless you also push other colliders, effectively spreading them out).
I think the simplest way of dealing with the problem would be simply to set spawn points and spawn enemies inside of an unoccupied spawn point. It should work as long as at least one spawn point is not occupied. You can also add some triggers to those spawn points to automatically set them as occupied/unoccupied. The spawn points could be either placed manually or baked with some algorithm. The things would be simpler for grid-based games, since those already divided the game into small zones. If you want to keep analogue precision, I suppose you could create some variation of a quadtree, but I believe simple solutions are a better choice.
Yes, I have a predetermined spawn pool for particular objects, but I also need random spawn positions for patrols
You can consider using NavMesh. There is a method that returns the closest point on the NavMesh in a certain range:
https://docs.unity3d.com/ScriptReference/AI.NavMesh.SamplePosition.html
But keep in mind that you would need to set characters to be treated as obstacles on the NavMesh. Also keep in mind that NavMesh can be quite expensive depending on how you use it.
I am using navmeshes, I will look into this
Hm.. I wanna disable auto refresh but I don't see it on my preferences window -- what I want to do is described here:
https://support.unity.com/hc/en-us/articles/210452343-How-to-stop-automatic-assembly-compilation-from-script
My preferences window looks like this though:
I've already changed those -- but these are specifically for play mode
I want Unity to not reload each time I hit ctrl+s in Visual Studio for every small change
i was also looking for the same thing but i couldnt find it 
its painful especially when your just adding comments
I used to have a hack for it which involved changing EditorUserSettings.asset or EditorSettings.asset directly but I don't remember what it was lol
i just accepted it xd
Hey I am planning a little experiement with Unity ECS, is there a way to get all entities that had a certain componennt changed? Like a reactive way to query entities
im thanking god enums exist rn
enums are making this thing im trynna do a little easier and fun
Also make sure you know about enum flags. You can have multiple values at the same time.
[Flags]
public enum MyEnum {
First,
Second
}
MyEnum current = MyEnum.First | MyEnum.Second;
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum
yield return new WaitUntil(() => CombatManager.Instance.animationSpeed > 0);
Is it possible to make this code multi line? What is the syntax? Adding { } doesn't work
You need to return ...; after adding {}.
ah thanks
That worked, is there a reason why I have to return?
I assume that the above is a shortcut that already returns behind the scene?
In a statement block, return is how you return.
oh it has to return boolean for the WaitUntil to know when to stop the loop
Expression body is just a short way to write a block that contains only return.
There's no implicit return in C#, we are not Rust here π
Makes sense similar to properties
I found a post from 2011, I wonder if this is still a thing or if it should be avoided at all cost?
Perhaps Coroutines werent a thing back then?
function Update(){
MakeThis();
}
function MakeThis(){
//make this first thing
yield WaitForSeconds(2)
//make the second thing..
}
I don't think that's valid C# code.
Perhaps its from JS times
Not valid JS either, MakeThis is not a generator function.
(Did Unity version of JS ever support genreator functions?)
It's UnityScript
The Unity Manual helps you learn and use the Unity engine. With the Unity engine you can create 2D and 3D games, apps and experiences.
This example is from there^:
function Fade() {
for (var f = 1.0; f >= 0; f -= 0.1) {
var c = renderer.material.color;
c.a = f;
renderer.material.color = c;
yield WaitForSeconds(0.1);
}
}```
UnityScript isn't exactly JS
but it's close
I feel like UnityScript and Boo were such dumpster fire. They look like the languages but not exactly, so you could use zero of the mature ecosystem. At least they got C# right that we are not locked out of .NET ecosystem.
C# is partially right. We're still not totally in the ecosystem. We can't use NuGet (easily), We can't manage assemblies in a normal way, etc.
(I also feel like they are repeating the same mistake by reinventing CSS/HTML but I guess it's better than nothing)
ooo multiple values cool, also ive never heard of enum flags
How can I draw an ellipse with code in the UnityEngine library?
line renderer
well that was fun..
You don't have to use your hands to draw the code and then draw it right away
ellipse π€
wdym draw the code?
I don't understand the code of unity 2d
why do you want to draw ellipse then ?
to do some functions
that is very vague, everything you do is a function because they are part of doing anything lol
I'm pretty sure there's a language barrier/translator involved in this discourse
seems that way lol
that's true
Question:
void VelocityControl()
{
Vector3 currentVelocity = new Vector3(rb.velocity.x, 0, rb.velocity.z); //Current player velocity
if (currentVelocity.magnitude > current_setting.speed) //Check if velocity is over max speed
{
Vector3 fixedVelocity = currentVelocity.normalized * current_setting.speed; //Sets velocity to 1, then to the max speed allowed
rb.velocity = new Vector3(fixedVelocity.x, rb.velocity.y, fixedVelocity.z); //Changes it in-game
}
}
So this ensures the player has the same speed when he is moving ||(Ofc some floating point differences but who cares)||
However when the player is in the air, the drag is 0, but when its on the ground its 5. So the speed is different in the air
So im wondering how I could make that code account for drag somehow? Right now I have to manually slow down the player by multiplying the speed by a small value when hes in the air. This seems quite complicated
I dont think its even possible
I guess it has to change fixedVelocity using the drag value somehow
I recommend not using Unity's Rigidbody drag . Just control the speed yourself with separate speed variables
So something like simulating drag by pushing the player in the opposite direction hes moving when he doesnt do any input?
if thats what you mean by separate variables
Well your code is just directly normalizing the input and setting the speed
So no
Just using a different speed variable when grounded vs in the air
Hello. When I build my game, one specific sprite just disappears. Somewhere it becomes a white rectangle, somewhere it's fully transparent. What to do? How to make it show up? It's not a sorting layer issue.
Editor/Build
Googling gave me nothing
im having 2 problems with this code
A) the ball prefab doesnt instantiate to begin with
B) the current ball in my scene does not move to the left without tilting downwards
can anyone help with this?
looks like a UI problem to me
unless you're loading the image via code ?
or like remotely
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
im using an Image with this sprite
the sprite vanishes in all uses
either white rectangle or nothing
and where are you getting sprite from
Assets/Sprites
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireBall : MonoBehaviour
{
public GameObject ball;
public GameObject[] spawn;
int minNum = 0;
int maxNum = 2;
public float ballSpeed;
GameObject player;
// Start is called before the first frame update
void Start()
{
player = GameObject.Find("Player");
}
// Update is called once per frame
void Update()
{
Invoke("FireballInstantiate", 5);
ball.transform.position = Vector2.MoveTowards(ball.transform.position, Vector2.left, ballSpeed * Time.deltaTime);
}
void FireballInstantiate()
{
Instantiate(ball, spawn[Random.Range(minNum, maxNum)].transform);
}
}
Oh thats what you mean. Well I am sort of doing that
speed * airSpeed //(around 0.3)
yeah because you're trying to move the prefab and not the spawned fireball
also might just want to make a timer with Time.time for example, that Invoke in Update especially not even using nameof
I implemented unity ads in my project and I don't understand why I can only see 8 ads (then something with "no fill" appears)
so how do i move the spawned ball?
the ball doesnt even get spawned btw
Instantiate returns and Object
not a prefab?
how do you know the code is even running then
no prefabs arent a thing in playmode
cause the code included the fireball to move to the left and it was (the already existing one)
what should I do?
ok i used the object instead of the prefab and it worked but it still wont just go to the left without slowly falling down
what..who said to do that
thought u said prefabs wouldnt work
no i wanted to know if you were cloning ball as a scene object instead of using a prefab π€
Maybe take the question over to #archived-unity-gaming-services, unless you suspect some of your own code is responsible?
i was using a prefab before yea
like I said, the new object isn't moving because you never assign it to the instance spawned
as to why its not spawning you are not assigning it a position so its prob spawning at world 0
not sure i understand
im assigning it to a spawn point
in a gameobject array
you're just parenting it
but it spawned somewhere else
so how can i assign it to a spawn position and not parent it
you see you're only assinging a parent not giving it position
the Vector3 is for position
use the correct signature
also you see the return value is Object
true
if you don't know what it is click it
no, i do
its just that i was experimenting different methods since i was experiencing issues
well sounds like a case of I didn't look at the manual first π
i still dont know how to instantiate the object in the position that i want
and in the direction i want
vector3 is a position
alr let me try that real quick
nah i dont need to parent it
hey quick question
whats the diff between time.deltatime and time.time
@rigid island
like if i wanted something to instantiate every 5 seconds
Time.deltaTime is the number of seconds which have passed since the last frame. Time.time is the number of seconds the game's been running.
You can use either to manually manage a timer. Or InvokeRepeating() or coroutines, in which case you typically wouldn't need to use either for this use-case.
keep it nice and simple cs timer += Time.deltaTime; if (timer >= fireballInterval) { FireballInstantiate(); timer = 0f; }
nice
thx for the help π
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireballMovement : MonoBehaviour
{
public float ballSpeed = 10;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = Vector2.MoveTowards(transform.position, Vector2.left, ballSpeed * Time.deltaTime);
}
}
why does it not go straight left
instead it starts falling down slowly
i have no rigidbody attached to it so gravity shouldnt be affecting it or anything like that
I don't think move towards take a direction vector as the second parameter.
thx
I'm trying to pair scriptable objects 1:1 with a corresponding method, and I'm not sure how to go about it.
I want to use a scriptable object to store spell/ability configuration data, but also have a method that performs the spell cast/ability cast.
What is the best way to map these together? {AbilityConfigData, AbilityMethod}
public interface IAbility
{
void Execute(AbilityConfig config);
}
You could do something like this
And for example
public class FireballAbility : IAbility
{
public void Execute(AbilityConfig config)
{
Debug.Log($"Casting {config.abilityName}");
}
}
Then you create some kind of abilityManager
private Dictionary<AbilityConfig, IAbility> abilityMapping;
public void ExecuteAbility(AbilityConfig config)
{
if (abilityMapping.TryGetValue(config, out var ability))
{
ability.Execute(config);
}
else
{
Debug.Log($"No ability found for {config.abilityName}");
}
}
does anybody know how i can make a cooldown in c#? i have tried a few things but they aren't working
why the code doesn't work
yeb
A simple coroutine @modest brook
coolingDown = true
yield WaitForSecondsRealtime(coolDownTime)
coolingDown = false
it doesnt work for me at least i have another way if it doesnt work with you @modest brook
make a varible first
float poweruupcooldown = 10f;
update (){
poweruupcooldown -= Time.deltaTime;
//that will make the code subtract 1 number from powerup cooldown at when a second end
}
that is my code
show what you actually tried, because a cooldown is incredibly simple and what steve showed absolutely would work, so you probably did something wrong
it doesn't work with me and @modest brook
by the way can anyone help me now ?
ok
not until you actually describe your problem. 'Doesn't work' is meaningless
your issue is that you are just calling PlayerPrefs.Save, that isn't actually setting anything in playerprefs. that is what you are supposed to call after calling PlayerPrefs.SetXXX
okay sorry again
public GameObject Axe; public float CooldownDuration; public float timeStamp;
void Update() { AxeHit(); timeStamp = Time.time + CooldownDuration; }
` void AxeHit()
{
if (Input.GetMouseButtonDown(0) && timeStamp <= Time.time)
{
Axe.GetComponent<Animator>().Play("Hit");
}
}`
three backticks, not just one. and you're just constantly increasing timeStamp so it is never possible for it to be less than or equal to Time.time (unless CooldownDuration is 0)
how can i fix?
i was thinking that tbf but its one that i got online that people said worked
You must have misunderstood the code you saw "online" because that could never work. However if you change where you set the cooldown it could work. you need to set the cooldown when you actually perform the action that requires the cooldown, not every single frame
so should i put timeStamp = Time.time + CooldownDuration; in AxeHit()
think about your code and when you want to start the countdown
putting in the axe hit thing had a weird response where the timer only happened when i pressed the mouse button
yeah
thx sooooooooooo much @somber nacelle
well i want the countdown to jump be a number and if a timer is above that number i can use the axe but if it is below i can't use the axe you know?
Do you actually understand your own code?
bit harsh but yeah
i've tried to do a timer before but its just not worked for some reason
the code i have rn is just saying when the mouse clicks play the animation of the axe hitting
look ar this
void AxeHit()
{
if (Input.GetMouseButtonDown(0) && timeStamp <= Time.time)
{
Axe.GetComponent<Animator>().Play("Hit");
timeStamp = Time.time + CooldownDuration;
}
}
now think, when will the if be true once it has been executed once
well never because the timeStamp will always be above Time.time and the timeStamp has to be lower than time.time for the code to run
not true
oh wait its inside the if statementr
i'll try that and see what happens
for god sakeπ
it was ONE SMALL THING
but, thanks
now do you think I was harsh?
yeah BUT i was thinking this before anyway and its just a good way of teaching lol
also i've spoken to you before like almost a year ago cheers
@knotty sun im comparing you to Rick from rick and morty
no idea who they are
Howdy. In my game, on one device the sprites are normal, but on other devices, some sprites are much brighter. I tested on my machine and a VM (due to lack of other devices). Here is a comparison: host/VM
Not a code question
where do i put it
there is #πβfind-a-channel but I would guess #πβart-asset-workflow
with SceneManager.LoadSceneAsync( name, LoadSceneMode.Single );) the current scene elements seem to stick around for a second or 2 even though it should be unloading it immediately. I have dontDestroy things to show a loading screen but do I need to hide all elements in a scene before loading the next to be sure they immediately hide? Especially UGUI
Or is the Async just not needed and I should use LoadScene
hey i have a question about something in blender but i cant find the right channel to ask in, is there a channel for that or do i need to find another server that is for blender ?
!blender
A supportive community for Blender artists of all levels. Share your work, ask for help, and learn from others! https://discord.com/invite/blender
thank youu
You should be the one saying what's wrong. Most wont willingly look at your code and point out every error
There are really a ton of logical flaws in that code, this kind of stuff belongs in #π»βcode-beginner next time
I looked at code but i dont understand the error
ok
Did you not write the code yourself? You should at least be able to debug, since your code has one, to point out what specifically isnt working as intended
i write it myself
You should add more useful things to your debugs, because just a string doesnt tell you anything. Methods like Debug.DrawRay can help u visualize where the sheep is trying to move from your code. Look at your code logically too, casting in 4 directions here doesnt make much sense, especially considering you potentially move it between casts while using the original point. You could just use one larger overlap sphere or some trigger collider and the unity physics messages. Theres a lot of other minor issues, but probably best to fix those after
i put earlier direction forward but then sheep looked only forward
why wont it let me add a gameobject to my array?
are you trying to drag scene objects into a prefab?
lowkey yea but it wont let me do that with a normal object either
prefabs cannot reference scene objects because those scene objects simply do not exist until the scene is loaded but prefabs do exist at all times
assets (like prefabs) can only reference themselves and other assets
so i need to make the scene object into a prefab first?
well that won't give the prefab the reference to the instance in the scene so no. you would need to pass the reference at runtime
https://unity.huh.how/references/prefabs-referencing-components
what would be the code for it for example
to refrence a scene object in a prefab
enemyAnimator.runtimeAnimatorController = animator.runtimeAnimatorController; is this the correct way to set a components animator to another components animator? because it isnt working for me
be more specific than "not working". but also that is how you assign the animator's animator controller to another animator's animator controller
yeah thats what i meant. basically its giving me an unassigned reference exception
i assigned it in the inspector and everything
then one of your two variables are null at the time that line runs
would it work if i refrence the scene object into the fireball and delete the prefab then create it again after the refrence?
just curious
wtf does that even mean? again, assets cannot reference scene objects.
ah ok
Hey Folks, so we were trying to create a Pool class for gameobjects but to implement it specifically for gameobjects we would need it to inherit from monobehavior. Is there a way to do it without inheriting monobehavior?
Basically, I want to do something like this:
{
Gameobject[] pooledObjs;
void addToPool(Gameobj)
Gameobject getFromPool();
etc.
}```
I was thinking I could forward declare Gameobj but I saw in a few search results that C# doesn't allow it
just FYI unity already has a built in object pool class in 2021+
and you don't need to inherit from MonoBehaviour for the pool, if you don't you just need to create an instance of the class in whatever component/class you'll be using it in
can you explain a bit on the create an instance bit?
same here i tired reading the article he sent me but i didnt understand much about instances and root components
you create an instance of the class using the new operator. that's some like absolutely basic stuff for c#. if you aren't familiar with the language or the fundamentals, then consider going through the beginner courses pinned in #π»βcode-beginner
what i advised you to do was entirely different than what i told Jako to do. do not get them confused. the page i linked shows you how to pass a reference to an instantiated prefab, consider actually reading it
too complicated for me rn since im sleepy, im just gonna check a youtube tutorial
then take a break and come back to it after you've slept. don't make your lack of sleep everyone else's problem
alr take it easy
wait no im familiar with new, so do you mean just like
{
GameObj[] Pool = new List<GameObj>();
}```
no that's not at all what i was referring to. that's also super wrong
i was referring to creating an instance of your Pool class. you do need to initialize your array, but arrays are not lists
this was just to get the idea forward, but I sense the condescending tone, so good day to you
ill take my questions elsewhere
fun fact, but constructive criticism is not an attack on your person. don't take things so personally
there's constructive criticism and then there's a tone of superiority complex, for obvious reasons, I don't want to get into online arguments, so thanks
or maybe, i was literally just providing you information. but if you're so insecure that you took it as an attack or a "superiority complex" or whatever, maybe look inward to find out why that is
I dont want to fuel anything especially because you were helpful to me before but i felt a similiar way as jako and its no biggie but abit of patience with us would be nice
I'd say the issue is posting in a wrong channel. #π»βcode-beginner would be more appropriate for such questions. People would be more tolerant to you if their expectations match reality. In this channel we expect you to know what creating an instance means.
(sorry just realized there's a postprocessing channel)
imo its still no excuse to be impatient with developers and sometimes its difficult to tell whether your question is classified for the beginner channel or general channel, you can guide us if we misunderstood and not just once but each time we forget because after all this is what you are here for right? its to guide us and be patient with us. we are not here to engage in arguments and drama online but we are here to just get the help we need with our codes and game development, thanks.
the channels are for your own skill level when asking for help, it is not dependent on the channel. also "this is what you are here for right"
people who help here do so in their free time. there is no obligation for people to help you, so you need to put in the effort to try to understand the help being provided to you. if you do not understand something then it is on you to actually ask clarifying questions instead of just simply insisting you want examples (especially when the resources provided to you have examples)
also i was impatient with you specifically because you were not paying attention to what i was telling you so i had to repeat the same information multiple times before you finally understood that assets cannot reference in-scene objects and the page i provided to you showed you how you could pass a reference to an in-scene object to a prefab instance that was spawned into the scene
fyi anyone can send a forum link and call it a day and like you said, you are not obligated to help me which is why I mentioned I will find a youtube tutorial that can do so.
and it was pretty clear that i wasn't the only one you specifically was impatient with. if you look at the last couple of people you spoke with
alright i'm done entertaining this. have fun fumbling around without understanding any of what you are doing
lol
When changing a variable value in the Inspector and having the OnValidate method called for it, is it possible to avoid "Modified value in MyScript" being saved in Undo History?
Or, perhaps, a different approach: change the objects to undo
not with OnValidate. Only using a custom editor.
Is there a way to subscribe to Actions without having a reference to the script that owns the reference?
Are static Actions a thing?
yes
I assume that the disadvantages are the same as static fcns where you obvsly can't access non static members
Actually that shouldn't be a problem
Now that I think of it
Since I only want to subscribe to some event that gets invoked via logic anyways
Actually, why shouldn't one make all Actions static?
Because some Actions may be associated with the instance of the class
nope, the main drawback of a static event is that you have to make sure you are unsubscribing from it when the object is no longer in use. non-static events would just get nulled out when the instance they belong to are destroyed/GC'd but static will of course persist
I use static actions a lot to broadcast from things like managers, but as boxfriend said, make sure you're unsubscribing from them. Especially if you turn off domain reloading.
I see
For example, you may have an Action onDead in your Enemy class. The Action happens when a specific Enemy dies, it is associated only with this instance of the Enemy, and is not applied to the the the whole class, is thus non-static.
That makes a lot of sense
So for example in that case you'd call onDead for this specific enemy and you'd want the specific sfx be applied to this specific location or whatever, which makes using static Actions not very great, is that right?
In this case I find it useful to have a static Action<Enemy> where parameter is treated as a sender
By making your Action static here, you cannot tell which Enemy is dead
This is what I have been dealing with - static is fine until you forget to unsubscribe!
In that specific case, you could have a static action that is called so that things can "generically" react to the death of an enemy, to play a sound effect I suppose.
But personally I'd just call it directly off the AudioManager.PlayDeathSound();
Otherwise, your AudioManager will have to subscribe to every enemy that gets spawned in.
Right
Oooh that seems interesting too, then at the end of the day is the solution a preference thing or?
Or the worst, you do:
private void OnEnable()
{
MyManager.SomeCall += MyManager_SomeCall;
}
private void OnDisable()
{
MyManager.SomeCall += MyManager_SomeCall;
}
And it takes you over an hour to see it.
What happens if you don't unsubscribe? 
Fortunately Copilot auto fills these out
Yes, that's if you want to control all the Enemies
I was discussing this issue - also related to any object that lasts longer than those subscribed to it. Microsoft added Weak Events patterns for this in WPF
I feel like it is a weakness in C#
you end up with NullReferenceExceptions or other related exceptions because objects that have subscribed are no longer around
yep
Generally speaking, if you're typing out code to subscribe to something, immediately put in the code to unsub it somewhere so you don't forget.
I'm starting to think if I should design everything around Actions since they're so useful to separate features, how true is this?
an event keeps a reference to all classes that subscribe to it so they will never actually be GC'd until you unhook your delegate
Because they're extremely difficult to track down if you do
So farI think since I hanen't used static actions not putting unsubs have been working
but I will defo do this from now on
Delegates are a tool like everything else. They have their place, but you don't want to use a hammer to try to drive in a screw.
ideally you would still unsubscribe from non-static actions too. it's just that you run into fewer issues if you don't because typically you're subscribing from an object that has a similar lifetime to the object with that non-static event (or a longer lifetime)
Is overriding the entire Inspector necessary in this case?
Ik this might be a broad and thus unanswerable question but then how do I know I'm not using a hammer to drive in a screw when coding some feature
And I would suggest using OnEnable/OnDisable for subscribing/unsubscribing. Some people use Awake/OnDestroy or Start/OnDestroy, but that means the listeners will react to events even when they are disabled, which is likely going to be confusing. OnDisable is also invoked when the script is destroyed.
this is good - but not all code is monobehaviours, some is plain C#!
Roger that
Like anything it comes with practice, experience, learning from making mistakes.
Aye aye
Omw to write horrible code and fix them later
github has many attempts to make Events that hold a weak reference to subscribers but it has not become part of C# outside WPF .Net
I view static events the same way as I view Singletons. Extremely useful, but also easy to abuse and run into spaghetti problems down the line.
Guess I'll have to find out

I'll be back when the spaghetti is cooked
Thanks for all your answers guys!
Very helpful
In that case I suggest implementing an IDisposable pattern
I believe there are hook like systems that are garbage collected and these also unsubscribe your events, but they pretty much will have the same issue as MonoBehaviours
Yes or you can use the finalizer
same differences, different on destroy
That one will also have the same issue; object might already no longer be used when an event is invoked
yes so better if you can use disposable pattern - but that is a pattern where you have to remember to dispose - so less automatic! IDisposable seems simpler for very short term stuff
When in doubt, VS has analyze options that when enabled can warn you of undisposed classes
IDisposable is usually the way to go, finalizers have all kinds of caveats
don't forget using statements/blocks for dealing with it, it makes it a lot easier!
yes but using statement/blocks are like really short term - that is where I understand its use. But you are right OnDestroy and finalizers are a bit late - if you can finish before that then better
replied to wrong message!
Is there any way to set up buttons to activate on mouse down as opposed to mouse up? I'm fine with adding stuff to it if need be, but going through and changing every prefab and script that uses Button would be a PITA, so ideally it's just something I can tape on (or change at a settings level).
Look into EventTrigger.OnPointerDown
Yeah, that'd involve changing every script/prefab that uses buttons lol, hence I'm trying to avoid
make your own button component and use an editor script to replace built-in button component with yours
yeahhhh that's also a PITA. I'll look into it.
Hey, maybe someone can point me in the right direction:
I am trying to do probabilities for different resources to spawn in my game. My current approach is an animation curve, which works fine enough for me but I want a solution in code so that players can add their own through mods later on. The animation curve is from 0 to 1 and I just check the curve at current progress in the game. (On level 5/10 i check the curve on 0.5; etc)
I want to be able to control this somewhat, like: When is a resource most likely to spawn, when does it start and end spawning, etc.
This is an example of the types of curves I have right now
What would be a proper way to define these in code?
easy way is a Vector2 array
How do you mean?
each point on your curve can be expressed as a Vector2
That seems very troublesome to do though doesnt it?
If I wanted to add something new then I would have to manually declare a ton of vector2s
how else would you do a data representation modifyable via code?
I have no idea, that why I am asking
Cause everything I can think of is more troublesome than animationcurves
no, because youi only need to define when it changes
Another idea I had was to just define the highest spawnrate and when it is and then just calculate the "difference" from that and have some set falloff
you could even use Lerp between the points to define even less of them
So your red line here could be defined by 4 Vector2's
You can modify animation curves in code.
I'm guessing as he mentioned modding he wants to read it as data
Is there seriously no way to do something as simple as "This button should click on pointer down, instead of requiring down and up"?
Eugh. Gotcha.
Hello, my question isnt related directly to scripting but I think many of you use Rider as your IDE.
How did you manage to use an editorconfig with Rider in Unity projects ? I dont know why but my Rider doesnt use the file when formatting
are you looking for ide setup ?
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’ Visual Studio (Installed via Unity Hub)
β’ Visual Studio (Installed manually)
β’ VS Code
β’ JetBrains Rider
β’ Other/None
No my IDE is fine, I just need to make the .editorconfig work
For some reason when I create the file in the asset folder Rider doesn't use it when formatting.
For those who search for this issue in the future, I couldnt make the editorconfig works but you can save the rider settings "in this computer" in the dropdown next to the save button and it will save in the file %APPDATA%\JetBrains\Rider2024.1\resharper-host\GlobalSettingsStorage.DotSettings you can't version it with git but at least you can manage your code style, better than nothing
I have a question about the video player (especially regarding 2D animation). How good is it for many animated scenes? I have concerns regarding how it manages memory compared to something like being able to preload and unload audio or even sprite animation.
ohh ok, I have no idea about rider setups sorry
I cant really find a lot of details on how it works internally regarding that stuff.
not really a coding question
well its about the internals of it because i need to know if i need to somehow make a script to preload each set of animations
vs just putting my trust into the component
unity is closed source so aside from the public c# api you wont see how the actual componets are working if its C++
i know but i imagine someone must have some insight or experience with full frame animations in their projects
thats why it might be better suited for #πβanimation or #π»βunity-talk
ah ok thanks
As a rule of thumbs, you should implement it first, profile, then if it has issue look for solution.
Not a good idea to preemptively optimize if you do not know something.
yeah thats why i wanted to ask first though just incase someone else has dealt with it. All the animations are 1080p and i know I dont have fine control over the videoplayer like i do with audio (like choosing when to load and unload the clips into memory) but i will probably end up profiling it
You mean a video ? I've used it multiple time for professionnal project without any particular issue.
its pretty much a complicated visual novel but a lot of scenes are actually animated frame by frame
but im glad to hear it wasnt an issue
as long as it doesnt hoard the memory when i switch to a new video on the player it should be fine
mobile and PC
Be sure to transcode your video. Also, you might consider to not use video at all for mobile and instead animate in Unity.
yeah thats probably why i need to do some proper benchmarking because alot of the videos arent stationary enough or small enough to split into spritesheets so it would be playing with full sized frames
What are possible reasons a List in a Scriptable Object might get its fields nulled out?
VSCode checking the field itself, its only ever added to, never set to null, new list, removed from, yet just now an entry in there I was using deleted itself
The context of the field deleting itself is that I was in play mode, exited play mode, returned to play mode, and it was gone.
I wasnt paying close attention to the field itself at the time, I was working on other things
It makes me greatly concerned about the stability of my project if random lists can null out like this without my input 
Is this supposed to be an editor only function? You shouldnt be editing fields of a scriptable object. This is like the first thing brought up when SO's are mentioned.
If it is editor only, then you can use SetDirty to save those changes
im trying to make an axis independent player controller for a zero g environment, so the player can free look around and move with 'thrusters'. The problem is, whenever the player is upside down, the y axis gets inverted. heres my code:
// Update is called once per frame
void Update()
{
if (stopped) return;
float mouseX = Input.GetAxisRaw("Mouse X") * Time.fixedDeltaTime * sens;
float mouseY = Input.GetAxisRaw("Mouse Y") * Time.fixedDeltaTime * sens;
yaw += mouseX;
pitch -= mouseY;
//pitch = Mathf.Clamp(pitch, -90f, 90f);
Quaternion yawRotation = Quaternion.Euler(0, yaw, 0);
Quaternion pitchRotation = Quaternion.Euler(pitch, 0, 0);
Quaternion targetRotation = yawRotation * pitchRotation;
if (cameraLerp)
{
player.rotation = Quaternion.Lerp(player.rotation, targetRotation, drag * Time.deltaTime);
}
else
{
player.rotation = targetRotation;
}
}```
Yes Editor Only, here's its facade. Ill try adding set dirty, but the changes appear currently in the SO already (unless thats unrelated?)
wait is this the wrong chanel
im so sorry
example of it in action.
Yes it is unrelated, set dirty will actually save the changes.
For my understanding, what does saving the changes mean in this context?
Currently hitting play/unplay, the new strings remain added to the SO, but they must not be 'saved' in some way deeper than simply being there and being persistent across play/unplay?
selectedPlayActor.charData.attackMacros.Add(result);
UnityEditor.EditorUtility.SetDirty(selectedPlayActor.charData);
Doing this now, charData is the SO
Honestly I dont know enough of the internals of it. The docs may say more but all I know is that you must use set dirty or the changes will revert. The play/unplay thing is more likely because the SO is unloaded and reverts back to it's original state though I am just guessing here
Ahh thats fair, still thank you for the reccomendation
added set dirty now
Uhm what mobile apps y'all suggest
does anyone know why reordering operands will increase performance?
Multiplying two floats is one multiplication operations
Multiplying a float and a vector3 is three multiplication operations
Your original code is doing two of the latter and one of the former
The new code does two of the former and one of the latter.
It's fewer operations and therefore faster.
ah ok thanks
Vampire Survivors is a pretty fun timewaster. Game itself is free but you should totally get the DLC, they self-published to avoid having loot boxes and other microtransactions
Accidentally calculated chunk size wrong in my chunk visualizer in OnDrawGizmos and ended up drawing millions of gizmos causing the Unity editor to completely lock up.
Problem is, it seems the project cannot recompile the C# code. I've removed the gizmo code and saved the script but every time I enter the editor it gets stuck on drawing gizmos.
delete the library folder
Hello!
For my Unity game, I have a list of managers that are singletons containing the main game logic. These managers are organized in a prefab called "Managers." Most of these managers are static instances, allowing me to reference them from anywhere in the code. This Managers prefab gets instantiated in the Awake method when the game starts.
So far, I haven't encountered any issues with this approach. However, I'm wondering if i should look into a different approach or its fine for a solo programmer working on a small game having all this singletons with static instances (right now there is like 60 singletons for managers and there will be more probably). Thank you!
I am trying to use the Unity AI But i got these errors after installing the library. Any help?
If you haven't run into a problem with your approach then "fixing" it is just bikeshedding
yea you are right, im more worried about future problems and having to change everything from the ground, rather change everything now than later finding out this is a terrible approach
so wanted to know if this is fine for a smallish game or i should consider other approaches
it's fine for a smallish game
until or unless you run into problems
60 does sound like a lot, you might be making your classes too small. but other than that, if it's not causing you issues, don't mess with it
ok thanks a lot for the answer π , how big projects approach this is having dependency injection i assume right?
Hey, I have a question. For my game I created some sort of infinite road working with bezier curves that generates a list of points where the road is (I followed Sebastian Lague tutorial).
The thing is, to make it infinite, everytime you're too far away from the start of the road, it removes a section of the road and add another at the end but for now I regenerate the whole mesh (90k verts), is there a better way to do that?
Like only adding and removing tris/verts/uvs without doing something like that:
Mesh mesh =new Mesh();
mesh.verts = v;
mesh.tris = tris;
mesh.uvs = uv;
mesh.RecalculateNormals();
Cause generating a mesh with 90k verts and 45k tris causes a small lag spike
90k verts for a road sounds kinda insane, is there no way you can just reduce this?
Well that's a good question lol
Here are all the tris
So yeah I kinda don't understand why it displays so many
And now for another road it says this
Ok so as soon as my car start moving, it adds more and more tris, I'll look into that, thanks for pointing that out
The first ever road building car
fr, I mean that's kinda the point of the thing but it should also delete some parts of the road (which it does) so idk lol
Well it looks like my cubic car is taking more and more tris to render???? If I just hide it, tris are back to normal
On of my trail renderer had corner vertices set to 70, don't know what that's for but it was creating 70k tris somehow
And for this problem, I found a solution maybe, would it be more efficient to make each portions of road into different meshes so I can add/delete some without having to update the whole mesh?
Yes this would, and could be treated with more of a pooling approach. You just have to make sure it doesnt affect the actual gameplay like these must be positioned properly
Yeah, I'll make sure there'll be no visible difference. What do you mean by pooling approach?
you could create all these meshes once (or however many you may need) then reuse them. Instead of add/delete you would spawn them all once and only toggle the ones you need
though tbh not sure how valid this would be in your current scenario, or if you even planned to reuse parts of the road or everything is made in a new way every single time
arent road building cars just like, asphalt rollers
It's a great idea but every thing is made in a new way
So wouldn't work
I'll try to make the different meshes part tomorrow
ah im not too sure how much of a performance difference you'll get then, sorry i didnt really do mesh generation much. The profiler should quickly tell you though even if you just test it on smallish samples.
split the road into a bunch of chunks and destroy old chunks
I'll check that but I dont see how it can be worse
or create them in chunks in the first place so you don't need to split them
yea im not saying itll be worse, just not sure how much itll be better by
Isn't it the same as making into different meshes?
Oh ok
basically yeah you want a stack of meshes
But I'll still do that, so I can have other objects (trees) attached to a road portion and delete them too when deleting the road portion
Ok thanks
Is there any thing like #if UNITY_EDITOR for the windows server build? So for example #if UNITY_SERVER someBool = true #endif I'm trying to do something to make a bool true if it's a Windows Server build So ther's no confusion - the option in the build profiles section.
Thanks, I do see the server one in there. Just doesn't exist for me for some reason
nvm I got it
I had to added it to scripting define symbols
thank you
Anybody here can help me understand why animationClip.length is returning 162 when the clip is only 3 sec long?
Hi So uh, I have this problem on my weapon script which is that when the player kills another player (that isn't him) The score doesn't get updated, But when they kill themselves (a bug that im not fixing yet) The score updates, Could anyone help me?
this is the script
it's pretty messy so this is the one that handles giving the score when they kill a enemy
please ping me 5 times if you respond
theres a photon server pinned in #archived-networking
a-
It's much much better thanks again for the help
Can Someone Help me, I don't Understand why this script doesn't work properly
!code and be more specific than "doesn't work properly"
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
If you want to receive help then explain what the issue is, and what you expect to happen
the colider is never call
And share the code using a paste site as mentioned above
i have no idea wtf you mean by that