#π»βcode-beginner
1 messages Β· Page 222 of 1
put ur foot down! (β―Β°β‘Β°)β―οΈ΅ β»ββ»
Ok, now type transform. into start
With the dot
so since you guys didnt reply Im thinking it was cool right?
I basically want to create new types
as I go
enums
you can add to the enums as you go
brother
if you have too many, use Scriptable objects
read what I said
we read it
new types?
yes
I don't know what to put between the brackets
you can name em ANYTHING u want
they are just numbers
but I don't even know how many I have
sounds like a design issue
but human legible
soooo it is cool right?
no, I just want it to be flexible
Add more when needed
We asked what cool meant
You linked code
is it not working>? idk what ur asking
clean and optimized. its working
can it get any cleaner?
then ur good π
just make ur game
probably..
dont worry about that now
ehh you dont know me Im kinda obsessed
@queen adder as long as YOU can read it, thats all it matters
This is what it looks like
Every "Object to be After Imaged" needs to be a type
but u sacrafice readibility the more cleaner it gets
I dont care can you tell me what can I do for that?
which lines
You can just add on to the enum later
Looks fine. I don't really like the lambdas for the methods, but that's just me
You can modify the enum at anytime
yea
but what if I want afterimages for a different character that has more stuff? do I write a whole new script for that? do I extend the code every time?
bro they look pretty clean already
hell yeaah that made my day
You should make it a class or scriptable object if you want to add the parts dynamically
yeahhhh so back to the original idea
A scriptable object with a enum instance is a fantastic idea
i dont think scriptableobject is needed cuz i wont have too many
ill just use classes I think
Your game could 100% benefit from scriptable objects if u have a inventory system
cuz i dont know how many types I'll have
i mean
it wont
A scriptable object is a class
I'll use scriptable objects when I need to do stuff like settings
because their data can be carried over scenes
This sounds like a bad use for SOs
thanks. I have big plans like in the future for optimization I wanna make a very very very big game and I wanna make sure everyone can play it so gotta do it right from the start yeah π
really u should be learning how to use DDOL objects by then
Thats EXACTLY why you should use them??
You want them to be immutable mostly
how else do you carry data over scenes then
and have multiple scenes running at once..
I gave an example??
with one scene having all ur data that carries over
I said "stuff like"
DDOL and AdditiveScenes
Certainly not SOs
SOs should be immutable
we kinda strafed off the main topic of this
You can just check what the enum type is on the scriptable object thats attached to the gameobject
I'm not as knowledgable in Unity as you guys
Thats why were trying to help u π
true but there is a balance to that, don't limit yourself to doing everything optimized. the prototyping stage can suffer
optmizie where its needed later on by profiling
but I'm getting even more confused
thats the issue
I'm just getting dragged into other things
If its a new topic to u ofc ur going to be confused
and I spend more time discussing the issue than solving it
Then step out and let it marinate instead of asking more
You changed the topic and we responded
But ur not even trying our ideas or to learn stuff
thanks I hope you go to heaven and aethenosity too π peace out
so the one after the dot shows the drop down list, but the one before the dot only shows an inline autosuggestion (without the drop down list)
but its a new topic and before we even get to the halfway point we start a new topic again
thats what I should've done yeah
Yes. Correct
So it's working!
thats how it functions..
you deserve a freind π
is it possbile to show the dropdown list for the one before the dot? like in this pic
You did lowercase t
And lowercase g
It cant do a drop down list of available methods for a specifc class if it doesnt know what class ur even trying to type?
if it has multiple possibilities with the same characters u starting typing they'll show
Might be settings. Dunno
haha
well hopefully not too soon 
I will slowly, but rn I was given 13 new keywords
and I can't just learn them instantly
guess not
- Enums
- DontDestroyOnLoad
- AdditiveScenes
i actually just thought of a system I could enhance
Coding is about problem solving. You dont know the tools ur using and ur trying to build a house
they like presets..
the scene thing is a bit more irrelevant rn
Learn ur tools first!!
yea I get it
uset the object to be one of the presets then a switch statement asks 'what preset u using'
ohh, then do this
well I like testing the tool out on different things to learn it
It's pretty important to stop using SOs to move data between scenes, I'd say
Its hard for me to learn by just reading the documentation
ive never done it
i dont even have multiple scenes
Ok good good
I just said what I thought you could use SOs for
cuz one time I asked how to do it
and I was told to use SOs
If its an enum on a SO i think thats fine personally
Well i guess just a MB is fine to
SOs are kinda like prefabs. File assets used to give you variants. But they are for data
for loop
but i dont need all of them
foreach loop
i found the problem guys, i might have put it on inline accidently before according to a tutorial xd
it doesnt matter
thanks all
u have to loop thru it in order..
You do need to see what each object is in that list?
and then do what u need to witht he ones u need
Use the continue keyword on ones you don't need
what I want to do is grab the x pieces from the array that I want to use as an afterimage
ya but u cant selectively use parts of alist w/o knowing their specific index
a for loop is almost always needed
I would kinda need a stack
i mean.. if u can idk how
or an array of arrays
list of lists
yeah list of lists
frog on a log from the bottom of the sea
Or just nested for loops
You dont need a list of list
You have a list with the items u took a picture of i would then make a seperate list with items u actually care about
a list for the "afterimage types" and each of those being a list for the actual afterimage objects
yea a seperate list makes more sense u right
wdym actually care about
omg
its so hard to explain like this
what I want to do
is take a character
take all of its equipment
dont explain it in 1 word lines plz
if you cant explain it will be hard to solve π
Oh i guess that makes sense
try rubber duck debugging and come back
but if I type it in a single line then itll be even harder
this guy ^ π
i dont even know how to begin to write the code, let alone debug it
U need to make a enum bro
rubber Duck Debugging has nothing to do with writing code
try some code and get back to us
the part with creating the arrays and the afterimage clones works perfetly
This a circular conversation at this point
oh my fucking god we just went over why this doesnt work
Bro you havent tried anything weve suggested
the types in an enum need to be pre-declared
https://en.wikipedia.org/wiki/Rubber_duck_debugging @quick pollen
No u cant
thats my point
But u wont being make new types at runtime
runtime was a keyword u shoulda used on the first lap of this convo
why do you need to make types at runtime
you should be asking yourself those things
ok im exiting this convo
Your not making a a new thing at runtime
again, if you can't explain it you wont be able to solve it.
thanks for the help overall
Enum is the standard for this for sure
Figure out how to put your problems into words, you might solve it yourself
im not gonna explain 10 times why it isnt
U havent tried it but ok
It is.
because it wouldnt work
i just asked how to do smth and u said u cant
How do u KNOW that
You don't need to create them at runtime. It WOULD work
so what are we talking about
BECAUSE YOU TOLD ME?
called it a while ago
Alright
yes approaching design without knowing the tools available is never good
then ur overcomplicating it
I can't explain it 10x more
There is absolutely no reason to create enums at runtime for what you explained
You explained why you don't need them 10x
you said u know we're trying tohelp..
we're trying to get u to do something that makes sense
I want it to be flexible
ur going down the wrong road
I don't want to go in and write new code
for every single thing that needs to be afterimaged
What is an after image?
Stop with the caps please.
you have misunderstanding of what it is that was suggested then
But I don't know how many fucking enum types I will have?
Use an interface
Of course you do...
this statement is where imma jump off this circuit
Any afterimageble object just inherits from the interface
some things I want to be afterimaged have 4, others have 6, others have 9
I don't want to write new code for each one
so what is the Max?
thats where you start
there should be none
is this assumptions or just
theoretically there should be infinite
Can someone link me to the actual question
Yeah, i'd like to know too
Alfy whats ur question
I suggested ScriptableObject earlier then
they can be unlimited as you say without changing any base code
I'm not a native english speaker, what is an after image again?
Humble start
a "flashed "version of the visual
like a trail of images of character for example
we discussed that, I just use an int
Ah, I see
Yeah, i get it
the thing from my game as an example
basically the neon colored things
So, what is it not working?
Even if there is Infinite objects those objects can be abstracted to a more generic type. A Ak-47 falls under a gun, A BMW falls under car, etc
i dont think hes that far along..
exactly why does it matter what specific thing is
because I need to know where to place it
I can't put the sword on the leg
That's not really a complete question. You would generally use an enum; you're claiming you don't want to edit the code to add new types of things, and it seems like it's not been established why that is.
If you don't want to do that, then use some other form of tying ints to names, like a hash that relates to some description structure. But the question seems too imcomplete to really understand what you even need this for
The enum would have those generic types predefined and you would use the more generic version of that thing to fill the slot
even if u were here it would be the same deal..
bunch of people saying enum, OP is not convinced lol
guys i fixed my problem, it was only 2 parameters
So enum for general type of item, and another value to give more precise location data, like transform to follow, which can be passed in to the class
well then your IDE is not configured ?
it was elaborated further during the discussion, what I basically want is for these afterimages to copy the state of the player, appear for a bit, and then disappear
nah, i just didnt pay attention lmao
oh ok
the player isnt just one object
its multiple objects
and I don't just wanna make a copy of a player
I want to be able to make a copy of anything
a scriptable object tbh with all the parts you want for each char..
without having to rewrite scripts
If u want a really dirty way of doing this
are the objects you wanna copy in one hieararchy?
Well actually no thats to dirty
i did instantiate
he wants ALL the expandability and scaleability, with the codebase that he doesn't want to re-write
under one root?
I'm confused what you mean by state, and why you need to copy state if it's just a visual effect
I wasnt going to say instantiate lol
sorry, I meant position and rotation and such
store it in poco? or SO
im here for the big reveal of what the actual issue is.. and think vertx if anyone can get to the bottom of it
I don't really understand what the issue is, or why it needs to matter what type of object you're copying if it's just a visual effect
true. although I agree that its not 100% clear what they want do with those pieces
Youve got to be more specific
by type I mean like
sword
shield
whatever
Yes, and why do you need that information at all if it's just visual
did you check the video
Yes
For what I understand, he wants to position the after image in the right place. So the sword in the sword hand.
I want to take the character at a frame
take the transforms of all of its objects
then get all of the correct objects to get to the correct places
so an afterimage sword goes to where the sword is
and again, why does it matter if something is a sword or a shield
it's just a meshfilter and a meshrenderer, or a skinnedmeshrenderer
because I don't want to put a legplate where the shield should be
why would that ever happen
Whats wrong with just spawning whatever the item is?
I think it doesn't, they just don't understand it
just store the positions and rotations?
I need the sword afterimage to go where the sword is, not the shield afterimage to go where the sword is
Just loop over the transform hierarchy of the thing you want to copy, spawn the same transforms and copy the renderers
if you just use the current position, that would never happens, no? I could be wrong
i have those already
this issue is post spawn..
he already spawns everything where it should be i think
whenever I initialize everything, I already have these
I have 10 of each element here
with everything they need
plus the character
so I spawn 10*8 objects
but then how do I know which object is which
Why do you need to know
how do I know what object im putting where
π we're on circuit 2
literally
he doesnt have an answer
You just need to spawn it where its at
You are making a copy. If I want to retype what you said I don't need to know what words you used
Those objects don't have transforms?
I just need to loop over the letters
please indulge..
ofc they do, they already stored them they said
Or please don't lol
so much for no caps
I want to activate them and set their transforms when its their turn to be active
problem is, I essentially don't know which letter is which
basically
I have 10 a's, 10 b's, etc
Why does it matter which letter? a letter is a letter..
and then I have to recreate a word
Why, you have the original object, why don't you know what you have
aren't you already doing that in the video?
its using Instantiation which is extremely bad for performance
I instantiate and destroy 100+ objects every second
ah, lovely, now I understand
holy crap
im confused why u destroy and instantiate.. and not just disable renderer and reposition
thats literally what i want to do
You can do all this without knowing what type of object you have
βοΈ i think u just thoroughly confused tf outta everyone involved edit: u as in him
how do I know where I put an object if I don't know what it is
The only 4 things that matter are: Transform, MeshFilter, MeshRenderer, and SkinnedMeshRenderer
yes
The transform you're copying tells you where it is and what it's parented to, and the rest tell you what's rendering and how to render it
you don't need to know if it's a shield or a sword
but I don't want the Mesh of the Sword to be where the Mesh of the Shield is
Why would that ever happens
because thats fucking stupid
What gameobject controls the sword?
and just like me copying your sentence, that would never happen
π
That's what we are trying to tell you
so, you have separate pools per object type
If you have a sword, then use that to get a sword
they just said how, copy those components
but how can I compare
and that begs the question what's the "key" for each pool
because you are copying something that already exists, why would a copy mix it up?
just iterate over it, and duplicate what you see
I already have copies of something that exists
I'm not copying it in runtime
I copy it at Start()
You just spawn it where it currently is
i think his setup doesn't allow the ease of what we're suggesting.. thats my guess
send again please
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
so, AfterImageObject is a nuh-uh
If the problem is pooling, then you will need to check the state of the objects and compare with your pooled object
see if the meshes have changed or if there's extra transforms
and handle the differences
but it's still just meshes and transforms, not special objects
i want my player to be able to parry attacks, i have the button and animation n stuff ready, but i am unsure how to approach the problem of detecting the parryable objects.
Do i just make a big ish invisible circle under the player parent that has a trigger collider, and if any objects come in contact there, then there is a parryable objects in range?
you need a Dictionary<Object,Pool<Object>> kinda... this way you can pool by object and request a new instance by said object as key
I would use a interface
and then it's easy, because you request an object that matches your type, so you just need to apply transform stuff
also that way i can also easily know which gameobject specifially is there so ican set the beenParried bool in it to true or wtv
And when OnColllisionEnter is called check to see if the collision has inhereted the interface
what if I do something like this
sorry i dont understand the " inhereted the interface" part
The thing about the big invisble circle is up to u. However u decide to set up the collider is up to u
why not just a parriable bool
not sure exactly how an interface would look like here
Uh if u dont understand interfaces you could just check a tag of the gameobjects collider
I would just have a parriable bool. Then, when attacking, the parriable attack would set the bool to true.
The tag could just be Parryable
yeah thats what I did personally
you create a hitbox, put it as a child of ur player, and set it up with a tag, and using a script you activate and disable the gameobject
For parryable attacks, ofc.
You couldnt do a bool parrayable because each enemy class would be different
(Make a Parryable component π )
Interface
if the enemy class wasnt parryable u wouldnt inherit
component π
therefor not need a bool
Then each gameobject has a extra component on it
but yea u could also quickly check for a component such as Parryable
An empty interface just for a check seems like a code smell to me
whats 1 empty class..
so a script deticated to handling parrying?
marker interfaces are cool, marker components also, but generally if it has any behaviour and stuff, it's better to be able to compose objects of 5 components and not make a new class that implements 5 things
is that what u mean by a parriyable component
a script on a gameobject is a component
Well your gonna try and get the component of the gameobject
If it has the component it can be parried f it doesnt then dont parry
one sec
wait what
Hahaha
@scarlet skiff u want smth like this or?
copy pasta fail
nothing, we didn't see a thing

ye more or less
welll
most of it is handled through animation events
my game is in 2d
using UnityEngine;
public class Blocking : MonoBehaviour
{
[SerializeField] GameObject shieldHitBox;
[SerializeField] TMP_Text UICooldownText;
[SerializeField] Animator animator;
//[SerializeField] GameObject blocker;
PlayerHandler moveSystem;
float shieldCooldown = 0f;
private void Awake()
{
moveSystem = FindObjectOfType<PlayerHandler>();
}
void Update()
{
if (shieldCooldown > 0f)
{
shieldCooldown -= Time.deltaTime;
UICooldownText.text = "Shield Cooldown: " + Convert.ToInt32(shieldCooldown);
UICooldownText.color = Color.red + Color.blue;
}
else
{
UICooldownText.text = "Shield Cooldown: READY!";
UICooldownText.color = Color.yellow;
}
if (Math.Ceiling(Input.GetAxisRaw("Block")) == 1 && moveSystem.stamina >= 1 && shieldCooldown <= 0f)
{
animator.SetBool("Blocking", true);
moveSystem.StartAction((int)(moveSystem.stamina >= 30? 30 : moveSystem.stamina));
shieldCooldown = 1f;
}
else animator.SetBool("Blocking", false);
}
public void StartBlock()
{
shieldHitBox.SetActive(true);
}
public void StopBlock()
{
shieldHitBox.SetActive(false);
}
}```
the premise is the same tho
u select the frame of the animation where the parry starts
thats when you turn on the hitbox
and u select the frame where the animation ends
thats where u turn off the hitbox
Thats how i would go about it tbh
if its in 2D, you can either check which sprite it's on
The animation events specifically
or stuff like that
they're easy and reliable so yknow

do u have an animator @scarlet skiff
and u just have a method or something in the parried object that reverses their direction if they collide with the shield?
But for u obada just check what component the Collider has
yes
yeah i think the disdain to marker interfaces has been scripted into my brain in uni
yeah, tho personally I handle that in the projectile itself
And go from there
if it collides with an object that has the "shieldHitbox" tag
it gets the velocity reversed
and the color inverted
yea well the projectile is the (soon to be) parried object
Pretty cool pretty cool
so same thing π
Yup
another example
yea, u just put a script on it
which reverses the velocity when its parried
inside of ontriggerenter
parriable is a bool on the projectile
dw about "stuck" its for smth else
its gonna be even easier in 2D
I should use this more often. Can't shake the feeling of code smell tho lol.
you can just flip the gameobject
You can make a tags component that all objects have and use an enum flags for all the tags instead of having a bunch of components on the objects.
and it works perfectly
u can literally put this in any script
That way itβs just one component, plus Unity serialized enum flags and has a built in inspector.
u dont need enums for this
ya, i don't over use them or anything.. but i prefer them to Tags
Alfy u have the biggest beef with enums lol Im joking
And they don't cause over use of inherintance issues, so i guess they're fine
i just dont see the reason in using it everywhere
But a enum is uncessary if its just two states
thats literally what im saying
Tags are finite..
cuz he has 2 states
components are not
parriable and unparriable
Yeah i agree i was just trying make a joke
dw i gotchu-HOLY FUCK its 2 am
you should look into enums tho. you'll probably want to use them somewhere down the road
okay
i get how they work now
nice π
it does remind me of tags
pretty much yea
its tags but better
Well thru the madness we learned something new!
i use the shit out of them for my settings menu
gotta stay an agent of chaos, always lol
Quality Settings etc
Yeah lol sorry if i seemed rude earlier everyone
everyone was losing their shit a bit
but when you dont know how many types you'll have, and the max value can change, then yea
hell, if you're apologizing, tf am i meant to say
(β―Β°β‘Β°)β―οΈ΅ β»ββ»
do I just go to hell now? xd
then just... add the type to the enum
Lets not π
no no, that's sad
even if it doesn't change at runtime - it's still sad π
but why would you add a type at runtime
u wouldn't π€«
His requirements are different and i think weve got it solved maybe?
If you use enum flags you can add tags at runtime.
im thinking something that goes like this:
Player parent has invisible hitbox -> onTriggerEnter2d adds those gameObjects to as list, and exit removes them (if no longer in parryable distance) -> if player presses the button to parry every gameobject in the list would get flipped rotation and speed
enums that grow indefinitely just shouldn't be enums
whats an enum flag?
one that's a power of 2
gracias
Oh so just normal enums lmao
yea haha
I thought that would be different for some reason
basically if you used layer masks you've used enum flags
i see what u did ther
No itβs a bitmap.
enums are...
You can have multiple tags in one variable.
its an Enum Mask heh
Thats not a unity specific thing
more like
Player is the parent of an invisible hitbox
Each projectile has a "Parriable" bool on them
When the player parries, the invisible hitbox gets activated
If "Parriable" is true, and they collide with the "Parry" hitbox, then reverse their speed and whatever
every day i read terms i dont understand on here and then see its still just the beginner chat for coding. A humbling experience
The attribute i see i see
you can do stuff like check if a weapon is a enum type of Fire, Sword, TwoHanded, Physical in one operation with enum flags
When u look back itll be super cool tho
No, no. You should create a class for each and have 10 layers of inheritance.
Keep in mind some of the people here have been coding 5 to 10+ years
They didnt learn this stuff over night
thing is about
When the player parries, the invisible hitbox gets activated
id want the player only be able to play the parry animation when there is a parryable projectile within parryable distance, so i think the way i check for parryable objects work better in my situation..?
im 2 years deep and haven't left beginner
Started Senior year and im 21 now and i still have no fucking idea what these guys are talking about half of the time
When did it was to make this folder in Unity Learn?
40 - 50 days into making my first game
Thats good tho
Most ppl dont last that long
id say if u stayed over a month ur pretty much set
it takes 6 weeks to fully develop a habit
i have dabbled in making games before that, they were school projects
they were more surviving than learning
can u rephrase ur question?
having trouble understanding what you meant
so officially started 40 to 50 days ago, otherwise i have done some very minor things
before u know it youre hub will look like this
Today was...interesting to say the least
I regulary delete my stuff but it does add up lol
I fluctuate. For example, I finished a river generation algorithm which anyone who ever tried knows how complex they are, yet I just learnt today that arrays have "lenght" instead of "count" because they're fixed size, and not just because c# devs at microsoft felt like using lenght.
Unity takes up like 100 gigs of my hard drive
i think if ur learning the more variety u can explore the better off u'll be
ye its fun, but can be overwhelming sometimes, like my game is just a simple 2d arcade style game, stuff will spawn out of all sides and u have to dodge them, and u get a score based on how hard the things were to dodge, and u just have to try to get a high score. But even then like... its still a bunhc of coding, but thats fine, but then there is sound effects.. music... graphics/sprites... literally no clue how id get over that part
Its only overwhelming if u try to learn everything at once
Only focus on the stuff you need to know
And get good at that
remember when u go to publish.. the last 10% takes about 90% of the time you spend on the game
IKR lmao. I didnt know the difference either until you asked
or it should, to get all that juice and stuff worked out
ye i thought about that today π
ill have to edit a tutorial vid, make a scene for it so i have trhew right set up for it
Were getting side tracked tho
then like if i wanna publish it on steam its 100 bucks
Did u figure out ur parry code?
Could you ask that again?
You want to know how to choose the folder?
he ignored me probably you too.. i think he figured it out
id say yea
I really didn't get the question
Thats good!
Sorry for being like that were just not supposed to the flood the channel with none code related stuff
internal GameObject afterImageGO; how can I set this so it has a reference
i have this but it isn't enough
I tried new gameobject
but says its incorrect
Would u mind sharing the whole class?
i already did
I can send this relevant screenshot
the problem is where I set the afterImageObjects[i].afterImageGO = afterImageObject
it says object reference not set
because afterImageObjects is a type of AfterImageObject , not a GameObject
thats why I have .afterImageGO
which is a GameObject
no?
ohh i didnt see that in that Little snippet
Yeah hes accessing the property
Share the error code
its no longer initializing any objects
What object does it say isnt set?
its a runtime error
i know could i see it please?
this is all I get
Thats why i asked to see the whole class
if (afterImageObjects[i].objectID == index && afterImageObjects[i].afterImageGO.activeInHierarchy)
Its easier to debug when we can see the whole thing
line 73
Just share the whole thing?
hold up
!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.
yes i knw
you need to initialize afterImageObjects[i]
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
it is not
classes are types
i meant object
A class IS a type. And classes /objects are null until initialized
Omg i just realized
Classes are objects btw (c# object)
its a one of these
again?
yes?
Is the for loop needed inside of the foreach?
again, having a variable or space for it doesn't mean it has value
What?
yeah
cuz I need x of each object
did i mess that part up again
Hey! I'm just learning how to use SO's as an event container, but I'm wondering if I could get some feedback on optimizating or any major errors I'm making with the system. I'm currently running into the problem of each of the event reoccuring when the player does an action that calls them. I tried to flag it so that It could only be called once, but It's pretty ineffective and I realize that I'm doing it wrong. Additionally I don't really think I'm utilizing the Enum to handle the progression?
Oh, I dunno.
I just saw you said it can't be initialized, but it can and needs to be
thats why i didafterImageObjects = new AfterImageObject[_afterImageCount * _objectsToBeAfterImaged.Length];
and then set the values
that creates the array, now it's filled with nulls
you can't set the objectID of a null
so, you need to init each item to a new AfterImageSomething()
Here's a video on the system at work at the moment (Apologies for the mic buzz)
(honestly I would mute it and just skip through)
sorry how do i do that
Also i dont think u ever set
cuz I feel like ill have a conniption
_objectsToBeAfterImaged
cuz shit like that happened way too often
its serialized
Oh i see
Then im also certain you dont need a for loop inside of a foreach
before you set the ID and the other thing, you just do whatever[i] = new TheClassName();
8*70 gameobjects in total (+1 from the character itself)
I do.
I have a list of objects
in my case
I have 7 objects
If u want the index just have a outside int variable you increment at the end of the loop
and I need 70 copies of each object
Oh i see
Looking for Advice!
thats kinda messing me up
but I got it
Could you explain better your problem?
By better I mean re-phrase it
if (afterImageObjects[i].objectID == index && afterImageObjects[i].afterImageGO.activeInHierarchy) is line 74
the only object that it means can only be afterImageObjects[i].afterImageGO
but how
ah, you're doing this check before you crate them, no?
after
I create them in start
fuck im tired
and I check them in update
tho like
is it a problem that I activate and deactivate the script
to make it work?
not sure what you mean by that
mm, that should be fine
i have this whole update thing
yeah
so i dont get
how its not serialized
it shouldnt lose its value because it was disabled
what's the first error that you get?
object reference not set
so figure otu what is null in that line
how?
well the only thing that can be null is the gameobject
but how
there u go
well the array element could be null to
i cant initialize it 10 fucking times
chances are something destroyed the gameobject after the list was created
how
AfterImageObject.SetActive(false)?
that doesn't destroy it?
You set the gameobjects to false when u put them in the array
thought you were pooling?
yes.
thats why im saying that it cant be destroyed
right
cuz its not that type of pooling
and im not rewriting all of it again
what?
by other means
it gets activated when I dash
!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.
not every frame
Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. Like the Awake function, Start is called exactly once in the lifetime of the script. However, Awake is called when the script object is initialised, regardless of whether or not the script is enabled.
Try moving ur logic into OnEnable()
So here is my problem: my invoke does not work, it just does not activate the RemoveNotifier() method, any help would be appreciated :)
https://hatebin.com/ntaewnomzy
thatd break EVERYTHING
because the script gets enabled multiple times
Ctrl + z then
itd try to initialize more and more
i dont want to crash my pc
and I said it before
I was thinking maybe the array got cleared when u disable it
it instantiates the object
how
that has to be my guess too
but how
It was just a thought i could be wrong
you just have to add logging and track why it goes null
chances are some other system nuked the object or you are not referencing what you think you are
I would turn the first two methods into coroutines and use WaitForSeconds
But, do you destroy that class? That could be why the invoke doesn't work
the SavingNotifier.SetActive(false); starts like this, and I have tried the coroutines method, and the same result popped out, nothing
i already have logging
but it doesnt even get triggered
Ok, well if it is destroyed, that could cause coroutines to not work as well, which is why I asked about it
yeah its not it
@languid timber You can put a debug.log in OnDestroy to make sure
straight up doesnt give a fuck
Who? what?
does this look destroyed
You define a variable called index twice as well?
they're all there
Wasn't talking to you
i changed it
oh sorry
Send the current code please just to be share
and how do we do that? I am really bad at coding
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
of course
OnDestroy()
{
Debug.Log()
}
you are not setting nothing on afterimageobject[i]
thank you
oh wait the new one, you fixed that
https://cdn.discordapp.com/attachments/763495187787677697/1211106170107076698/image.png?ex=65ecfd84&is=65da8884&hm=621b68dc74dd09335b4f62006ba79e4081fc70ee15c03ec686fdee2875111fcd&
https://cdn.discordapp.com/attachments/763495187787677697/1211106177505562664/image.png?ex=65ecfd85&is=65da8885&hm=6d333289bf58d0b9bf9f4f7f8550b8417aca65d12fc5896d43772a499efb58ca&
https://cdn.discordapp.com/attachments/763495187787677697/1211106479034073198/image.png?ex=65ecfdcd&is=65da88cd&hm=fdea2b79bd8ff359cd8e159675aca7df7cbc871934e5a068bbafdc72bcf9f9b7&
I have a camera focussed on only the red box but ReadPixels() keeps returning a screenshot of the entire screen rather than just the bounds of the camera. How would I make it only capture the camera's view?
You would put something IN the debug.log
Not like flawless did it. They were just giving an example
You should look at the docs for the method
of course
I will thanks! after I am done with that I will come back if It is not clear for me yet
settle down, check objectID
objectID is an int??
oh thought it was string
Can you get a reference to a object that isnt active?
also are those messages from the same instance
Because you set the gameobjects to inactive then add them to the array
Ok tripple 6 ?
Making a joke
all of them are 6
after reviewing with the OnDestroy (if I even did it correct)
could not see it bieng destroyed in the log after interacting with the saving button, so that could not be it?
https://hatebin.com/ztbocolytg
Hate to throw this into the mix but this is the kind of thing my copy function would look like https://gdl.space/avudupifuz.cs
Ok, well good to know.
Are you sure the other methods are being called in the first place?
Like GameSaved() ?
yes the wait a sec or hold a sec log does get called, it is just that the invoke does not work (give it a sec log XD, forgot my own code)
@queen adder is smth wrong with my index counting thing?
it looks like this, the save/load button on the left bottom corner trigger the methods
the game saved that is so big in the screen is being called by the methods you asked about
Don't trigger the voids! You're gonna doom us all!
I have no idea tbh
It looks like it should work
I have corrected it for you haha
How about u trying set it inactive after u add it to the array
Thats a cool looking pause menu
And if only objects with an ID of 6 are getting spawned in then yes there is probably something wrong with the indexing
i made it into a for loop
thank you! my own pixel art :)
lighter text?
orange text with brown is kinda offputting
if anything Darker for green but Load is a bit odd color. I would use another
I have no fucking clue what the issue is
it must be here at this point
i debugged everything else
and the I have to go into photoshop and also edit the floppy disk itself, because it uses the same colors
thank you for the feedback! I will add it to my scrum :D
ther is a cool website were you can see palettes / and their respective complimentary colors
I think Adobe also has one
edit :
this one
https://color.adobe.com/create/color-wheel
its up there
well its not tossing exceptions for no reason, so something on that line is null
before the error
holy smokes thats insanely advanced
I should just make a color pallete myself in photoshop to keep a consistant style
but thats off the charts for now, my invoke does still not work XD
Try checking if its actually null instead
what?
just kinda tuned in now, can you give me the TLDR of your issue
TLDR? I am really bad at shortages of words
"too long didn't read"
and it worked
i do it now
it doesnt work
ive done object pooling before
and it started working really fast
aha I see! well.. my invoke does not get activated or at least does not trigger my RemoveNotifier() Method
isnt it meant to be "_RemoveNotifier" perhaps?
could check, will check
and nope, does not change anything
Nah, the method doesn't have an underscore
yea just made sure its not smth like that
Oh, Invoke uses reflection, so it needs the exact method name, character for character
Ohhh
that type of invoke..
One of the reasons I hate it hahaha
I did not know it uses reflection
yes strings = reflection
not this one?
That should be fucking obvious in hind sight
reflection?
if u want to know if a CLASS has a specific function name or properties u do that via reflection
I did use that before, but I was like nahh
huh
5D chess level, use Coroutines π€
Sorry meant to say class
They said they did use coroutines too, but that it didn't work
ahh ok
no thanks
You can get information about a class at runtime via reflection
yea i got it
BUT, i'd like to see how they did the coroutine
could yeah, but if the long way has the same result als the short way its not worth going for in my believes
also are you certain the script is running ?
correct
how does the scripts methods get called?
does he need the System.Reflection namespace
No, UnityEngine covers it for Invoke
should I send the coroutine version?
good then
Sure, may be informative
Reflection is not something they have to worry about, its just how unity on its end is calling a method from a string name
will type it again (did not comment it out so, eheh)
i wanna listen to celeste ost now
but also i tend to avoid invoke because of this, or at the very least use nameof
turns out the functions that are meant to call the function dont even get called
imagine
Funception
btw not sure if you answered this but is Debug.Log("give it a sec"); running / printing ?
but for invoke to work for delaying something, function name must be exact, and the object you ran invoke from must remain alive and active the whole time
indeed , make sure this object the script is on isnt destroyed/disabled
I had them debug in OnDestroy and it never got called. But I didn't have them check OnDisable
nope, and I did a while back, but it is easily missed
ahh that might be something to look into then
that means ur method to call invoke isnt called, then the invoke wont work π
so ur issue comes from higher up
Noo nnoo wait
it does
it does
XD
oh ok
I was talking in my head about the one after the Invoke
but this is the new system
"new"
nothing is wrong with the syntax at least
this one also needs logs after StartCoroutine
just incase
also does anything disable your GameSavingNote object
or destroy it
since that would kill the coroutine as well
yeah ur right indeed
what id guess the problem is maybe
Can I get like a reference of one of the custom parameters of a custom ShaderGraph?
is that the RemoveNotifier is after the Invoke

