#💻┃code-beginner

1 messages · Page 376 of 1

languid spire
#

wait. it's a public array. So the inspector value will be leading

#

is there a reason it's public ?

faint topaz
#

Uh, not really

languid spire
#

then make it private

faint topaz
#

Alr

#

@languid spire

#

It needed to be public

languid spire
#

The TMP_Text needs to be public, frases does not

faint topaz
#

Aaaaand now it directly doesn't work

#

Alr i'll try that

languid spire
#

you'll need to reassign the TMP_Text in the inspector

rich adder
faint topaz
#

I think I didn't

#

I made this with a friend that understands more of Unity than me during night

#

Im getting started into unity

fluid kiln
#

why is it not letting me click a button from the ui? it worked on the scene i created it, but not now in a completely new scene

rich adder
languid spire
#

EventSystem missing?

main anchor
fluid kiln
rich adder
rich adder
#

do the thing I just said

lethal bolt
#

Sometimes i dont even know where to start. It dosent set IsGrounded to true

rich adder
#

also why are you doing a FindByType then a GetComponent on the same component

lethal bolt
#

Because

#

it looks more clean

rich adder
#

what?

#

how exactly does Getting component on an already grabbed component of the same type "looks clean"

lethal bolt
#

I dont know

#

im trying

rich adder
#

I mean don't just randomly put stuff there 🤷‍♂️

lethal bolt
#

I made sense while making the script

rich adder
#

well the GetComponent isn't needed if you already find by Type

gloomy jacinth
#

I am trying to add post proccesing effects to my game but they do not show up on screen. what do i do to fix it?

rich adder
#

@lethal bolt anyway have you check if this script/function is even running ?

rich adder
robust kelp
rich adder
eternal falconBOT
robust kelp
rich adder
#

no worrries

#

just looks weird on mobile

rich adder
#

if you are using Unity 2022 you can use the Analysis window for Physics Debug, find the Spherecast and enable Casts

lethal bolt
rich adder
lethal bolt
rich adder
#

that or you forgot to use a Rigidbody lol

robust kelp
lethal bolt
#

It was the "Unnecessary" part lol

rich adder
robust kelp
#

yea

rocky canyon
#

whata.whata coincidence 🫣

rich adder
#

waddayakno

robust kelp
#

thats a sphere btw

rocky canyon
rich adder
rocky canyon
rich adder
#

wait checked off spherecast and it shows a line ?

#

that don't look right

rocky canyon
#

or the ray's handle broke off and ended up there

#

did u write GUI code for tha?

rich adder
rocky canyon
#

speedTutor has1

#

Mute

rich adder
#

spammy

rocky canyon
#

wanna see something ugly?

rich adder
#

sure, is it my code from years ago

rocky canyon
#

probably ¯_(ツ)_/¯

rich adder
#

something I would've done for sure ain't gonna lie

rocky canyon
#

atleast once

rich adder
#

at least

rocky canyon
#

i got this, i can make this 10 lines long, max

rich adder
#

Hey at least you had an inventory, i just crammed it all my monolith player class

rocky canyon
#

i didnt wanna screw guy over like that

#

he'd definitely woulda came bcak w/ problems

#

atleast my snippet can atleast be scaled a little bit 🤏

rich adder
#

you ever get paralysis by analysis cause so many ways to do something 😛

rocky canyon
#

i got all this stuff already actually

#

just gotta add an enum for the door colors

rich adder
#

You could make it without enum tbh

rocky canyon
#

ints and index

rich adder
#

just match Scriptable Objects

rocky canyon
#

oh no.. im avoiding those

rich adder
#

😮

rocky canyon
#

structs and classes r fine by me

#

i have 1* for my player settings

rich adder
#

but a key can be an asset you drag n drop into the door slot

#

so you wont have to create a new enum for new key type / door type

#

some can have 3 keys

rocky canyon
#

its pretty chunky

rich adder
#

you missing out Scriptable Objects are goated for this

rich adder
# rocky canyon

well yeah you need to split those into structs, at least I would

lime pewter
#

Hey all! I am currently working on a cellular automata liquid script and am trying to create a "new liquid" on the tilemap grid, so essentially trying to align a gameobject to a tilemap using the "WorldToCell" parameter on the vector3. However it seems to be 0.5 off on both axis from the tilemap it is referencing, if anyone has any idea as to why the debug rays are showing as they should be however both the collider attached and the sprite are off-centered while the "offset" of the box collider says (0, 0) any help would be amazing! Below is the example of the gameobject offcentered.

rocky canyon
#

u think?

#

i dont see how structs would be helpful for all the playercontroller code

lime pewter
#
newWater.transform.position = blockTilemap.WorldToCell(new Vector3(transform.position.x + direction.x, transform.position.y + direction.y, transform.position.z));
        
rich adder
#

but still I think a SO key door system can be pretty cool, I might just make it a free asset rq 😛

#

you can have like doors that have specific "Recipe" of "keys"

rich adder
#

cell positions are at the corners

#

unless i misunderstood what you're asking

#

you prob want to CellCenter

#

or w/e is called

lime pewter
#

Oh that might be why, I'll try that, thanks!

rocky canyon
#

unity pestering me

#

no way i know of to stop it besides commenting it out

night owl
#

@/navarone all errors are gone!

rich adder
night owl
#

thanks :)))

rich adder
rocky canyon
night owl
#

i was missing out damn

rocky canyon
#

i guess its a good thing,, its like a todo notification

rich adder
opaque bough
#

this code just says if the player is in trigger and you click E, then set gotGas to true, the player is in trigger because the bool says so, but when i click E it dosent set gotGas to true

fervent abyss
#

what will take more processing power?

1. bool test = BoolReturnMethod() in Awake()
then 
void Update(){ 
    if(test{
        Debug.Log("Bool");
    }
}

or

2. void Update(){ 
    if(BoolReturnMethod(){
        Debug.Log("Bool");
    }
}
languid spire
#

obviously 2.

fervent abyss
#

i just realized

summer stump
languid spire
opaque bough
#

what dont it say

#

oh nvrm the ontriggerstay thing worked

languid spire
# opaque bough wdym

it does not say 'this code just says if the player is in trigger and you click E'

astral falcon
# opaque bough oh nvrm the ontriggerstay thing worked

you are mixing up one time event methods with update(). Your Input... line is being checked in the frame of your trigger has been entered. if you are as fast as the physics engine and hit the button within that frame, it will work, but thats not what you want. Obviously you should look into the basic tutorials on learn.unity.com for example to get, what the engine is actually doing, when and how often its executing its builtin methods etc etc

summer grail
#

How would set up an object to have a trigger and still be solid?

And how would I have the trigger only detect specific objects (like a bullet for example)

polar acorn
#

Triggers, by definition, are not solid

summer stump
summer grail
#

Alr thank you

ruby ember
#

hi everyone so i have a problem that i don't know how can i do

is about saving the selected button

like when you select monochrome and you leave the game
and when you open the game monochrome button is still selected

https://hastebin.com/share/jewaqenuno.csharp

swift crag
#

this isn't really saving a selected button

#

you just need to save a value, like a number or a string

#

you can use PlayerPrefs to store small amounts of data

swift crag
ruby ember
swift crag
#

that's which UI button is currently selected -- but that doesn't really correspond to which option is picked

ruby ember
#

but the problem is that idk how to make saving

swift crag
#

it's just which button will be pressed if you hit enter

#

You should use the Toggle component

#

You can put all of them into a Toggle Group

ruby ember
swift crag
#

The only annoying thing is that you'll need to add a separate graphic for when the toggle is checked

untold raptor
#

ArgumentException: Input Button No Control is not setup.
To change the input settings use: Edit -> Settings -> Input

can anyone help with this please.

ruby ember
swift crag
#

Yes. That's why I suggested switching to using toggles.

#

the "selected" color is just telling you that you've got that Selectable object selected

#

like, for keyboard navigation

#

You could just change the actual color of the text, I suppose

#

When you click a button, reset all of their colors to white, then color the one you clicked blue

#

When you start the game, look at the saved setting and use that to decide which button to color

ruby ember
swift crag
#

show me your code; i need to see what you're actually doing here

ruby ember
swift crag
#

ah, okay, so you are already changing the actual text color

#

I thought that was just the color of a selected button; my bad

#

Anyway, I would suggest rearranging your code

#

Create a function that reads the player pref string and sets the button colors

#

Make DefaultButton/etc. do two things:

  • set the playerpref string
  • call the new function
#

When the game starts, call that new function

#

the new function can also set DefaultMode/MonochromeMode/etc. based on the string

ruby ember
#

i used this to make the save

#

but idk if i did it wrong

ivory bobcat
untold raptor
#

its on startup but ive just figured it out, the controls are missing from the input manager

young fossil
#

Hi, would like some advice for starting a project that is very UI heavy. 2D puzzle

teal viper
young fossil
summer stump
#

Why does it have to be ui heavy?

teal viper
night owl
#

hi the death animation endlessly repeats in my game and im following a tutorial that has a box that is can/cant transition to self but i dont see the box on my end. I was wondering how i could get it or if someone could help me correct a destroy command?

worn garnet
#

I need some help with a system in my game:

#

oops

teal viper
young fossil
summer stump
#

Just provide the context

night owl
summer stump
#

Why is it ui heavy. If you don't want to answer, then you should not waste the time of others.
It is unanswerable until we know the extent of the ui, the answers will be different in different circumstances

But you could google the canvas optimization guide from unity yourself if you want generics

teal viper
worn garnet
# worn garnet I need some help with a system in my game:

I have a raycast system where if the raycast is hitting a certain tagged object, it set a boolean to true of false depending on if its hitting it or not, but no matter if the raycast is hitting the enemy or not, the boolian will stay at false

teal viper
young fossil
# summer stump Why does it have to be ui heavy?

Didn't come here to argue, came here to get advice. It would be UI heavy since I wanted it to be a puzzle game which is all themed inside a computer (OS). There are no planned interactions outside of the computer. I guess a good example would be something like Home Safety Hotline or Space Warlord Organ Trading Simulator.

summer stump
#

The best way to deal with this would be to NOT make it ui, so that it is more performant

swift crag
#

If you're pointing and clicking around a computer then UI components make sense

summer stump
#

But as I said, unity has a canvas optimization guide

swift crag
#

in that case I'm not sure there's any specific advice, really

young fossil
swift crag
#

beyond deactivating things you aren't using or splitting into multiple canvases

teal viper
swift crag
#

I guess I'm not sure what kind of advice you're looking for

young fossil
swift crag
#

you've got a very broad subject

summer stump
#

This is the guide I was talking about

night owl
teal viper
night owl
#

is that the issue LMAOO

#

thats my bad then thanks

teal viper
#

Make sure the animation is not set to looping.

young fossil
#

Well, if other engines deal with UI centric games better, then I could go and use those. Also considering the architecture and how UI is based around Unity events, maybe it would be best to use Unity events other the kinds to compliment it

#

Also if the engine comes packed with things, such as physics, will it affect file size or performance even if I don't use that feature?

swift crag
#

file size, yes, but it's not a massive baseline

#

you're not spending 3GB on engine code

night owl
swift crag
#

and physics updates with no physics objects are going to be extremely cheap

young fossil
#

Is there a way to strip it down?

#

I know there is an extesnions feature

#

And some stuff is packed into there

swift crag
#

no, and I would focus more on making your game than trying to slice off every last kilobyte of engine code

young fossil
worn garnet
#

I have a piece of code in my game thats not working, it supposed to set a boolian active when a ray is hitting a enemy, but the boolian constantly stays deactivated, no matter if im looking at the enemy or not, heres my code for it: if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out RaycastHit hitinfo, 20f))
{
if (hitinfo.transform.CompareTag("Enemy")) {
IfLookingAtEnemy = true;
} else {IfLookingAtEnemy = false;}

young fossil
swift crag
#

The cost of re-drawing the UI grows with the amount of UI renderers you have

#

which is true for basically everything, really

young fossil
#

Okay, correction then, UI over sprites

summer stump
swift crag
#

I was thinking of a sliding tile puzzle game lol

young fossil
#

Why can't I put a thumbs up? Weird lol

swift crag
#

I use one huge-ass canvas for my game's entire menu

young fossil
#

Yea, sorry, I should make it clearer next time

swift crag
#

But I also deactivate menu screens that aren't currently in use

#

there are 291 game objects in my main menu, and that's before I instantiate any sub-menus (like individual settings screens)

summer stump
#

Like a 2d platformer as entirely canvas based

#

It comes up more often than I would have thought before helping here

young fossil
young fossil
swift crag
#

I'm not sure there's a big difference between:

  • Canvas
    • Huge blob of UI elements (activated)
    • Huge blob of UI elements (deactivated)
    • Huge blob of UI elements (deactivated)
    • Huge blob of UI elements (deactivated)

and

  • Canvas
  • Canvas (deactivated)
  • Canvas (deactivated)
  • Canvas (deactivated)
#

Multiple canvases will be relevant if you have several distinct UI areas

#

obviously "HUD" and "Menu" is a common split

#

but think about an RTS

rocky gale
#

Is 2d not already just on a canvas

#

The characters are spritrs

swift crag
#

no, you're using sprite renderers

#

those aren't UI renderers

rocky gale
#

Oh

swift crag
#

UI is a separate system

rocky gale
#

Oh

swift crag
rocky gale
#

Didn’t know that

shy ruin
young fossil
#

Hmm, well Fen, for my case I'm imagining each "window" inside this computer's fictional OS to be a canvas... maybe a bad idea, idk

#

Since you can "minimise" them

swift crag
#

windows don't really interact with each other

#

especially once you get into automatic layout

#

each window is totally independent

#

putting a huge text component in one window won't make another window grow or rearrange itself

teal viper
rocky gale
#

Debug = GOAT

#

When in doubt debug as they say

midnight maple
#

Hi all. I am more of an XR designer than a developer, so working with code is not my strong suit. Sorry if this isn't the right channel for Unity error troubleshooting, but does anyone know what this error means and how to fix it? Originally, I thought it was because I forgot to switch the build settings back to "windows, mac, linux". It seemed to have solved the problem the first time, but it's back to causing problems on play mode and showing the same error message.

rocky gale
#

Can we see the code

midnight maple
young fossil
# summer stump I think what dlich and I were thinking at first was the common trap people fall ...

Off topic to programming but just wanna say, I tried reacting to your messages a second ago and it wasn't working, it kept shaking and removing it. So I looked it up and just realised that it means the person blocks you. That is so funny and stupid that Discord has such an anti-feature, that allows you to test if someone "privately" and "anonymously" blocks someone. Terrible breach of privacy, could've been fixed by not showing the reaction to the user and but still to others instead.

Anyway, thanks to those you helped, also sorry for not being clearer before, I didnt think of people using Canvas like Sprites and other crazy things. Sorry to @teal viper @summer stump and still appreciate the efforts to help

summer stump
summer stump
#

But either way, no worries

rocky gale
#

Look at aethenosity man, so inspirational

teal viper
young fossil
# summer stump I'm not sure if you mean me. But I have not blocked you

Before, I tried reacting and it wasn't letting me. I looked it up and it says that. Could've been glitched but I just assumed I pissed you off (I literally block people like that so understandable if so). But yea, maybe a glitch or whatever, still what a grand discovery, makes me think how many people realised I blocked them

summer stump
midnight maple
midnight maple
summer stump
gloomy jacinth
#

!code

eternal falconBOT
gloomy jacinth
#

Does anyone know the problem with this code?

#

The error is: NullReferenceException: Object reference not set to an instance of an object

ivory bobcat
gloomy jacinth
ivory bobcat
#

projectileGun is null

gloomy jacinth
#

How do i set it?

ivory bobcat
#

Preferably in the inspector

gloomy jacinth
#

Does the instance need to be a prefab?

#

Or the gameobject with the script in it

#

Oh i got it!

#

It needed to be the instance with the script i was referencing

#

Is this possible to do in a reference?

#

Is that possible or do i have to divide it into one?

#

Or 3 parts

main anchor
gloomy jacinth
#

@ivory bobcat How can i get the true or false statement of the other script to bring it into this reference?

#

I want it to change the statement to tell if i can shoot or not. How do i get it from my weapon script and store it here?

#

Can someone help me with my script?

#

Im trying to get a true or false input from another script using references.

summer stump
#

Drag and drop (serialized references) if you can

You really should just stop and do the learn.unity.com site I keep linking though. It goes over all the basics like this. You would be up to speed in a few days and have a broad foundation to build from

plain mortar
#

this is for a 2d game

midnight maple
# summer stump Well what values did the log say?

I wasn't sure how to look that up, but after doing some more digging, I discovered that others were having a similar issue! I found a workaround on this page. https://forum.unity.com/threads/xrpass-getviewport-exceptions-in-editor.1577916/

rich adder
night owl
#

hello i was wondering if someone could help, the enemy death animation is played and then i want the enemy to go away so i used a destroy(obj) but now when i attack the enemy nothing happens (neither death animation or destroy(obj)

this is the block of code

    void Update()
    {
        if (health <= 0)
        {
            anim.SetBool("isDead", true);
            Debug.Log("Enemy is dead");
            Destroy(anim);
        }
        
    }

With the Destroy(anim); line commented out the script works and upon attack the animation goes off

main anchor
rich adder
main anchor
rich adder
rich adder
night owl
night owl
#

ohhh so game object ok ty

night owl
#

i have another question cat_smile

#

i have an attack point which currently uses overlap circle to show when the weapon has hit the enemy. The weapon is kind of like a rope, like wonderwoman lasso, so it shoots out. is there a way i could have the circle made into a polygon that can be shaped around it or move with the rope?
i was looking into this https://docs.unity3d.com/ScriptReference/Physics2D.OverlapCollider.html as well

or is there a way to make a polygon collider 2d that then is used as the attack point but it doesnt react to physics so it can pass into/thru the enemy

indigo schooner
#

can anyone help me with something quick

#

I am very new to unity and my elephant is floating and i dont know why

#

there is a sphere mesh collider that is nowhere to be found in the inspector but it's there

graceful lintel
indigo schooner
#

its not in the camera and the elephant is the only child

graceful lintel
#

if it appears only when PLayer is selected check PLayer, playyyy and Main Camera

indigo schooner
#

Ive checked everything

#

I'm not exactly sure what I'm looking for though

graceful lintel
#

Sphere collider

indigo schooner
#

But when I disable all of the components it's still there

graceful lintel
#

UnityChanHuh huh I guess try restarting Unity?

#

its impossible for a sphere collider to be visible if there isnt a component of it in there

indigo schooner
#

think again

#

ill try restarting

#

still there

#

Could it be in the script somehow? i just copied and pasted it

#

and it's not in PLayer

graceful lintel
#

oh hey

#

try removing Character controller

#

even if its disabled its collider is still visible

indigo schooner
#

"Can't remove CharacterController because PlayerMovement (Script) depends on it"

wintry quarry
#

Also yeah looks like your script has [RequireComponent(typeof(CharacterController))]

graceful lintel
#

Ye, that's my best bet.

indigo schooner
#

what should i do

#

I GOT IT NEVERMIND

#

THANK YOU SO MUCH

graceful lintel
night owl
#

hi does anyone know why i cant resize this overlap circle?

code:

    {
        Collider2D[] enemy = Physics2D.OverlapCircleAll(attackPoint.transform.position, radius, enemies);
        
        foreach (Collider2D enemyGameobject in enemy)
        {
            Debug.Log("Hit enemy");
            enemyGameobject.GetComponent<EnemyHealth>().health -= damage;
        }
    }

im able to move it around on x/y but the scaling doesn't seem to do anything?

wintry quarry
#

OverlapCircle uses whatever radius you give it

#

in this case, the radius variable

night owl
#

oh hmm the radius is what im trying to modify

wintry quarry
#

well how are you modifying it

night owl
#

unity transform under inspector

wintry quarry
#

so idk what you're talking about

polar acorn
eternal falconBOT
wintry quarry
#

only changing that variable will change it

wintry quarry
polar acorn
night owl
wintry quarry
#

The Transform scale is completely unrelated

wintry quarry
night owl
#

sorry

wintry quarry
#

something was different when it worked

#

maybe code that actually multiplied the Transform scale by the radius

#

There's nothing to apologize for

summer stump
gray gorge
night owl
#

okok this was totally my mistake then i was trying to adjust the x and y values seperately but the radius control is within the actual attack script

night owl
#

I was hoping i could just change it to this (and added width and height float var)

Collider2D[] enemy = Physics2D.OverlapBoxAll(attackPoint.transform.position, width, height, enemies);

but it gave the error that "cannot convert from float to unity engine vector2

wintry quarry
#

it wanbts a Vector2

#

e.g. new Vector2(width, height)

gray gorge
# night owl no i dont know at all

so I assume the reason that you set things like attackTime public is so that you can change them in the editor easily, right? super convenient. But public is actually problematic because that variable can be modified by other code when you just want that code "encapsulated" so to speak. If, rather than public float attackTime you replace it with [SerializeField] float attackTime that code can't be modified anywhere else by any other scripts (e.g. private) AND you still get to mess with it in the editor like you're used to

gray gorge
night owl
#

thanks that actually makes sense to me

#

so why wouldnt u use the [serializefield] always

#

just bc it's not needed?

wintry quarry
#

Best practice is to do that

#

public fields are bad form

#

sometimes you do need to modify things from outside though, and that's where public methods and public properties come into play

night owl
#

i wasnt exactly sure where to put it but i am testing it rn

#

even though i made it a box overlap only the radius control seems to work? and like change the size

#

but its also still a circle which im also confused about

#

oh wait

#

the gizmo is still saying sphere i think

wintry quarry
#

the gizmo, if there is one, will be from some component on the object

#

maybe a CircleCollider for example

night owl
#

i tried putting a polygon collider on the attack point but i couldnt figure out how to make it not solid

wintry quarry
#

what ar eyou trying to do

#

back up and start with that

night owl
#

its honestly poorly explained now that im looking at it

#

ill try and rephrase with a tldr

keen pecan
#

Does anyone know a good way to have unity rotation work in WebGL?

wintry quarry
keen pecan
#

(right now when i reach the bounds it just leaves the game screen)

wintry quarry
#

but it honestly is worse to use colliders for this than to use queries like OverlapXXX

keen pecan
#

(and when I set it I cant fully rotate)

wintry quarry
#

What does rotation have to do with "bounds"?

#

rotation of what

keen pecan
#

So my rotation is based on my mouse and when i have the game on itch the mouse leaves the game and I cant rotate anymore

wintry quarry
#

lock your cursor

keen pecan
#

Should that work on WebGL too?

wintry quarry
#

Of course

keen pecan
#

Oh lets go it worked

#

Thanks

#

I was setting screen bounds but not locking the cursor

silent vault
#

Good idea. Thanks!

night owl
#

this is the line i have currently worked out

        Collider2D[] enemy = Physics2D.OverlapCollider(attackPoint, enemies);

but it returns with the error of no overload for method overlapcollider takes 2 arguements. so i tried having radius there and the position transform as before as well as width/height. I also found on a forum someone using filter and results but that did not help the 2 arguments thing

wintry quarry
night owl
wintry quarry
#

instead of checking what the parameters actually are

wintry quarry
#

and provide what it actually needs

#
public static int OverlapCollider(Collider2D collider, ContactFilter2D contactFilter, Collider2D[] results);```

^ They write this so you know what parameters go into it and what it returns
night owl
#

ok ok thank you i will try again

#

but not just guessing oops

night owl
#

is enemies at the end just supposed to be a number?

summer stump
#

You create the array and pass it in

night owl
#

so the "Collider2D[]" generates the array?

summer stump
#

It is the type for an array

#

GameObject[] is an array of gameobjects

#

[] is the syntax for array

#

You have to create the array

wintry quarry
#

that's just telling you waht type to use

#

you have to provide an array there

summer stump
#

You might wanna show the code you actually wrote instead of the method signature

night owl
#

okay

#

!code

eternal falconBOT
night owl
summer stump
#

You are declaring a method for some reason there
Just completely delete line 47

#

If the docs say the signature is OverlapCollider(Collider2D collider, ContactFilter2D contactFilter, Collider2D[] results);
Then you write Physics2D.OverlapCollider(myCollider, myContactFilter, myArray);

#

You do not include types. You do not have public static int

#

You just call the method with the right parameters

night owl
#

okok let me try that i think i get what you mean

night owl
#

im gonna have to try this again in the morning i really am not getting it

#

thanks for the help though!

#

i will probably be back ;-;\

queen adder
#

https://hatebin.com/fofyezamih guys whats wrong with this code? because it should make a vehicle follow the player but i keep getting error CS1026 ) expected

teal viper
eternal needle
#

imma guess !ide isnt configured

eternal falconBOT
plain mortar
#

no ones responded to me all day...

i must be invisible or doing something wrong

#

I even asked twice

plain mortar
#

I deleted all of them at this point, thought my format was wrong

summer stump
#

Ah, gotcha.
Well I did not see them, and you have not re-asked it. So nothing anyone can really do 🤷‍♂️

plain mortar
#

I was gonna reread the rules and post again

summer stump
#

It is just a community server, so questions get missed sometimes

plain mortar
summer stump
#

People generally don't want to go to links, so maybe that was why it was skipped over.

But in your link you say:

but the bunny doesnt move horizontally left or right, only horizontally

Is there a mistake there? I am confused

#

Do you mean only vertically?

plain mortar
#

yeah, only vertically

#

I edited it

summer stump
#

Well, I am about to go to bed, someone will hopefully help.
I suggest adding a log after each operation and see if each step is what you expect.
I would need to test the code to actually see what is going on myself. Can't do it in my head

eternal needle
plain mortar
#

I did add debugs and the angle was given properly, straight up was 90, far left was 180 and far right was 0. Its not applying horizontal force for some reason, just vertical

eternal needle
#

Show the debugs you've added, I highly doubt you are getting anything other than a fixed number for this angle if the character is staying still

#

another thing, this clamping probably isnt desirable because you are clamping all negative angles to 45. Going from -179 to 179 degrees is a very very small difference but your code will clamp it to 45 or 135 respectively. Which is basically the opposite direction

eternal needle
zinc shuttle
#

how to build the game? i am getting errors, building android game.
and error are What went wrong:
Could not determine the dependencies of task ':unityLibrary:mobilenotifications.androidlib:compileReleaseJavaWithJavac'.

Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-33 Android SDK Platform 33
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

#

what component do i install and how?

plain mortar
#

dont know why my mouse cursor isnt there, but at 180 my mouse is to the left of the chracter, at 0 its to the right, at 90 its directly top

#

this wasnt even the issue i described

#

did you even test it, genunely curious...

eternal needle
plain mortar
#

the angles arent a problem dude

#

when I'm running and jumping it works perfectly fine, the problem i'm having is the force not applying horizontally

eternal needle
# plain mortar did you even test it, genunely curious...

🤷‍♂️ how much do you expect me to test, when the only thing i see from the code is math. Ive pointed out possible issues, i dont know why its a struggle for you to just show me the updated code.
If you're sure the direction is correct, then this is probably an issue with the rigidbody settings. Like friction that might be stopping it from moving

plain mortar
#

within that link is the entire code im using for the script

#

literally all of it

eternal needle
#

"literally" yet there is a debug in your screenshots, and no debug in your code.

#

if you want to be a pain to help, then ill simply step out. Ive pointed out 3 possible issues already yet i dont see you addressing any of it

plain mortar
#

do you really need to see what that is? Debug.Log("Angle: " + angle); how is that gonna change anything? cant you just infer based on the debug.log syntax?

#

you pointed out nothing to me

#

you told me it might be the problem with the mouse position, I told you the angles are correct from where the mouse is and the character position

#

I also told you it works fine when running, its an issue of force not being applied horizontally

#

you haven't tested out the code yet even thought I gave you all the code

eternal needle
# plain mortar you pointed out nothing to me

Believe what you want then, when you feel like reading go back and re-read what i said. I pointed out different issues but you're fixated on one thing and clearly ignoring everything else. I cant be bothered to deal with sass. This is just a public place for help, so goodluck getting help in the future if you're an ass to everyone

plain mortar
#

If you cant be bothered to actually test the code I've given you I dont want your help. I help people with java stuff and since I'm pretty familar with it, the first thing I do is test the code...

#

if you tested the code you would've noticed that it has nothing to do with the angle, debug arc Im working on adding that, as far as the rigidbody issues I dont know what you want me to do with, I have not changed any settings for the RB, how would I act on you just telling me its an "rigid body issue"

#

YIKES

eternal needle
#

I did test, if you cant be bothered to get off your high horse then really no ones gonna help you 🙂. Infact i only noticed this from testing #💻┃code-beginner message

plain mortar
#

you clearly didn't test lol

plain mortar
#

also if you did test, you would know its not an issue with the angles...

#

if you actually put Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); in visual studio you would know there is no problem with it

#

dont tell me you've tested...

eternal needle
#

alright then, goodluck with your issue. Im out and thats a block cause you clearly cant get past your frustrations to even properly read what i wrote. Literally the 2nd word after "rigidbody settings" suggests a possible cause

plain mortar
#

again, how am i supposed to act on that?

#

thats like saying "theres an issue with your code"

burnt vapor
#

@plain mortar If you want to be helped in this channel it is expected you share relevant information about the issue and the tests, including results. We don't do guesswork and we don't "trust" users off of their tests, espec\ially in a beginner channel. Please share everything you have done so we can continue from there.

plain mortar
#

if you tested you maybe would've saw a specific example and I could've done more research on that

#

I've shared ALL information I have

#

there is nothing more that I have

#

if people can't be expected to actually read that information and waste my time like this i dont want their help

#

legit insane

burnt vapor
#

Alright, good luck on your issue

burnt vapor
plain mortar
#

what an annoying fucking prick man @eternal needle

#

fuck you dude

eternal needle
plain mortar
#

cya 🖐️

#

HAHAHHAHAH HE DIDNT BLOCK ME

#

LMFAO

eternal needle
fickle plume
#

!ban save 527211132537012275 Would rather insult people instead of getting help. Shutting the door for insults.

eternal falconBOT
#

dynoSuccess lutaic was banned.

real rock
#

Pretty sure it was because of some fucky implicit conversion stuff at a glance anyways

#

For all they went on about how they tested and debugged it they converted something to a vector3 and then immediately implicitly to vector2

languid spire
#

All I see is a complete failure to debug the only 3 values that actually matter. But, hey, what do I know?

burnt vapor
#

Guess we will never know considering they would rather bash the help they retrieve 🤷‍♂️

fickle plume
#

It is usually something omitted overlooked. If someone wants to do a sanity check and go over the exact testing method, it is with the good reason.

real rock
#

Fr

#

Also like

#

Debugging remotely is hard

#

They’re not going places in real life if that’s how they treat an IT tech

#

Sometimes you just gotta ask questions because usually the real answer is no

languid spire
eternal needle
#

im mostly sure it was friction, but there were other issues that i pointed out too

languid spire
#

yep, debugging the normalized vector, the force applied and the resulting velocity would have cleared up the problem in 5 seconds

storm dove
#

what does Vector2/3 do?

languid spire
storm dove
#

what are they then?

languid spire
#

fundamentally they are structures which contain 2 or 3 float values

vast vessel
#

Hey guys!
Is there a reason why im getting null refrance eceptions in my build from my AI Locomotion script, but everything is fine inside of the editor?

burnt vapor
languid spire
vast vessel
#

I meant after

languid spire
#

you are ok to rely on Awake in one script/Start in another but not Awake in one script and Awake in another unless you specifically set the execution order

astral falcon
# vast vessel Aleight thanks!

You can still introduce your own methods and add them to the executionorder and change it to your needs, if you really need

main anchor
valid stone
#

this is probably a stupid question but how do I create a square in code (unity c#)?

wintry quarry
valid stone
wintry quarry
#

Make a prefab and Instantiate it

tepid horizon
#

im having a dumb nooby problem where i character cant rotate with my camera

languid spire
#

your null ref exception might have something to do with that. Fix it

tepid horizon
languid spire
#

So what is line `161 of FirstPersonController?

tepid horizon
#

ohh didnt see in the error it reference the line

#

crosshairObject.gameObject.SetActive(false);

languid spire
#

so crosshairObject is null

tepid horizon
#

oml thanks that was a silly mistake that was meant to be // for later

languid spire
#

the error messages do not lie. Learn to actually read them

tepid horizon
#

ok another problem i double slashed everything to do with my crosshair and sprint bar. basically everything that was the problem that i would use later, but unity isnt reading the double slash and its acting as if it want double slashes. and i definetly did save the script so it wasnt that

burnt vapor
#

If it's commented out and you saved the file, it will be used as a comment. If this is not the case then you either commented out the wrong thing, have related code uncommented or you simply didn't save the file

valid stone
slate haven
#

I want to spawn my cars faster but I can't somehow. The spawn rate (TimeTillNextSpawn) is already 0f. Also I have this function bool CheckForValidPosition() which makes a good amount of space between cars so they don't spawn on each other. Maybe this is the cause I can't spawn cars more faster as it rejects the position for spawning. Please do help me!!

CarSpawner script: https://pastecode.io/s/s8tkvn16

burnt vapor
#

I don't see an Instantiate method in this code, so how are they spawned to begin with? This is quite a bit of code

slate haven
astral falcon
burnt vapor
#

Ahh, I see

#

Did you verify op.SpawnFromPool is being called in general? Does this method even get reached?

slate haven
#

also the thing which is making them not spawn faster is most probably my function which makes a good amount of gap between them

burnt vapor
#

Oh, sorry. I misread, it does spawn

keen dew
#
timeTillNextSpawn = 1f;
yield return new WaitForSeconds(timeTillNextSpawn);

🤔

slate haven
#

cars do spawn

burnt vapor
#

Well, yes. That what Nitku mentions is the thing that stands out

#

You spawn the car and then hardcode wait a second

slate haven
#

like yes it does

#

but not significantly

burnt vapor
#

You don't want the speed to increase, just spawn faster?

slate haven
#

like i have this traffic increase pickup, so I want whenever player picks that, cars shall spawn much faster every time

slate haven
#

shall I share a gameplay video as well?

astral falcon
#

What happens if you move the coroutine content into the update methodfor now?

burnt vapor
#

I'm not sure how WaitForSeconds works but considering it is for seconds I would assume that 1 is the minimum

#

If you want to it be faster, perhaps use a different yield method

burnt vapor
#

For example, get the current time with Time.time, and then wait until a certain amount of time passed

#

Using yield null; skips a frame

#

Alternatively, use an actual Timer

slate haven
#

what happens when it skips a frame

burnt vapor
#

It will run the next frame

slate haven
astral falcon
#

I still would try update() first to see, if your code can run faster at all

keen dew
#

WaitForSeconds does wait for fractional seconds and waiting for 0 seconds waits one frame. I'm assuming the problem is with CheckForValidPosition, you'll have to do some debugging

slate haven
slate haven
astral falcon
keen dew
#

Increase the minSpawnDistance and see what happens

slate haven
#

because when I decrease it, all the cars spawn on top of each other lol

astral falcon
#

I would use async calls and let each object create itself while starting the next one

wintry quarry
keen dew
#

You'll have to tweak the values like spawn distance and radius and find the combination that works the way you want

valid stone
wintry quarry
valid stone
wintry quarry
#

sounds like you never made a sprite called "Square" in a resources folder

wintry quarry
#

I really really strongly recommend just using a prefab instead of this

keen dew
#

That's how it goes

astral falcon
slate haven
# keen dew That's how it goes

[SerializeField] public float minSpawnDistance = 2f;
[SerializeField] public float radius = 1f;
[SerializeField] public float timeTillNextSpawn = 0f;

These are the default values, in which it doesnt even look as if the cars are spawning faster, so like how do i even tweak them to make spawn rate faster? like these are the lowest

valid stone
keen dew
astral falcon
wintry quarry
#

Make a prefab that is how you want it to be

#

And Instantiate it

slate haven
keen dew
slate haven
valid stone
#

where is this prefabs folder

slate haven
valid stone
#

I have "all prefabs" under favorites but I don't know where this prefabs folder is

valid stone
#

or is this a folder you have to create yourself?

slate haven
slate haven
astral falcon
slate haven
sleek sage
#

CapsuleCast doesnt working

#

gives false all the time

#

where i can be wrong

wintry quarry
# sleek sage

There are no colliders in the path of the capsule cast

#

One note- You're using a 3D capsulecast. Make sure your game is not using 2D physics for example.

sleek sage
#

i fixed it but got another thing

#

where i am wrong at this code lines

#

im trying to make a simple jump

slate haven
#

what was the website where I can embed videos and share here?

wintry quarry
wintry quarry
slender bridge
#

he says he is trying to jump but that code is far off from anything relevant

sleek sage
#

my object just falls

wintry quarry
#

Well yeah this doesn't look like code that would jump at all

#

It slightly moves the position up for a single frame, that's it

rare basin
#
public List<UnityEvent<T>> unityEvents;

is there any way to serialize this prettier in Unity?

wintry quarry
#

You should be jumping via your Rigidbody, if you have one

rare basin
sleek sage
wintry quarry
wintry quarry
rare basin
sleek sage
#

i dont have rb

rare basin
wintry quarry
rare basin
#

List<UnityEvent<T>> the generic type is not good i guess

#

for serialization

wintry quarry
#

Hmm maybe

rare basin
#
    public class ObjectEventActionSubscriber<T> : SerializedMonoBehaviour
    {
        public List<UnityEvent<T>> unityEvents;

        public EventActionObject eventAction;

        private void Awake()
        {
            eventAction.OnEventObj += InvokeAllEvents;
        }

        private void OnDestroy()
        {
            eventAction.OnEventObj -= InvokeAllEvents;
        }

        public void InvokeAllEvents(UnityEngine.Object value)
        {
            foreach (UnityEvent<T> unityEvent in unityEvents)
            {
                var converted = (T)Convert.ChangeType(value, typeof(T));
                unityEvent.Invoke(converted);
;            }
        }
    }
#

that's the whole class

#

maybe I could add where T : Object

#

would that help

astral falcon
#

why not go with object already then?

rare basin
#

because i want a reference directly

#

to what im passing via the event bus

astral falcon
#

Ah, got it

rare basin
#
public EventActionRaiserObject<MapSector> raiser;
#

can i write property drawer somehow

#

for the List of unity events<t>

slate haven
astral falcon
slate haven
astral falcon
# slate haven why would it?

You only have a x amount of pooled objects, right? when do you label them "free" to be used by your pooling system?

slate haven
#

yes

#

100 amount

#

so if i increase spawn rate

#

it has to reuse

#

oh man

#

what do i do now? Increase amount of pooled objects?

astral falcon
#

Remember when you said, you know what your code is doing? 😉 You yourself gotta keep track of what is active and what can be reused and so on. Either calculate a fixed number you can guarantee to not reach and use that as minimum objects or let it dnymically decide and wait for the next free object. really depends on your game design and how you determine the amount of cars being spawned, probably with a difficulty increase or what not

rocky canyon
#

i do the former

#

cuz laziness an' all

slate haven
rocky canyon
#

what in the world are u doing where 100 is not enough?

slate haven
astral falcon
slate haven
astral falcon
#

You could check for an amount of time if a new car is available, if not, fallback of creating one to keep your spawnrate constant. But there are many ways to achieve your game design

slate haven
astral falcon
slate haven
#

3k cars spawning

#

i mean not spawning

#

but its using cars from 100 amount. I have 3 different car prefabs, i have set 100 to all 3 of them

astral falcon
#

that would be 300, not 3k

slate haven
astral falcon
slate haven
rocky canyon
#

u click on a spike..

#

scroll down, in the hierarchy

#

and see what methods are taking the longest

ivory bobcat
#

Maybe show where you're calling jump as well

slate haven
astral falcon
# slate haven can u explain?

You click on cpu usage and down in details, set hierarchy and go through with the most ms time of your scripts appearing for example

rocky canyon
rocky canyon
#

expand this..

#

and ur code will be shown inside it

slate haven
rocky canyon
#

Editor loop is stuf Unity is doing for the Editor

#

PlayerLoop is whats going on in teh game (your code)

swift crag
# rocky canyon

all of the time is being spent in EditorLoop in this screenshot

rocky canyon
#

facts.. thats twentacles screenshot

swift crag
#

you pointed to PlayerLoop, but that's only spending 1.64ms

rocky canyon
#

ya im showing guy how to check his profiler..

#

he hasnt posted yet

astral falcon
swift crag
#

oh!

rocky canyon
#

he's pooling soo its bound to be a little heavier on his

swift crag
#

🤦‍♀️

#

I misunderstood and thought you were helping twentacle

#

"well, duh, that's twentacle's screenshot..."

rocky canyon
#

twentacle doesnt need help 😄

swift crag
#

except with excessive garbage collection times, maybe 😛

rocky canyon
#

i do wonder what my player loops looks like

swift crag
#

you should add profiler markers!

rocky canyon
#

not too shabby 🙂

swift crag
#

they let you measure how much time is spent in specific regions

astral falcon
swift crag
#

(without slamming the Deep Profile button)

swift crag
rocky canyon
#

is that alot?

swift crag
#

no

rocky canyon
#

oh ok 😅

#

i scared for a minute

swift crag
#

but you should make it zero anyway 😁

rocky canyon
#

impossible

#

im not that smart

astral falcon
#

Its not in your hands sometimes 😄

swift crag
#

my AI code currently generates hundreds of KB of garbage per planning cycle (every 0.25 seconds by default). i need to start memoizing some of these objects..

rocky canyon
#

how do u deal with the garbage?

swift crag
#

lots of objects that get re-created every time they're used and that don't actually store any mutable data

rocky canyon
#

do u manually flush it?

swift crag
#

you re-use objects instead of throwing them out, basically

#

pooling!

rocky canyon
#

yea, i get that.. but im askin for your setup..

swift crag
#

For example, I have an "Activity" class that represents an action you can perform

rocky canyon
#

are u intervening somehow

#

or just letting Unity take care of it

slate haven
swift crag
#

for each possible action (say, the player opening the door), I can just create one Activity and re-use it

rocky canyon
#

change the dropdown to Hiearchy

swift crag
#

right now i don't

#

click on CPU Usage first

rocky canyon
swift crag
#

you're focused on the Rendering row

rocky canyon
#

its my GUI redraw 👀

#

w/o that im netting 0

#

lmao

swift crag
#

oh yeah, and that's a fair place to create garbage

#

I don't think you can avoid it with IMGUI

rocky canyon
#

im using GUI stuff for debugging purposes

#

i like to have my debugs on screen

swift crag
#

and I don't try to optimize allocations for debug code anyway

#

My planning system uses pooling to minimize allocations, but the code that dumps the plans out to a file is allocation city

#

since that's not actually part of normal gamepaly

rocky canyon
#

do u have custom pooling or do u use unity's system?

swift crag
#

I'm using Unity's Pool classes

rocky canyon
#

ohh bad-ass

swift crag
#

you'd call that "memoization"

#

basically, before you compute f(a,b,c), you see if you've already computed f(a,b,c)

#

if you have, you return the value it produced last time

#

It's a bit scary to do it with reference types, since you have to make sure you aren't creating a weird conflict

swift crag
rocky canyon
#

i got a question:

say, I want to spawn an object in a radius.. but i don't want to spawn in x distance from another spawned object..
i can say, if the number isn't valid reproduce another value... and that could happen indefinitely if im unlucky like that..
now i could say, if u dont find a valid number by z amount of loops then give up..

swift crag
#

that's called "rejection sampling"

rocky canyon
#

but.. giving up kinda lame.. is this the only way to deal with taht?

swift crag
#

note that for this situation, you can use Poisson disc sampling

rocky canyon
swift crag
#

it's designed to produce roughly uniform looking points where no two points are closed than a certain distance

languid spire
rocky canyon
#

i mean, yea that could work..

swift crag
#

You could fill a space with Poisson disc sampling and then randomly choose points

rocky canyon
#

but the array would end up being huge.. if i really wanted a random feel to it

swift crag
#

(the sampling gradually fills in the space from a starting point, rather than placing down points in random positions)

rocky canyon
#

u saying if u spawn something on Index[p] then don't use p anymore?

swift crag
#

If you have a huge space, then you can just do rejection sampling

languid spire
#

np, as long as you can build it once and reuse it, memory is cheap

swift crag
#

It's very unlikely you'll actually have a problem if the density is low enough

#

randomized algorithms are remarkably predictable (:

rocky canyon
#

well some of my play areas are pretty small

#

and im still trying to achieve a random feel

#

but not much space to work w/ and unity random sucks

swift crag
#

you can also pick random points and then relax them

rocky canyon
#

whats relax them mean?

swift crag
swift crag
rocky canyon
#

ohhh ive never heard of that one

slate haven
#

i checked in playerloop, now?

rocky canyon
#

and unity random sucks*

*in my situation, working in small area's i get repeats often

#

nothing against it.. i'm not gonna write my own RNG for sure

swift crag
#

any random number generator that didn't cause overlaps would be a bad RNG

#

The clustering illusion is the tendency to erroneously consider the inevitable "streaks" or "clusters" arising in small samples from random distributions to be non-random. The illusion is caused by a human tendency to underpredict the amount of variability likely to appear in a small sample of random or pseudorandom data.

Thomas Gilovich, an ea...

rocky canyon
#

i'll look

swift crag
#

These dots have uniformly random positions

swift crag
#

if so, you need to select it in the graph view

#

this looks fine: the playerloop is taking under 2ms

slate haven
languid spire
#

human brain doing what it does best, pattern matching

swift crag
#

Poisson disk (not disc, oops) sampling produces distributions like this

rocky canyon
#

i know exactly what that is now

swift crag
#

You might also see it called "blue noise"

rocky canyon
#

yea yea..

#

ive seen someone do a study on it

#

i jsut didnt know what it was called

swift crag
#

you can hit ctrl-shift-p to pause

rocky canyon
#

pro-tip ^

#

i still cant remember that dang hotkey 🤣

swift crag
#

i keep forgetting the "step one frame" shortcut

rocky canyon
#

isnt it >?

swift crag
#

ah, it's cmd-option-p on my mac

#

so probably ctrl-alt-p

swift crag
rocky canyon
swift crag
#

I use something I copied from a blog post. The finest source.

neat scarab
#

hey everyone! currenlty trying my best to code a simple fishing game :) just wanted to know if anyone knows how to make the rotated fish dissapear once he hits the max he can go (the bottom of the boat)

#

and the score must go to 1, which i think its fairly easy to code...

burnt vapor
lethal bolt
rocky canyon
swift crag
swift crag
rocky canyon
#

3-piece

neat scarab
#

im really new at this

rocky canyon
#

track ur fish's y property of its transform... fish.transform.y

burnt vapor
#

Try finding out what its y value is when it's low enough

rocky canyon
#

just drag an empty gameobject to the bottom of ur boat.. and check the y position

#

that y position will be useful to test if ur fish is above it

#

soo if its y position is > than the y position u desire

neat scarab
rocky canyon
#

noo.. lol i meant to use it to find out what the bottom y position of ur boat is

swift crag
#

No. An empty game object is a game object with nothing attached to it.

rocky canyon
#

and then delete it cuz its just a tool

swift crag
#

They can be useful for creating a "reference point"

#
if (fish.transform.y > catchPoint.transform.y) {
  // catch the fish
}
#

instead of having to do something like this

#
if (fish.transform.y > boat.transform.y - 0.5f) {

}
#

where you figure out that value through trial and error

burnt vapor
#

Not really

#

You should probably just specify a base y value and store that in a serialized value, then you can just modify it in the inspector

#

Both work

rocky canyon
#

i was meaning this.. like if i wanted to find out what the bottom of my potion was..

#

i can use an empty gameobject to position right below it.. and know what the Y is.

swift crag
#

you'd still have to trial-and-error it if you don't directly measure the distance, though

burnt vapor
#

But we currently have three answers concurrently happening here, I suppose we should stick to one since it's already confusing enough

rocky canyon
#

we all agree on this ^

neat scarab
#

okay I already know the position of the y axis... how can i make the fish dissapear when he colides with the boat? thats what im having problems atttt

#

bc he already has a limit

burnt vapor
#

Your messages suggested the object was merely to check the y value through the inspector, so it can be added to the code and then removed. I agree the object is best to use as reference though

burnt vapor
#

The gameobject will be removed altogether

neat scarab
neat scarab
rocky canyon
#
public class IsAboveY : MonoBehaviour
{
    public float YLimit;
    void Update()
    {
        if(transform.position.y > YLimit)
        {
            Destroy(gameObject);
        }
    }
}```
final kestrel
#

does newtonsoft serializer serialize dictionaries?

final kestrel
#

Thank you

burnt vapor
#

It serialized basically anything. Only crappy JsonUtility has trouble with everything

neat scarab
#

!!

#

tyy

final kestrel
#

Like I read that I have to break it down to pieces

burnt vapor
#

It basically serializes irrelevant data

final kestrel
#

it still is the preferred way to use newtonsoft's right?

burnt vapor
#

Yes, you can work around it

final kestrel
#

All right thanks a lot.

burnt vapor
swift crag
#

They can't be arbitrary json values

burnt vapor
#

If Unity added a simple ignore attribute to some of its properties then these things would not have been needed, but alas

swift crag
#

So if you have a Dictionary<SomeClass, AnotherClass>, then SomeClass gets turned into a string

#

you can't have something wild like

{
  [1, 2, 3]: "wow!"
}
#

in my case, my dictionary keys could be looked up via a GUID, so I made Json.NET write out the key's GUID when serializing

#

i think i wound up not serializing dictionaries at all, though, and just writing out lists of keys and values

final kestrel
swift crag
#

a GUID is just a 128-bit identifier, a lot like an int (32 bits) or a long (64 bits)

final kestrel
#

the stuff im watching is using ints instead of guids I believe

final kestrel
#

Ah so all assets have their own guids all right

swift crag
#

this is the pattern i'm using

#

IdentifiableRegistry gives you an object when you give it a GUID. You'd have to implement that yourself (e.g. by loading a bunch of assets from a Resources folder during startup)

final kestrel
#

Nice I'll study the links you sent! Thanks again.

rocky canyon
swift crag
#

my boolean settings are serialized like this

#

i should at least use base64...

#

6 bits per character instead of 4!

rocky canyon
#

fancy

swift crag
#

is it trying to spawn once per frame? i see that it slows down as it goes on

#

(or maybe a fixed number of times per frame)

rocky canyon
#

there a few assets on the store but their paid

lethal bolt
#

if i animate an model with only the basic like Head, torso, stomache, etc and put on an animation that moves the jaw, and finger. Will it still work?

swift crag
lethal bolt
#

Okay

rocky canyon
#

Every Frame yes

rich adder
main anchor
summer shard
#

the rotation is "stuttering", how can i fix that

private void HandleMouse()
{
    float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    transform.Rotate(Vector3.up * mouseX);

    turn -= mouseY;
    turn = Mathf.Clamp(turn, -85, 85);
    cameraHolder.eulerAngles = new Vector3(turn, cameraHolder.eulerAngles.y, cameraHolder.eulerAngles.z);
}

private void Update()
{
    HandleMouse();
}
rich adder
summer shard
#

without it, it's still stuttering

rich adder
#

regardless you should not have it

swift crag
#

did you actually make the change and test it again?

summer shard
#

i've tested it before

swift crag
#

fix it and make sure you're still having the issue

summer shard
#

i do

swift crag
#

if it persists: is it always stuttering, or is it only doing that while you're also moving around?

summer shard
#

always

swift crag
#

Is there a rigidbody on your player object?

summer shard
#

yea

swift crag
#

you should not be directly modifying the transform, then

#

especially if Interpolate is enabled on the rigidbody

#

the rigidbody will overwrite the position and rotation every frame

wintry quarry
rich adder
#

You're rotating in Update while rigidbody processes movement in FixeUpdate

wintry quarry
#

rotate the Rigidbody instead

#

rb.rotation *= Quaternion.Euler(0, mouseX, 0);

swift crag
#

note that this means that the camera will only yaw 50 times per second

#

if you have Interpolate enabled, this will get smoothed out, but it'll also get a tiny bit of delay

wintry quarry
#

nah this one can be done in Update

swift crag
#

Setting the position or rotation of a rigidbody does nothing until the next physics update.

#

Changing the rotation of a Rigidbody using Rigidbody.rotation updates the Transform after the next physics simulation step.

wintry quarry
#

right but - believe it or not this works

#

don't ask me why

swift crag
#

well, sure, it works