#πŸ’»β”ƒcode-beginner

1 messages Β· Page 222 of 1

rich adder
#
public int someNumber // this is syntax error
public float anotherOne;```
rocky canyon
#

put ur foot down! (β•―Β°β–‘Β°)β•―οΈ΅ ┻━┻

summer stump
#

Ok, now type transform. into start

With the dot

quick pollen
#

wdym

#

oh

#

sorry

#

nvm

queen adder
#

so since you guys didnt reply Im thinking it was cool right?

quick pollen
#

okay so

#

the thing is

#

I don't know what types I'll have

quick pollen
#

I basically want to create new types

quick pollen
#

as I go

rich adder
rocky canyon
#

you can add to the enums as you go

quick pollen
rich adder
#

if you have too many, use Scriptable objects

quick pollen
#

read what I said

rocky canyon
#

we read it

rich adder
#

new types?

quick pollen
#
enum Level 
{
  Low,
  Medium,
  High
}```
#

this is a declaration for an enum

#

yea?

rich adder
#

yes

quick pollen
#

I don't know what to put between the brackets

rocky canyon
#

you can name em ANYTHING u want

rich adder
quick pollen
rocky canyon
#

sounds like a design issue

rich adder
#

but human legible

queen adder
#

soooo it is cool right?

quick pollen
summer stump
quick pollen
#

I want to be able to create afterimages for any object

#

not just one

summer stump
rich adder
queen adder
#

can it get any cleaner?

rocky canyon
#

then ur good πŸ‘

rich adder
rocky canyon
#

probably..

rich adder
#

dont worry about that now

queen adder
rich adder
#

@queen adder as long as YOU can read it, thats all it matters

quick pollen
#

This is what it looks like
Every "Object to be After Imaged" needs to be a type

rocky canyon
queen adder
#

Omg

#

enum Types {Belt, Sword, Shield, Legplate,etc}

queen adder
#

which lines

#

You can just add on to the enum later

summer stump
queen adder
#

You can modify the enum at anytime

quick pollen
rocky canyon
queen adder
rocky canyon
#

even using => like every chance u get

#

πŸ˜„

rich adder
quick pollen
queen adder
#

A scriptable object with a enum instance is a fantastic idea

quick pollen
#

i dont think scriptableobject is needed cuz i wont have too many

rich adder
#

but you havent hit that point though

#

so enum would be fine

quick pollen
#

ill just use classes I think

queen adder
#

Your game could 100% benefit from scriptable objects if u have a inventory system

quick pollen
#

cuz i dont know how many types I'll have

queen adder
#

A scriptable object is a class

quick pollen
#

I'll use scriptable objects when I need to do stuff like settings

#

because their data can be carried over scenes

summer stump
queen adder
rocky canyon
#

really u should be learning how to use DDOL objects by then

queen adder
#

Thats EXACTLY why you should use them??

summer stump
#

You want them to be immutable mostly

quick pollen
rocky canyon
#

and have multiple scenes running at once..

quick pollen
rocky canyon
#

with one scene having all ur data that carries over

quick pollen
#

I said "stuff like"

summer stump
quick pollen
#

we kinda strafed off the main topic of this

queen adder
#

You can just check what the enum type is on the scriptable object thats attached to the gameobject

quick pollen
#

I'm not as knowledgable in Unity as you guys

queen adder
#

Thats why were trying to help u πŸ™‚

rich adder
quick pollen
#

thats the issue

#

I'm just getting dragged into other things

queen adder
#

If its a new topic to u ofc ur going to be confused

quick pollen
#

and I spend more time discussing the issue than solving it

summer stump
queen adder
#

But ur not even trying our ideas or to learn stuff

queen adder
quick summit
quick pollen
quick pollen
summer stump
queen adder
#

Try and learn some of the stuff were saying tho

#

Even if its a little bit a time

rocky canyon
#

thats how it functions..

unreal imp
#

you deserve a freind πŸ‘

quick summit
#

is it possbile to show the dropdown list for the one before the dot? like in this pic

summer stump
#

And lowercase g

quick summit
queen adder
#

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?

rocky canyon
#

if it has multiple possibilities with the same characters u starting typing they'll show

summer stump
rich adder
rich adder
quick pollen
#

and I can't just learn them instantly

rich adder
quick pollen
#

I can learn fast, sure

#

but not THAT fast

queen adder
#

I feel u

#

But you should step away and learn the topics

quick pollen
#

tho I do understand how enums would work

#

and where I could use them

rocky canyon
#
  • Enums
  • DontDestroyOnLoad
  • AdditiveScenes
quick pollen
#

i actually just thought of a system I could enhance

queen adder
#

Coding is about problem solving. You dont know the tools ur using and ur trying to build a house

rocky canyon
quick pollen
queen adder
#

Learn ur tools first!!

quick pollen
rocky canyon
#

uset the object to be one of the presets then a switch statement asks 'what preset u using'

#

ohh, then do this

quick pollen
summer stump
quick pollen
#

Its hard for me to learn by just reading the documentation

quick pollen
#

i dont even have multiple scenes

summer stump
quick pollen
#

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

queen adder
#

If its an enum on a SO i think thats fine personally

#

Well i guess just a MB is fine to

rocky canyon
#

ya, but our point is not to use SO's to transfer data between scenes

#

sillyness

summer stump
#

SOs are kinda like prefabs. File assets used to give you variants. But they are for data

quick pollen
#

now how can I iterate through my list of afterImages

#

is what my issue is

rocky canyon
#

for loop

quick pollen
rocky canyon
#

foreach loop

quick summit
#

i found the problem guys, i might have put it on inline accidently before according to a tutorial xd

rocky canyon
#

it doesnt matter

quick summit
#

thanks all

rocky canyon
#

u have to loop thru it in order..

queen adder
#

You do need to see what each object is in that list?

rocky canyon
#

and then do what u need to witht he ones u need

summer stump
quick pollen
rocky canyon
#

ya but u cant selectively use parts of alist w/o knowing their specific index

#

a for loop is almost always needed

quick pollen
#

I would kinda need a stack

rocky canyon
#

i mean.. if u can idk how

quick pollen
#

or an array of arrays

rocky canyon
#

list of lists

quick pollen
#

yeah list of lists

rocky canyon
#

frog on a log from the bottom of the sea

summer stump
#

Or just nested for loops

queen adder
#

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

quick pollen
rocky canyon
quick pollen
#

omg

#

its so hard to explain like this

#

what I want to do

#

is take a character

#

take all of its equipment

rocky canyon
#

dont explain it in 1 word lines plz

rich adder
#

if you cant explain it will be hard to solve πŸ™‚

queen adder
#

Oh i guess that makes sense

rich adder
#

try rubber duck debugging and come back

quick pollen
rocky canyon
#

this guy ^ πŸ™„

quick pollen
queen adder
#

U need to make a enum bro

rich adder
queen adder
#

try some code and get back to us

quick pollen
#

the part with creating the arrays and the afterimage clones works perfetly

queen adder
#

This a circular conversation at this point

quick pollen
queen adder
#

Bro you havent tried anything weve suggested

quick pollen
#

the types in an enum need to be pre-declared

rich adder
quick pollen
#

u cant declare new ones at runtime

#

can you

queen adder
#

No u cant

quick pollen
#

thats my point

queen adder
#

But u wont being make new types at runtime

rocky canyon
#

runtime was a keyword u shoulda used on the first lap of this convo

rich adder
queen adder
#

U already have a set of types u need

#

A sword a shield etc

rich adder
#

you should be asking yourself those things

quick pollen
#

ok im exiting this convo

queen adder
#

Your not making a a new thing at runtime

quick pollen
#

i know yall want to help

#

but at this point its getting more and more chaotic

queen adder
#

Alright lol

rich adder
#

again, if you can't explain it you wont be able to solve it.

quick pollen
#

thanks for the help overall

summer stump
#

Enum is the standard for this for sure

rich adder
#

Figure out how to put your problems into words, you might solve it yourself

quick pollen
queen adder
#

U havent tried it but ok

summer stump
quick pollen
#

i just asked how to do smth and u said u cant

queen adder
#

How do u KNOW that

summer stump
#

You don't need to create them at runtime. It WOULD work

quick pollen
#

so what are we talking about

rocky canyon
quick pollen
rocky canyon
#

called it a while ago

queen adder
#

Alright

rich adder
#

yes approaching design without knowing the tools available is never good

rocky canyon
#

u shouldnt need to be creating types at runtime..

#

are u creating AI

quick pollen
#

no

#

I already explained whatI want

rocky canyon
#

then ur overcomplicating it

quick pollen
#

I can't explain it 10x more

rocky canyon
#

u need to divide

#

not multiply

summer stump
#

There is absolutely no reason to create enums at runtime for what you explained
You explained why you don't need them 10x

queen adder
#

Figure out how many types ur game will have

#

Do that first

rocky canyon
#

you said u know we're trying tohelp..

#

we're trying to get u to do something that makes sense

quick pollen
rocky canyon
#

ur going down the wrong road

quick pollen
#

I don't want to go in and write new code

#

for every single thing that needs to be afterimaged

queen adder
#

You can change the ENUM types at ANYTIME

#

Before compiling

nocturne parcel
north kiln
#

Stop with the caps please.

rich adder
quick pollen
queen adder
#

sorry

#

Thats not something for us to figure out

nocturne parcel
rich adder
rocky canyon
nocturne parcel
#

Any afterimageble object just inherits from the interface

quick pollen
#

I don't want to write new code for each one

rich adder
#

thats where you start

quick pollen
nocturne parcel
#

Then you make a generic function that accepts IAfterImage

#

and done

quick pollen
#

I wanted it to be flexible

#

and easily expandable

rich adder
quick pollen
north kiln
#

Can someone link me to the actual question

nocturne parcel
#

Yeah, i'd like to know too

queen adder
#

Alfy whats ur question

rich adder
#

they can be unlimited as you say without changing any base code

nocturne parcel
#

I'm not a native english speaker, what is an after image again?

queen adder
#

Humble start

rich adder
quick pollen
nocturne parcel
#

Yeah, i get it

quick pollen
#

basically the neon colored things

nocturne parcel
#

So, what is it not working?

queen adder
#

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

rocky canyon
rich adder
#

exactly why does it matter what specific thing is

quick pollen
#

I can't put the sword on the leg

north kiln
# quick pollen https://discord.com/channels/489222168727519232/497874004401586176/1211084412935...

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

queen adder
#

The enum would have those generic types predefined and you would use the more generic version of that thing to fill the slot

rocky canyon
rich adder
#

bunch of people saying enum, OP is not convinced lol

floral kettle
#

guys i fixed my problem, it was only 2 parameters

queen adder
#

NICE^^

#

Happy for ombudsman

summer stump
rich adder
quick pollen
floral kettle
nocturne parcel
queen adder
#

Wait what

#

U just want to spawn a copy of the player?

quick pollen
#

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

rich adder
#

a scriptable object tbh with all the parts you want for each char..

quick pollen
#

without having to rewrite scripts

queen adder
#

If u want a really dirty way of doing this

pallid nymph
#

are the objects you wanna copy in one hieararchy?

queen adder
#

Well actually no thats to dirty

quick pollen
rocky canyon
#

he wants ALL the expandability and scaleability, with the codebase that he doesn't want to re-write

pallid nymph
#

under one root?

north kiln
#

I'm confused what you mean by state, and why you need to copy state if it's just a visual effect

queen adder
#

I wasnt going to say instantiate lol

quick pollen
rich adder
#

store it in poco? or SO

rocky canyon
#

im here for the big reveal of what the actual issue is.. and think vertx if anyone can get to the bottom of it

north kiln
#

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

rich adder
#

true. although I agree that its not 100% clear what they want do with those pieces

queen adder
#

Youve got to be more specific

quick pollen
#

sword

#

shield

#

whatever

north kiln
#

Yes, and why do you need that information at all if it's just visual

quick pollen
#

did you check the video

north kiln
#

Yes

nocturne parcel
#

For what I understand, he wants to position the after image in the right place. So the sword in the sword hand.

quick pollen
#

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

north kiln
#

and again, why does it matter if something is a sword or a shield

quick pollen
#

an afterimage shield goes to where the shield is

#

etc

north kiln
#

it's just a meshfilter and a meshrenderer, or a skinnedmeshrenderer

quick pollen
north kiln
#

why would that ever happen

queen adder
#

Whats wrong with just spawning whatever the item is?

pallid nymph
rich adder
#

just store the positions and rotations?

quick pollen
north kiln
#

Just loop over the transform hierarchy of the thing you want to copy, spawn the same transforms and copy the renderers

nocturne parcel
#

if you just use the current position, that would never happens, no? I could be wrong

quick pollen
rocky canyon
#

he already spawns everything where it should be i think

quick pollen
#

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

north kiln
#

Why do you need to know

quick pollen
queen adder
#

Oh god

#

Here we go again

rocky canyon
#

πŸ˜… we're on circuit 2

quick pollen
#

literally

rocky canyon
#

he doesnt have an answer

queen adder
#

You just need to spawn it where its at

north kiln
#

You are making a copy. If I want to retype what you said I don't need to know what words you used

nocturne parcel
#

Those objects don't have transforms?

north kiln
#

I just need to loop over the letters

rocky canyon
#

please indulge..

rich adder
north kiln
#

Or please don't lol

rich adder
#

so much for no caps

quick pollen
quick pollen
#

basically

#

I have 10 a's, 10 b's, etc

rich adder
#

Why does it matter which letter? a letter is a letter..

quick pollen
#

and then I have to recreate a word

north kiln
#

Why, you have the original object, why don't you know what you have

pallid nymph
#

aren't you already doing that in the video?

quick pollen
#

I instantiate and destroy 100+ objects every second

pallid nymph
#

ah, lovely, now I understand

rocky canyon
#

holy crap

quick pollen
#

thats why I want to have an object pool

#

of the different afterimage objects

rocky canyon
#

im confused why u destroy and instantiate.. and not just disable renderer and reposition

quick pollen
north kiln
#

You can do all this without knowing what type of object you have

rocky canyon
#

☝️ i think u just thoroughly confused tf outta everyone involved edit: u as in him

quick pollen
north kiln
#

The only 4 things that matter are: Transform, MeshFilter, MeshRenderer, and SkinnedMeshRenderer

north kiln
#

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

quick pollen
#

but I don't want the Mesh of the Sword to be where the Mesh of the Shield is

nocturne parcel
#

Why would that ever happens

quick pollen
#

because thats fucking stupid

queen adder
#

What gameobject controls the sword?

north kiln
#

and just like me copying your sentence, that would never happen

pallid nymph
#

πŸ˜„

nocturne parcel
#

That's what we are trying to tell you

pallid nymph
#

so, you have separate pools per object type

summer stump
rich adder
#

they just said how, copy those components

quick pollen
pallid nymph
#

and that begs the question what's the "key" for each pool

north kiln
#

because you are copying something that already exists, why would a copy mix it up?

#

just iterate over it, and duplicate what you see

quick pollen
#

I'm not copying it in runtime

#

I copy it at Start()

queen adder
#

You just spawn it where it currently is

rocky canyon
#

i think his setup doesn't allow the ease of what we're suggesting.. thats my guess

queen adder
#

It should tho

#

He has a list of gameobjects, just spawn them where they are at

quick pollen
#

i can show the whole script

#

its been sent

pallid nymph
#

send again please

quick pollen
pallid nymph
#

so, AfterImageObject is a nuh-uh

north kiln
#

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

scarlet skiff
#

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?

pallid nymph
#

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

pallid nymph
#

and then it's easy, because you request an object that matches your type, so you just need to apply transform stuff

scarlet skiff
queen adder
#

And when OnColllisionEnter is called check to see if the collision has inhereted the interface

quick pollen
#

what if I do something like this

scarlet skiff
#

sorry i dont understand the " inhereted the interface" part

queen adder
nocturne parcel
#

why not just a parriable bool

scarlet skiff
#

not sure exactly how an interface would look like here

queen adder
#

Uh if u dont understand interfaces you could just check a tag of the gameobjects collider

nocturne parcel
#

I would just have a parriable bool. Then, when attacking, the parriable attack would set the bool to true.

queen adder
#

The tag could just be Parryable

quick pollen
nocturne parcel
queen adder
#

You couldnt do a bool parrayable because each enemy class would be different

pallid nymph
#

(Make a Parryable component πŸ˜› )

queen adder
#

Interface

rocky canyon
#

if the enemy class wasnt parryable u wouldnt inherit

pallid nymph
#

component πŸ˜›

rocky canyon
#

therefor not need a bool

queen adder
#

Then each gameobject has a extra component on it

rocky canyon
#

but yea u could also quickly check for a component such as Parryable

nocturne parcel
#

An empty interface just for a check seems like a code smell to me

rocky canyon
queen adder
#

yeah thats true lmao

#

Actually scrap the interface idea.

scarlet skiff
#

so a script deticated to handling parrying?

pallid nymph
#

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

scarlet skiff
#

is that what u mean by a parriyable component

rich adder
#

a script on a gameobject is a component

queen adder
#

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

rocky canyon
#

one sec

rich adder
queen adder
#

Hahaha

quick pollen
rocky canyon
pallid nymph
rich adder
scarlet skiff
queen adder
#

Alfy share ur parry code

#

Help my mans outthinksmart

quick pollen
#

most of it is handled through animation events

scarlet skiff
#

my game is in 2d

quick pollen
#
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

queen adder
#

Thats how i would go about it tbh

quick pollen
#

if its in 2D, you can either check which sprite it's on

queen adder
#

The animation events specifically

quick pollen
#

or stuff like that

quick pollen
queen adder
quick pollen
#

do u have an animator @scarlet skiff

scarlet skiff
#

and u just have a method or something in the parried object that reverses their direction if they collide with the shield?

queen adder
#

But for u obada just check what component the Collider has

scarlet skiff
nocturne parcel
quick pollen
queen adder
#

And go from there

quick pollen
#

if it collides with an object that has the "shieldHitbox" tag

#

it gets the velocity reversed

#

and the color inverted

scarlet skiff
queen adder
#

Pretty cool pretty cool

scarlet skiff
#

so same thing πŸ™‚

queen adder
#

Yup

rocky canyon
#

i too advocate marker components

#

DogTag being a player

quick pollen
quick pollen
#

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

nocturne parcel
quick pollen
#

you can just flip the gameobject

low path
#

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.

quick pollen
#

and it works perfectly

quick pollen
low path
#

That way it’s just one component, plus Unity serialized enum flags and has a built in inspector.

quick pollen
#

u dont need enums for this

rocky canyon
quick pollen
#

sure it can help

#

but there's no point if its just a singleton

rocky canyon
queen adder
#

Alfy u have the biggest beef with enums lol Im joking

nocturne parcel
quick pollen
queen adder
#

But a enum is uncessary if its just two states

quick pollen
rocky canyon
#

Tags are finite..

quick pollen
#

cuz he has 2 states

rocky canyon
#

components are not

quick pollen
#

parriable and unparriable

queen adder
#

Yeah i agree i was just trying make a joke

quick pollen
#

dw i gotchu-HOLY FUCK its 2 am

rocky canyon
#

you should look into enums tho. you'll probably want to use them somewhere down the road

quick pollen
#

okay

rocky canyon
#

nice πŸ‘

quick pollen
#

it does remind me of tags

rocky canyon
#

pretty much yea

rich adder
#

its tags but better

queen adder
#

Well thru the madness we learned something new!

quick pollen
#

but kinda like tags with functionalities

#

yea

rocky canyon
#

i use the shit out of them for my settings menu

quick pollen
rocky canyon
#

Quality Settings etc

quick pollen
#

ofc

#

i get that

#

for things like that it goes

queen adder
#

Yeah lol sorry if i seemed rude earlier everyone

rocky canyon
#

everyone was losing their shit a bit

quick pollen
#

but when you dont know how many types you'll have, and the max value can change, then yea

quick pollen
rocky canyon
#

(β•―Β°β–‘Β°)β•―οΈ΅ ┻━┻

quick pollen
#

do I just go to hell now? xd

nocturne parcel
#

then just... add the type to the enum

queen adder
#

Lets not πŸ™‚

rocky canyon
#

^ he means at runtime

#

lap 3

pallid nymph
#

even if it doesn't change at runtime - it's still sad πŸ™‚

nocturne parcel
#

but why would you add a type at runtime

rocky canyon
#

u wouldn't 🀫

queen adder
#

His requirements are different and i think weve got it solved maybe?

low path
#

If you use enum flags you can add tags at runtime.

scarlet skiff
#

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

pallid nymph
#

enums that grow indefinitely just shouldn't be enums

rocky canyon
#

whats an enum flag?

pallid nymph
#

one that's a power of 2

low path
quick pollen
rocky canyon
queen adder
#

Oh so just normal enums lmao

rocky canyon
#

yea haha

queen adder
#

I thought that would be different for some reason

timber tide
#

basically if you used layer masks you've used enum flags

rocky canyon
#

i see what u did ther

low path
#

No it’s a bitmap.

queen adder
#

enums are...

low path
#

You can have multiple tags in one variable.

queen adder
#

Nevermind

#

You can do that normally

rocky canyon
#

its an Enum Mask heh

queen adder
#

Thats not a unity specific thing

quick pollen
scarlet skiff
#

every day i read terms i dont understand on here and then see its still just the beginner chat for coding. A humbling experience

queen adder
#

The attribute i see i see

timber tide
#

you can do stuff like check if a weapon is a enum type of Fire, Sword, TwoHanded, Physical in one operation with enum flags

queen adder
#

When u look back itll be super cool tho

nocturne parcel
#

No, no. You should create a class for each and have 10 layers of inheritance.

queen adder
#

Keep in mind some of the people here have been coding 5 to 10+ years

#

They didnt learn this stuff over night

scarlet skiff
rocky canyon
#

im 2 years deep and haven't left beginner

queen adder
#

Same

#

Lmao

scarlet skiff
#

dam

#

im like

queen adder
#

Started Senior year and im 21 now and i still have no fucking idea what these guys are talking about half of the time

grim pecan
#

When did it was to make this folder in Unity Learn?

scarlet skiff
#

40 - 50 days into making my first game

queen adder
#

Thats good tho

#

Most ppl dont last that long

#

id say if u stayed over a month ur pretty much set

rocky canyon
#

it takes 6 weeks to fully develop a habit

scarlet skiff
#

i have dabbled in making games before that, they were school projects

#

they were more surviving than learning

rocky canyon
#

having trouble understanding what you meant

scarlet skiff
#

so officially started 40 to 50 days ago, otherwise i have done some very minor things

rocky canyon
queen adder
#

Today was...interesting to say the least

#

I regulary delete my stuff but it does add up lol

nocturne parcel
#

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.

queen adder
#

Unity takes up like 100 gigs of my hard drive

rocky canyon
#

i think if ur learning the more variety u can explore the better off u'll be

scarlet skiff
# queen adder id say if u stayed over a month ur pretty much set

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

queen adder
#

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

rocky canyon
queen adder
rocky canyon
#

or it should, to get all that juice and stuff worked out

scarlet skiff
#

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

queen adder
#

Were getting side tracked tho

scarlet skiff
#

then like if i wanna publish it on steam its 100 bucks

queen adder
#

Did u figure out ur parry code?

nocturne parcel
#

You want to know how to choose the folder?

rocky canyon
#

he ignored me probably you too.. i think he figured it out

scarlet skiff
nocturne parcel
#

I really didn't get the question

queen adder
#

Thats good!

#

Sorry for being like that were just not supposed to the flood the channel with none code related stuff

scarlet skiff
#

no no, thats understandable

#

thank u all for ur time

quick pollen
#

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

queen adder
#

Would u mind sharing the whole class?

quick pollen
#

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

rocky canyon
#

because afterImageObjects is a type of AfterImageObject , not a GameObject

quick pollen
#

which is a GameObject

#

no?

rocky canyon
#

ohh i didnt see that in that Little snippet

queen adder
#

Yeah hes accessing the property

rocky canyon
#

ya i see now.. puts on glasses

#

i hate getting old

queen adder
#

Share the error code

quick pollen
#

its no longer initializing any objects

queen adder
#

What object does it say isnt set?

quick pollen
queen adder
#

i know could i see it please?

quick pollen
rocky canyon
#

oh easy NRE

#

whats line 73

queen adder
#

Thats why i asked to see the whole class

quick pollen
#

if (afterImageObjects[i].objectID == index && afterImageObjects[i].afterImageGO.activeInHierarchy)

queen adder
#

Its easier to debug when we can see the whole thing

quick pollen
#

line 73

queen adder
#

Just share the whole thing?

quick pollen
#

hold up

queen adder
#

!code

eternal falconBOT
quick pollen
#

yes i knw

pallid nymph
#

you need to initialize afterImageObjects[i]

quick pollen
quick pollen
#

wait

pallid nymph
#

it is not

quick pollen
#

afterImageObjects cant be initialized

#

its a class

#

not an object

pallid nymph
#

classes are types

quick pollen
#

i meant object

summer stump
queen adder
#

Omg i just realized

summer stump
#

Classes are objects btw (c# object)

rocky canyon
rocky canyon
#

its a one of these

quick pollen
#

again?

pallid nymph
#

yes?

queen adder
#

Is the for loop needed inside of the foreach?

pallid nymph
#

again, having a variable or space for it doesn't mean it has value

summer stump
quick pollen
#

cuz I need x of each object

quick pollen
wispy karma
#

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?

https://codeshare.io/deYZdZ

summer stump
quick pollen
#

and then set the values

pallid nymph
#

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()

wispy karma
#

(honestly I would mute it and just skip through)

quick pollen
queen adder
#

Also i dont think u ever set

quick pollen
#

cuz I feel like ill have a conniption

queen adder
#

_objectsToBeAfterImaged

quick pollen
#

cuz shit like that happened way too often

quick pollen
queen adder
#

Oh i see

quick pollen
queen adder
#

Then im also certain you dont need a for loop inside of a foreach

pallid nymph
#

before you set the ID and the other thing, you just do whatever[i] = new TheClassName();

quick pollen
#

8*70 gameobjects in total (+1 from the character itself)

quick pollen
#

I have a list of objects

#

in my case

#

I have 7 objects

queen adder
#

If u want the index just have a outside int variable you increment at the end of the loop

quick pollen
#

and I need 70 copies of each object

queen adder
#

Oh i see

wispy karma
#

Looking for Advice!

quick pollen
#

but I got it

nocturne parcel
quick pollen
#

ok so it initialized everything

#

but still cant find it

nocturne parcel
#

By better I mean re-phrase it

quick pollen
#

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

pallid nymph
#

ah, you're doing this check before you crate them, no?

quick pollen
#

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?

pallid nymph
#

not sure what you mean by that

quick pollen
#

basically

#

whenever I dash as an example

#

I enable the script

pallid nymph
#

mm, that should be fine

quick pollen
#

i have this whole update thing

#

yeah

#

so i dont get

#

how its not serialized

#

it shouldnt lose its value because it was disabled

pallid nymph
#

what's the first error that you get?

quick pollen
#

object reference not set

pallid nymph
#

the one at the top

#

on which line?

#

double check

quick pollen
pallid nymph
#

save the file πŸ˜›

#

and politely ask Unity to realize it's changed

quick pollen
#

line 73

#

for some reason afterImageObjects[i].afterImageGO is null??

shell sorrel
#

so figure otu what is null in that line

quick pollen
#

how?

quick pollen
#

but how

queen adder
#

there u go

quick pollen
#

I literally initialize it

#

before

shell sorrel
#

well the array element could be null to

quick pollen
#

i cant initialize it 10 fucking times

shell sorrel
#

chances are something destroyed the gameobject after the list was created

quick pollen
#

how

queen adder
#

AfterImageObject.SetActive(false)?

quick pollen
queen adder
#

You set the gameobjects to false when u put them in the array

quick pollen
#

yes

#

but that doesnt destroy them

rich adder
#

thought you were pooling?

quick pollen
#

I turn them off

#

i dont discard them

quick pollen
#

thats why im saying that it cant be destroyed

rich adder
#

right

shell sorrel
#

if pooling why not use the provided tools for it

quick pollen
#

and im not rewriting all of it again

queen adder
#

Also also

#

Line 61
this.enabled = false?

#

How is ur code even getting called notlikethis

quick pollen
quick pollen
#

it gets activated when I dash

languid timber
#

!code

eternal falconBOT
quick pollen
#

not every frame

queen adder
#

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()

languid timber
#

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

quick pollen
#

because the script gets enabled multiple times

queen adder
#

Ctrl + z then

quick pollen
#

itd try to initialize more and more

#

i dont want to crash my pc

#

and I said it before

queen adder
#

I was thinking maybe the array got cleared when u disable it

quick pollen
#

it instantiates the object

quick pollen
#

that has to be my guess too

#

but how

queen adder
#

It was just a thought i could be wrong

shell sorrel
#

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

summer stump
languid timber
quick pollen
#

but it doesnt even get triggered

summer stump
quick pollen
summer stump
#

@languid timber You can put a debug.log in OnDestroy to make sure

quick pollen
#

straight up doesnt give a fuck

queen adder
#

Who? what?

queen adder
#

You define a variable called index twice as well?

quick pollen
#

they're all there

summer stump
quick pollen
quick pollen
queen adder
#

Send the current code please just to be share

languid timber
quick pollen
nocturne parcel
#

of course

supple citrus
nocturne parcel
#

you are not setting nothing on afterimageobject[i]

languid timber
nocturne parcel
#

oh wait the new one, you fixed that

summer stump
#

You should look at the docs for the method

supple citrus
#

of course

languid timber
quick pollen
#

what the FUCK is null then???

shell sorrel
#

settle down, check objectID

quick pollen
#

objectID is an int??

shell sorrel
#

oh thought it was string

queen adder
#

Can you get a reference to a object that isnt active?

shell sorrel
#

also are those messages from the same instance

queen adder
#

Because you set the gameobjects to inactive then add them to the array

quick pollen
#

omg

#

wait

#

it only found the 6th objectIDs

queen adder
#

Ok tripple 6 ?

quick pollen
#

not triple

#

700 logs

queen adder
#

Making a joke

quick pollen
#

all of them are 6

languid timber
#

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

north kiln
quick pollen
#

there are only 6s

#

i dont get it

#

how

summer stump
languid timber
quick pollen
#

@queen adder is smth wrong with my index counting thing?

languid timber
teal viper
#

Don't trigger the voids! You're gonna doom us all!

queen adder
#

It looks like it should work

languid timber
queen adder
#

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

languid timber
rich adder
#

the save / load text could be better colors

#

doesnt pop well

languid timber
rich adder
#

orange text with brown is kinda offputting

quick pollen
#

i give up

#

i just

#

cant

rich adder
quick pollen
#

I have no fucking clue what the issue is

#

it must be here at this point

#

i debugged everything else

languid timber
queen adder
#

Why dont u just check to see whats null?

#

If (afterImageObject[i] == null)

languid timber
rich adder
quick pollen
#

its not null

queen adder
#

Whats the new code lol sorry i keep asking

#

Where are u checking that?

quick pollen
#

its up there

shell sorrel
#

well its not tossing exceptions for no reason, so something on that line is null

quick pollen
languid timber
languid timber
#

but thats off the charts for now, my invoke does still not work XD

queen adder
#

Try checking if its actually null instead

quick pollen
rich adder
languid timber
quick pollen
#

i give up

#

straight up

#

no clue wtf is going on

#

i did this before

rich adder
quick pollen
#

and it worked

#

i do it now

#

it doesnt work

#

ive done object pooling before

#

and it started working really fast

languid timber
quick pollen
#

isnt it meant to be "_RemoveNotifier" perhaps?

languid timber
summer stump
quick pollen
summer stump
summer stump
#

One of the reasons I hate it hahaha

queen adder
#

I did not know it uses reflection

rich adder
#

yes strings = reflection

quick pollen
#

not this one?

queen adder
#

That should be fucking obvious in hind sight

quick pollen
#

reflection?

rich adder
#

slightly more optmizied doing nameof(MethodName)

#

less brittle too

queen adder
#

if u want to know if a CLASS has a specific function name or properties u do that via reflection

languid timber
rich adder
queen adder
#

Sorry meant to say class

summer stump
quick pollen
rich adder
#

ahh ok

quick pollen
#

no thanks

queen adder
#

You can get information about a class at runtime via reflection

quick pollen
#

yea i got it

summer stump
#

BUT, i'd like to see how they did the coroutine

languid timber
rich adder
#

also are you certain the script is running ?

queen adder
#

how does the scripts methods get called?

quick pollen
#

does he need the System.Reflection namespace

queen adder
#

Via a button Event?

#

No he doesnt need the namespace

summer stump
languid timber
quick pollen
#

good then

summer stump
shell sorrel
#

Reflection is not something they have to worry about, its just how unity on its end is calling a method from a string name

languid timber
quick pollen
#

i wanna listen to celeste ost now

shell sorrel
#

but also i tend to avoid invoke because of this, or at the very least use nameof

quick pollen
#

turns out the functions that are meant to call the function dont even get called

#

imagine

rich adder
#

Funception

rich adder
shell sorrel
#

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

rich adder
#

indeed , make sure this object the script is on isnt destroyed/disabled

summer stump
languid timber
rich adder
#

that means ur method to call invoke isnt called, then the invoke wont work πŸ˜›

#

so ur issue comes from higher up

languid timber
#

it does

#

it does

#

XD

quick pollen
#

i knew the answer all along hehehe

#

oh

rich adder
languid timber
#

I was talking in my head about the one after the Invoke

#

but this is the new system

#

"new"

rich adder
#

nothing is wrong with the syntax at least

#

this one also needs logs after StartCoroutine

#

just incase

shell sorrel
#

also does anything disable your GameSavingNote object

#

or destroy it

#

since that would kill the coroutine as well

languid timber
quick pollen
#

what id guess the problem is maybe

frigid sequoia
#

Can I get like a reference of one of the custom parameters of a custom ShaderGraph?

quick pollen
#

is that the RemoveNotifier is after the Invoke