#This is why I said initialy that it

1 messages ยท Page 1 of 1 (latest)

inner arrow
#

my issue is that only my last pasted prefab instance utilized more from the code. I feel it has something to do with the GameObject.find().. why do I think this? idk

left osprey
#

yeah that's definitely it.

#

send code.

inner arrow
#

Be ready to hate me for what I wrote

hot cobalt
#

!code

hearty stratusBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as 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 get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

inner arrow
left osprey
#

what calls Initialize()?

inner arrow
#

the : agent

#

Idk how much you know and I dont want to sound like I know because this is my first time with c# but I do code in java so its prolly like an abstraction

#

I just override it

#

but the reason why I think its the gameobject.find()

#

look

#

see the first 2 lines of code

#

those do work

#

but the next ones

#

the ones that use 'bones' that uses gameobject.find() guess what? they dont work

left osprey
#

yeah, it'll just grab any random object called Spider and Cube. and the bones too, i guess.

#

basically not a good case for using find

inner arrow
#

@left ospreyso euh

#

any ideas what I could use?

left osprey
#

is there any reason you can't use lists?

inner arrow
#

just init the individually?

left osprey
#

i just don't get the whole process of what's happening, like you're naming the bones and then finding them? are the bones generated? why are they not referenced in the first place?

inner arrow
#

I am using the 3 names

#

Jaw, PitchA and PitchB

#

and give them all a number 1 to 8

#

those are my 24 bones I want

#

with the names generated (cos im lazy to make on big list) I find the objects

left osprey
#

yeah idk this reads like spaghetti

inner arrow
#

what how

left osprey
#

but the general idea is that if you're generating them, then add them to list as you generate

inner arrow
#

I am not generating the bones

left osprey
#

if they're all manual, then just dump them into a list manually

inner arrow
#

The bones are there

left osprey
#

make a serialized or public list and just drag all of these bones there

inner arrow
#

Im just using a function to find em

left osprey
#

why are you finding them when they're right there

#

that's not what find is supposed to be used for

inner arrow
#

How else would I refrence them

left osprey
#

open up inspector in unity,

#

select all the bones

#

drag them to the list in the inspector

inner arrow
#

what list in inspector

left osprey
#

make it public or [SerializeField]

inner arrow
#

what

#

Im so confused

left osprey
#

why are you doing this shit if you didn't even check basics of unity

#

the time it'd take you to just go through intro for beginners would save you the entire time you are stuck with this problem

#

and mine too

inner arrow
#

XD

#

I havent even checked the basics of C# xd

left osprey
#

it's basically same as java so no problems there

inner arrow
#

Can you link me for the serialized thing you are telling me

inner arrow
left osprey
#

just put it before variable and you'll see it in the inspector

#

before private

inner arrow
#

yeah but what am I serializing tho?

left osprey
#

it basically shows the list in unity's inspector and allows you to edit it right there

#

so you can make references without touching code

#

it's automatically shown if it's public

inner arrow
#

so I would do that in the prefab, do the thing in inspector, and then it would do that thing everywhere

#

makes sense to me

left osprey
#

yep

inner arrow
#

Ill prolly get rid of the whole thing Im doing

left osprey
#

good

inner arrow
#

XD

inner arrow
#

@left osprey

#

What do you think : D

#

better?

#

I did not use SerializeField tho?

left osprey
#

what the fuck is wrong with you

#

you know how to make a list, are you trolling?

#

array is fine too

inner arrow
#

ignore that

#

I just tested what you said

#

it euh yeah

#

this might be faster xd

#

Fuck I have to redo

#

@left ospreywhat am I doing wrong?

#

Im sorry to ping you again but like

#

where are they

#

am I stupid?

inner arrow
left osprey
#

try uninitialized?

inner arrow
#

Same thing, nothing shows up

left osprey
#

i guess it's only list then

#

[SerializeField] List<Transform> bones = new();

#

it's strange that array doesn't show up though, i remember making one and being surprised that it showed up in inspector and could be used same as list

inner arrow
#

so weird thing

#

I went ctrl+z all the way back

#

removed what I didnt need and it works

#

๐Ÿค”

left osprey
#

๐Ÿค”

#

maybe you forgot to save?

inner arrow
#

I saved a lot I saw it refresh