#๐Ÿ’ปโ”ƒcode-beginner

1 messages ยท Page 227 of 1

polar acorn
#

then call that function

fathom mist
frigid flume
#

its done but how do i call that function

frigid flume
polar acorn
#

You said you had a function

frigid flume
#

here's what i have

polar acorn
# frigid flume

Make a function that does what you want to happen, and call that function from your button

frigid flume
#

oh sorry i think i understood

#
score++``` right ?
#

i'm sorry if the misunderstanding came just from the word function

#

that i misunderstood

polar acorn
frigid flume
#

i'll show you

#

so basically, instead of void update that would constantly check if button is pressed, i create void function (linked to button) that starts when button is pressed ?

swift crag
#

It's not a "void update". It's a method called Update that returns void (meaning that it returns nothing)

hexed terrace
swift crag
#

And, yes, that's a reasonable idea

uncut shoal
#
Gamepad gamepad = Gamepad.current;
if (gamepad != null) Vector2 stickL = gamepad.leftStick.ReadValue();

why does this tell me Gamepad isn't a real class?

#

I do have the InputSystem package installed

frigid flume
#

may be dumb again but... can't find the function now

uncut shoal
#

using UnityEngine.InputSystem; doesn't work either

#

is it not configured correctly or something?

cosmic quail
#

and you must not have errors

hexed terrace
polar acorn
swift crag
uncut shoal
#

let me check

swift crag
#

e.g. PlayerInput

frigid flume
#

yes now it has errors mb but its because i tried to modify

#

thanks

uncut shoal
#

nope

swift crag
#

If you just installed the new input system, you might need to go to preferences -> external tools -> Regenrate Project Files

#

kill your code editor and reopen it

#

Unity needs to generate a new .csproj file for the input system package, and your editor needs to actually see it

uncut shoal
#

Ok let me try thast

#

yep, worked. Thanks.

#

๐Ÿ‘

frigid flume
#

now that i change to public it showed up

#

It perfectly works now what a great achievemnt

#

thanks a lot for your time

fathom mist
polar acorn
#

Also this is the inspector for the object with the script, I wanted to see the tag on the thing it's colliding with

fathom mist
#

oooh

#

the tag is just "Luin"

#

I made a new one specific to the player character

polar acorn
fathom mist
#

This is the error that started popping up again

acoustic crow
#

Can Someone Help me?

using UnityEngine;

public class SpaceBackground : MonoBehaviour
{
    public bool rotateAstronaut = true;
    public GameObject astronaut;
    private float rotationSpeed = 50f;

    public bool moveBackground = false;
    public GameObject background; 
    private Vector3 backgroundSpeed = new Vector3(50f, 0f, 0f); 

    void Update()
    {
        if (rotateAstronaut && astronaut != null)
        {
            astronaut.transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
        }

        if (moveBackground && background != null)
        {
            background.transform.position += backgroundSpeed * Time.deltaTime;
        }
    }
}

https://www.youtube.com/watch?v=mdedHvFjJuQ

polar acorn
eternal falconBOT
fathom mist
#

Scene 2 is added to the build settingss though? How do I index it properly?

polar acorn
#

You only have two scenes

#

there is no third scene

summer stump
#

That is not its index

fathom mist
#

Can I change them from 0 - 1 to 1 - 2?

summer stump
#

You could add a blank scene as 0...

fathom mist
#

thats what that was for oml

summer stump
#

But it's way smarter to just change your code..

fathom mist
#

OH

#

yes

polar acorn
#

Instead of trying to load an index that doesn't exist, change it to load one that does instead

acoustic crow
summer stump
acoustic crow
#

i want that looping

summer stump
#

Looping of what?

acoustic crow
#

The Space look the video

#

The background Space black with start that not have a ending

fathom mist
#

omg it works now thank you

#

Just need to get the spite to stay loaded in on the next scene haha

summer stump
#

You probably always want like 3 or 9 backgrounds (9 if you can go vertically) always, and when you move onto one of the ones to the side, erase the ones furthest and add new ones in the direction of travel

rich adder
#

I'd change the texturemode to Repeat, make the mesh larger then when it reaches close to edge snap it back

timber tide
#

unity shaders have a tiling parameters you can just run time over to scroll it

rich adder
#

or yeah shaders

timber tide
#

needs to be on repeat too yeah

#
Vector2 offsetSpeed;
material.SetVector("_Offset", Time.time * offsetSpeed);```
Something like that
shell sorrel
#

yeah would just do it in shader

#

though i would not constantly be setting a vector on it

timber tide
#

oh wait it's offset

shell sorrel
#

would do it in the shader, but adding time to the uv's

timber tide
#

It shouldnt be setting every frame

summer stump
#

Definitely the way to go. I was just worried about suggesting something like that haha

timber tide
#

well, I can't expect that unity is updating the buffer every frame

shell sorrel
#

oh, so its this just creating a offset based on when it spawend

#

and its not animating it

#

because of hte use of time, assumed it was for a real time scrolling

timber tide
#

oh, actually I do have to update time from the variable so i guess I am updating the buffer

#

no wait, yeah it's a one time set actually the speed is set once, but I need to continuously pass in time

acoustic crow
rich adder
#

plenty of ones for scrolling backgrounds, but I'd go with a shader as suggested

timber tide
shell sorrel
#

adding to UV's scrolls, so can just do what i have in my screenshot there

timber tide
#

so either shader graph or edit one of unity's shader

shell sorrel
#

or its pretty simple in hlsl too

trail verge
#

Hi there, I just added a new asset pack and unity created a new sample scene to view it and I cant find my old scene anymore. Does somebody know a solution for this?

eternal needle
honest haven
#
    {
        Debug.Log("hover");
        // Check if the display object is not null and active
        if (displayObject != null && !displayObject.activeSelf)
        {
            // Display the object
            displayObject.SetActive(true);
        }
    }
``` i cant get this to work, This is a UI object would that stop it from working
honest haven
#

cheers

fading rapids
#

Hi, In my game i have 2 scenes the main menu where you click start game and the game itself i have a simple script to make an invisible layer (pause menu) appear when you click on pause button the script for it is in the screenshot, in the pause menu it also has a button which says exit if i click on it it send me back to my main menu but when you click play the game starts in timescale 0

#

anyone know how to fix this

#

it does start with timescale 1

rich adder
fading rapids
#

that my game starts with time.timescale 0 after i click exit on my pause menu and then click play

summer stump
acoustic crow
#

How do I make everything line up? If I go down with the scale I have to adjust everything and if I drag longer it's blurry

fading rapids
summer stump
fading rapids
#

no its on a emoty object

#

it is working tho

rich adder
summer stump
#

That's what I'm trying to debug

fading rapids
frigid flume
#

hey, why can't i select any of my TMP here please ? ^^

summer stump
rich adder
summer stump
#

Which points to resume NOT fully working

#

Or timescale being set somewhere else

rich adder
#

I think timescale is a static value that carries over

fading rapids
rich adder
#

so where are you setting it back @fading rapids

fading rapids
#

can i make it so if i clcik my play button on a diff scene it sets my timescale for the next scene to 1

rich adder
#

do the same thing you do for resume ?

fading rapids
#

oh the timescale

rich adder
#

or maybe put an if condition ? so many ways to do it

fading rapids
#

isnt only for one scene its for my whole project

#

i understand now

#

thank you

rich adder
#

yeah you're modifying the setting inisde the unity project settings afaik

#

its a "global" value iirc like Gravity vel

fading rapids
#

yes thank you

tender mirage
#

Should i watch the code monkey full course on youtube?

#

Also is 3D fine to play around with as a beginner?

#

Thank you!

rich adder
#

Almost anything you do in 2D version you can in 3D(methods n stuff)

tender mirage
#

Building 3D engine in 2D pfft.

rich adder
#

unity is a 3D engine regardless

#

the only thing that changes is the Physics engine from Box2D to Physx (3D)

summer stump
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

tender mirage
#

!learn?

eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

summer stump
tender mirage
#

Of course, I'll take a look at it.

fading rapids
#

now why is this not working

rich adder
#

how are you calling pause ?

#

if thats a button , putting KeyDown inside of it is a baddd idea

fading rapids
#

im not using a button

#

pressing q

#

shouldmake the pause page visible

#

it doesnt

rich adder
#

Inputs should be polled inside Update

#

to call a method you want

fading rapids
#

ohyeah true

#

so i dont need the new voids anywhere

rich adder
fading rapids
#

xD

#

sorry dont know the terms

#

public void pause()

rich adder
#

oh those are methods

#

I would still keep them

#

just dont put the inputs in there

fading rapids
#

okay

summer stump
#

if (input)
{
Pause()
}

frigid flume
fading rapids
safe aspen
#

Hey! Any idea what is wrong here?

    {
        Gizmos.DrawWireSphere(transform.position, groundCheckRadius);
    }

Ground Check Radius is shown fine in inspector but its not drawing a wiresphere

slender nymph
#

check your spelling

fading rapids
#

ty

safe aspen
slender nymph
queen adder
#

!code

eternal falconBOT
queen adder
#

there isnt any compiler issues but unity says so

#

any idea why?

fading rapids
rich adder
queen adder
#

I switched back to windows so its configured

rich adder
fading rapids
#

okay lemme try

slender nymph
queen adder
#

I can ask chatgpt to do that wait a sec

slender nymph
#

no

safe aspen
slender nymph
#

show me in the documentation where you see the onDrawGizmos method

safe aspen
queen adder
queen adder
slender nymph
queen adder
slender nymph
slender nymph
queen adder
#

it doesnt tidy it as good as chatgpt

rich adder
safe aspen
#

oh damn , thank you! feeling blind rn lol

queen adder
#

on game screen

slender nymph
#

what are the error(s) that unity shows

queen adder
rich adder
#

can you show the actual console window

slender nymph
# queen adder

i have no idea what this tiny ass sliver is supposed to show. but yeah you should show your actual console window

queen adder
rich adder
#

I have a feeling errors are being collapsed/filtered out

slender nymph
queen adder
#

hmm I dont see it let me google it real quick

slender nymph
rich adder
#

just show us the entire console window first

frigid flume
#

can i put an emoji in a changed text like this ? i can't save the script when i try

#

should i ?

wintry quarry
#

It shouldn't be a problem afaik but just note that you'll need a font that supports the emoji if you want it to show up in game.

#

I don't speak French so I can't make heads or tails of that warning.

lethal bolt
#

Why does Only the S button work

#

I think its something with the IF

wintry quarry
#

so if you're NOT pressing S, you will get the else

queen adder
wintry quarry
#

also you should fix your formatting, it is atrocious

#

another nit - m_eulerAngleVelocity not "eurler"

eternal needle
frigid flume
#

the unicode doesn't work ^^

eternal needle
#

Should work fine, as I've used unicode to show emojis. What specifically doesnt work

frigid flume
#

i type the unicode and it shows the code

#

but anyways the font cant support the emoji i tried

frigid flume
#

i was on the same page x)

#

thx

#

but it doesn't work either sadly ^^

rich adder
frigid flume
#

i have a square instead of an emoji

#

using noto

rich adder
#

in TMP/

#

or Unity

#

might be unity engine itself

frigid flume
#

i applied noto font to a tmp

rich adder
frigid flume
#

i import the .ttf file then selected it

#

oh lol

rich adder
frigid flume
#

i think it works

#

i'll try

rich adder
#

ofc it does

frigid flume
#

but how do i select all these files in the font creator ?

rich adder
frigid flume
#

where do i find that ?

#

no

rich adder
frigid flume
#

i found it but

#

it dosn't work x)

rich adder
#

weird..its working for me

#

are you sure you copied the correct unicode emoji

frigid flume
#

i'll try again but

#

how could i fail that

rich adder
#

some don't work

frigid flume
#

well it works a bit

wintry quarry
#

You simply haven't included whichever emoji you are trying to use

#

there are a crapload of emojis

frigid flume
wintry quarry
#

in huge different swathes of the unicode code space

frigid flume
#

how can i include an emoji if it's not included in noto font

wintry quarry
# frigid flume how do i do that ? ^^'

look up the emojis you want, find their unicode code points and make sure they're included int he character set you choose. If needed use a "custom rangle" which uncludes the codepoints you want

#

If the emoji isn't in the font, it won't work at all

#

it needs to be in the font and you need to include it in your character set

frigid flume
#

thanks i'll give it a try later :)

wintry quarry
#

The "Characters from a file" mode might be convenient for you.

frigid flume
#

seems a bit complicated ^^' it is compatible with another font right ?

#

like using this i can add an emoji to comic ms ?

fading rapids
#

does timescale slow down time aswel?

wintry quarry
fading rapids
#

and gravity

#

etc

rich adder
frigid flume
#

i think i'll add sprites instead it seems to be easier

#

#unity #unity3d #games #indie
๐Ÿพ How to use Sprite Asset in Text Mesh Pro - Unity add icons into a String or Text - Visual Scripting - Unity No Code C - Bolt - Visual Scripting Plus

โœ… Download Icons used in video : https://assetstore.unity.com/packages/2d/gui/icons/2d-items-set-handpainted-210729

๐Ÿ‚ Any questions or discuss about Unity or Visu...

โ–ถ Play video
quaint crystal
#

why does Directory.GetFiles() return strings with extra backslashes in only part of the returned path? the following is after i wrote it to a json file

{
  "files": [
    "D:/Personal/Hobbies/C#/Unity/Project Primary/Assets/resources\\Textures\\dev\\dev_fade.tga",
    "D:/Personal/Hobbies/C#/Unity/Project Primary/Assets/resources\\Textures\\player\\grade_bad.tga",
  ]
}
river roost
#

I assume you wrote the first part with forward slashes

short hazel
#

Upon deserializing, they will be converted to a single backslash in the string.

quaint crystal
#

oh interesting. thank you

quaint crystal
wintry quarry
short hazel
quaint crystal
#

thank you for the tip

native seal
#

whats the best way to do damage numbers in a 2d game? just instantiate a text then remove or use particles?

rocky canyon
#

pooling system.. dont instantiate

short hazel
#

inclusive or moment

rocky canyon
#

have X amount of text elements that u can reuse..

short hazel
#

X or Y?
"yes"

#

But yeah not sure if that's even possible to do with particles easily, you're better off instantiating or reusing a prefab with a TMP_Text on it

vital crow
#

Hi, I'm working on implementing a leaderboard for my game. I've installed the SDK and set up a leaderboard in my Unity Cloud project. I'm writing a script to update it in my game and display it on my scene, but it's not working. I'm not sure which exact functions to use. Can anyone help me?

rich adder
faint elk
#

So my update method doesnt want to run. I have the script enabled and the gameobject is enabled as well. the scene is running and it should be working but theres nothing and console shows nothing

eternal falconBOT
faint elk
novel thorn
#

guys how do i manage collisions between 2 prefabs with the same script

#

same tag also

#

i just cant figure it out :c

rich adder
faint elk
#

there is one in the update

rich adder
#

and its not printing ?

faint elk
#

nope

rich adder
#

so your script is not running

faint elk
#

no its running

rich adder
#

Debug.Log missing says otherwise

faint elk
#

i found it. It got overloaded

polar acorn
north kiln
#

if you only want one side to trigger, compare their instanceids

novel thorn
#

i have a prefab, i want to collide with other gameobject created with the same prefab
if they collide they run the collider function twice

polar acorn
novel thorn
#

they are creatures, so if you drag one to another they breed a third

#

so i need to get data from both to make the new prefab with that data

polar acorn
# novel thorn they are creatures, so if you drag one to another they breed a third

Okay, so it doesn't matter which one actually runs the function. So, you can check if the other object you collided with has the same script, and if it does, check their InstanceIDs like vertx suggested.
https://docs.unity3d.com/ScriptReference/Object.GetInstanceID.html

They'll have unique IDs, so you just have them check it and if the other object's InstanceID is higher than this one's, don't do the function. In any collision, only one will ever run

novel thorn
#

so any of the prefabs will have a unique id?

#

and will be higher in a new prefab

rich adder
novel thorn
#

okay yeah, sorry

north kiln
#

None of them are "prefabs" at this point. At runtime the concept of a prefab doesn't exist

novel thorn
#

the new gameobject generated by the prefab

frigid sequoia
#

Does the order of component assignment in the inspector matter at all?

north kiln
#

If your code relies on it then your code's the problem

autumn tusk
#

ok im wondering here

#

im working on a teleportation system for a stationary enemy

#

basically if you get out of range of an enemy it teleports to your position with an offset

#

how would i add an offset

polar acorn
rich adder
autumn tusk
#

i am aware

north kiln
#

you want a normalized direction scaled by the distance you want to move

polar acorn
autumn tusk
cerulean crypt
#

Hey there. I'm trying to make a grid gameobject to visualise A*. Anyway, I'd like the grid to be customisable in size and have different obstacles etc. Is there some kind of way to create a custom object type that would let me customise (and see the customisations) in the Scene window? Ideally would be similar to how you can create a "3D Object" and it comes with certain components already on it. I could do it at runtime using scripts etc but it feels a little clunky to have to spend ages fetching each cell's behaviour script just to change

rich adder
graceful flicker
#

Hello, I have a problem with unity new input system. It is not reading mouse delta right now. I have set Action to value - vector2 and binding to delta mouse but I get no values when I move my mouse. Gamepad works fine but mouse is not working. Any ideas why is that happening?

wanton hearth
#

Can someone tell me the simplest event method that gets a MouseDown/Up event? Like, for any click in the game window, regardless of context.

I'm just protoyping and found a couple different options in Unity docs, but they seem to be associated with UI systems?

wanton hearth
#

upon mousedown, rather

wanton hearth
polar acorn
#

if you just need to know when a button was clicked, that's input

wanton hearth
#

true

naive tapir
#

Could someone link a good tutorial for like a basic 3rd person movement and camera system?

timber tide
#

Download unity's first person shooter template and dig through it (you can modify it for 3rd person with a little research)

naive tapir
#

thanks

timber tide
#

you can download it right from the hub

naive tapir
#

Unity default lighting looks like 2006 Roblox

vital crow
#
var playerEntry = await LeaderboardsService.Instance.AddPlayerScoreAsync(leaderboardId, scoreToAdd)

Where can i add the username here pls?

thorn holly
#

If I were to say, make a mesh of a cube, I could make a 3d List of verticy positions and make the position of each verticy based of the index of the different layers of the list, corresponding to length width and height. But if I were to make say, a tetrahedron, I donโ€™t know how Iโ€™d do something like this. Does anyone know how?

teal viper
vital crow
#

i didn't find anything in the documentation

teal viper
timber tide
vital crow
teal viper
arctic harbor
#

trying to make the camera of a 2d platformer smoothly follow the player so sudden movements aren't as jarring (ie from the player respawning elsewhere or teleporting). i've applied the stuff here https://docs.unity3d.com/ScriptReference/Vector3.SmoothDamp.html to my existing code and it does seem to work in making the camera smoothly move over after teleporting, but the camera overall has some weird jittering to it (can't seem to record it with a recorder). anyone have some suggestions?

    public float leftLimit = 4.34375f;
    public float rightLimit = 999.65625f;
    public float smoothTime = .3f;
    private Vector3 velocity = Vector3.zero;
    private float intermediateCameraPosition;

    private void LateUpdate()
    {
        intermediateCameraPosition = Vector3.SmoothDamp(transform.position, targetTransform.position, ref velocity, smoothTime).x;
        transform.position = new Vector3(Mathf.Clamp(intermediateCameraPosition, leftLimit, rightLimit), transform.position.y, -10);
    }```
vital crow
teal viper
#

If the docs don't mention it, then there's probably no way to do it.

vital crow
#

so for you a leaderbord is just a list of scores?

teal viper
#

It doesn't matter what it is for me. What matters is what the service and it's API allow. And it's defined in the docs.

rich adder
#

oh nvm thats for the meta data

#

just so you know the username comes from the unity auth..

vital crow
#

yes ty! but i just wanted to know if its possible to change the "name" in the lb

native seal
frigid sequoia
#

There is no way of setting any variable based on another outside of runtime right?

#

Like... link these two values by default on the script preset itself, it should be in the declared on the weigthedList only correct?

summer stump
frigid sequoia
gleaming nymph
#

I have that script:

    {
        if(Statistics.IsMovingObject == true)
        {
            Statistics.MovedObject.transform.position = CameraTransform.transform.position + CameraTransform.transform.forward * distance;
        }
    }

public void MoveObject()
    {
        if (Statistics.IsMovingObject == false)
        {
            rb = Statistics.MovedObject.GetComponent<Rigidbody>();
            Statistics.MovedObject.transform.parent = Player.transform;
            Statistics.IsMovingObject = true;
            rb.isKinematic = true;
            rb.detectCollisions = false;
        }
    }```

Its code for moving items by using mouse0 on it.
And its working (not full code). Object stand in front of player.

But i have problem, objects are shaking / trembling / idk how to explain when moving.

Sending settings of rigidbody:
summer stump
gleaming nymph
rich adder
summer stump
gleaming nymph
summer stump
#

MovePosition works with kinematic

gleaming nymph
#

oh

tender stag
#

calculation in HandleSpeed calculates how much force to add to reach speed limit, problem with it is that it doesnt add the force in the slopeMoveDirection because slopeMoveDirection is only used in the targetVelocity calculation and not in the final calculation, so the force doesnt get added in the direction of the slope but just forward which causes my character to bounce when walking down a slope since the force is added forward and not down for example with the slope angle

Handle Input - Update ```x = Input.GetAxisRaw("Horizontal");
y = Input.GetAxisRaw("Vertical");

moveDirection = orientation.forward * y + orientation.right * x;
slopeMoveDirection = Vector3.ProjectOnPlane(moveDirection, slopeHit.normal);```

Handle Speed - Update ```Vector3 targetVelocity = slopeMoveDirection.normalized * moveSpeed;
Vector3 velocityDifference = targetVelocity - rb.velocity;

slopeMoveVelocity = new Vector3(velocityDifference.x, 0, velocityDifference.z);```

Handle Movement - Fixed Update rb.AddForce(slopeMoveVelocity * acceleration);

basically what i need to do is to include the slopeMoveDirection.normalized in the final calculation to add the force in the direction of the slope instead of just straight as its doing now because slopeMoveDirection.normalized is not involved

barren wing
#

seรฑoras, i have a problem, this code, teleports an object (aliados) below the feet of the player even if its on the air?

#

basically something like this xd

rich adder
#

also good idea to make sure sure the ray is long enough

#

Debug.DrawRay

barren wing
#

thats the code of a friend xd

#

ill tell him

#

ty

polar acorn
#

Why would you ask a code question if you cannot change any of the code

barren wing
#

he isn't in the server

frigid sequoia
tender stag
barren wing
#

im just tryna help :^(

barren wing
#

actually not a bad idea

#

xd

frigid sequoia
teal viper
frigid sequoia
# teal viper What exactly are you trying to do?

I have these "orbs" that are just like powerUp pickups, they are meant to spawn as reward after doing certain stuff, but the one that generates is randomized, based on their rarity level, so I just though it would be more manageable if the rarity had a correlation to the amount of weight it has on the pool on the orb prefab itself rather than assigning it from the weightedPool, but maybe I am just wrong

gleaming nymph
whole badge
#

Newbie here, if i create a 2d rpg pokemon clone on desktop, can i make it run on the iphone later? or do i have to code the game with ios in mind from the beginning?

summer stump
#

You need an iphone to test jt though afaik, and a mac to build it? Not 100% sure

whole badge
#

I see, my question is, ANYTHING you make on unity can be run on ios? Or are there things I need to look out when coding for steam vs ios

gleaming nymph
gleaming nymph
#

its teleporting

frigid sequoia
#

Also, just something unrelated (and probably not that much important cause I have to implement each powerUp separetely anyways and I could set the description from the script), I want to have a description on the script that is just a string parameter to set in the inspector. How can I make it like have paragraph and stuff? Like can I change the format? Should I just not be using just a string for that?

summer stump
#

Gotta know a little more about what you mean to help though

gleaming nymph
#

its teleporting by ~ 3 seconds, not moving smoothly

#

i add same parameters like in script i send, and on end multiply by time deltatime and speed 5f

low path
#

What do you mean teleporting by 3 seconds?

gleaming nymph
#

it stands in one positions for ~ 2/3 seconds and then teleports for new

#

its not moving smoothly like its should, its teleporting

summer stump
#

No way we can help without it

gleaming nymph
#

CameraTransform.transform.position + CameraTransform.transform.forward * distance * Time.deltaTime * m_speed

#

sorry im on phone now

#

thats parameters

#

of moveposition

summer stump
#

Hopefully this was moved to FixedUpdate? That's where all physics movement should take place (like in the docs link I sent earlier)

gleaming nymph
summer stump
gleaming nymph
#

i think i should make one position and then multiply by time and speed

summer stump
#

And the movement of the camera is likely the issue with jerkiness from the very beginning

soft steppe
#

Hi with my character controller script every time i go down stairs/slopes the speed is really slow compared to going up, i have tried multiple "fixes" i found online but none worked for me.
anyway this is my movement script and gravity
Movement:

private void movePlayer(Vector2 ctx)
{
    if (!characterController.isGrounded)
    {
        return;
    }
    CurrentVelocity = Vector3.zero;
    Vector3 moveDirection = new Vector3(ctx.x, 0f, ctx.y);
    if (moveDirection.magnitude > 1f)
    {
        moveDirection.Normalize();
    }
    moveDirection = transform.TransformDirection(moveDirection);
    characterController.Move(moveDirection * (isSprinting ? playerSprintSpeed : playerSpeed) * Time.deltaTime);

}

and Gravity :

private void applyGravity()
{
    Ray groundCheckRay = new Ray(transform.position, Vector3.down);
    if (Physics.Raycast(groundCheckRay, 1.25f) || characterController.isGrounded)
    {
        CurrentVelocity.y = -2f; 
    }
    else
    {
        CurrentVelocity.y -= GravityForce * Time.deltaTime;
    }
    CurrentVelocity.x -= Mathf.Clamp(CurrentVelocity.x, -Drag, Drag) * Time.deltaTime;
    CurrentVelocity.z -= Mathf.Clamp(CurrentVelocity.z, -Drag, Drag) * Time.deltaTime;

    if (Mathf.Abs(CurrentVelocity.x) < 0.001f)
    {
        CurrentVelocity.x = 0f;
    }
    if (Mathf.Abs(CurrentVelocity.z) < 0.001f)
    {
        CurrentVelocity.z = 0f;
    }
    characterController.Move(CurrentVelocity * PlayerMass * Time.deltaTime);
}
obtuse osprey
#

im like completely brand new to coding other then like hello world in python and am trying to start off by making a 2d game with no animation or hardly any maybe just basic ones buti cant find any good guides? anyone have any helpful links?

gleaming nymph
obtuse osprey
#

im mostly focoused on making a simple game with good features and play to eventualy make it 3d and alot more advanced

slender nymph
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

night mural
# obtuse osprey im mostly focoused on making a simple game with good features and play to eventu...

there's also this if you prefer that kind of content https://www.youtube.com/watch?v=XtQMytORBmM

๐Ÿ”ด Get bonus content by supporting Game Makerโ€™s Toolkit - https://gamemakerstoolkit.com/support/ ๐Ÿ”ด

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...

โ–ถ Play video
sage folio
#

hey, i made a blend tree for my jump animation, i have the jump, falling, and landing animation all together inside, what i'm wondering is how do i increase and decrease the number in my script? i have a 2 if statements, one for when i push the jump button, and one that checks if you are on the ground

rocky canyon
#

cinemachine
it has a component that'll do all this for you..
can define the deadzones, how tightly it follows, smoothness, all that

sterile moon
#

How do I set my game up to not use URP or HRRP, just default render pipeline, I need some features of the camera that are not availble in URP

rich adder
arctic harbor
sterile moon
#

ah, shit, easy enough lol

dark laurel
#

โค๏ธ

#

racking up those imaginary internet points for a big shopping trip

arctic harbor
dark laurel
teal viper
dark laurel
#

But as far as your question is concerned - you'll wanna look up the unity lifecycle and become aware of when in the cycle stuff all happens, like physics and rendering - it's likely you've got some logic on your camera that is tied to physics, which doesn't happen in Update, it's in FixedUpdate.. but I'll admit I only skimmed the above convo, so I apologize if that's off the mark

arctic harbor
arctic harbor
#

to my knowledge unity tries to run FixedUpdate by default 50 times a second, regardless of framerate, while Update runs once per frame and FixedUpdate once per frame after every Update has run

teal viper
arctic harbor
#

okay maybe interpolate does work...? seems the interpolate option doesn't change properly if changed in play mode...

#

if set the rb to interpolate, then start play mode, it seems to work fine, but if i switch it to none while still in play mode, it jitters, and if i set it back to interpolate (again while still in play mode) the jittering remains

#

i'll look into cinemachine for future projects but this one i'm currently working on isn't supposed to be a big one and i don't think i'm gonna need to touch the camera anymore after this so

timid quartz
#

if I were modeling something that was meant to be the same size as the unity default "Plane" mesh, how big would that be? I think this means 10 by 10, right?

#

but, like, 10 by 10 what? meters?

north kiln
#

Unity's units are meters, yes

timid quartz
#

awesome, thank you

teal viper
shell sorrel
#

keep in mind unity uses meters, but what matters us how you use it

#

like means very little if you art is very tiny or huge and generally not adhering to 1 unit == 1 meter

arctic harbor
#

actually maybe i should ask what the ref velocity in transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime); does too

nimble apex
#

rendering an UI image is less expensive than rendering a mesh right? for 99% situations, assume theyre using the same texture(source image)

#

because rn the previous members in my team use meshes + texture to render all UI images

night mural
#

how many verts are the meshes? if they're just quads it should be pretty much the same

nimble apex
#

i gotta check on that lol

nimble apex
#

wait

#

oh i see why they did that

teal viper
arctic harbor
teal viper
arctic harbor
#

that's what i meant

#

point is we can then later use velocity for something else right

teal viper
#

Sure

arctic harbor
#

and i assume cinemachine actually gives you more control over the easing function

teal viper
teal viper
arctic harbor
#

well yes but just for example if i wanted a sharper ease in and out function or linear or something

teal viper
#

Yes, cinemachine provides all kinds of settings related to camera movement.

arctic harbor
#

okay thank you

pliant ridge
#

hey im trying to setparent a 1 by 1 by 1 sphere to a cube scaled 20x20x1 but the spheres get stretched for some reason no matter what i do

#

im spawning them at the end of a RaycastHit

rich adder
#

you are parenting them

#

the child inherits the scale

pliant ridge
rich adder
pliant ridge
#

thats an issue

#

because

#

i want to be able to spawn these spheres parented to literally anything in my scene

#

so that would require everything in my scene having an empty parent

rich adder
#

usually should never be mixing scaling/graphics with the root objects

#

and the collider if must exist on parent for RB reasons, then the collider component gets the sizing not the object transform

pliant ridge
#

so i have to make a parent on everything and gett that

#

thats so much more work ugh

#

ok

#

this is literally for like an assignment i didnt wanna put that much effort in

rich adder
#

You could try maybe creating a gameobject at runtime and parent it to that

#

dunno if it will work

rich adder
#

I think if you make another chilld at the hit.point then parent the sphere to that instead of the one with scale. (Some performance implications though with new() GameObject each hit)

teal viper
#

You could try resetting the lossy scale(I think it was?) After parenting.

pliant ridge
#

okay wait

#

no nm

teal viper
#

Oh wait, it's read only

night mural
pliant ridge
pliant ridge
#

position constraints seem like a lot more work in code

night mural
#

not really, you just assign the object to the constraint instead of as a parent

night mural
#

it is lame that they have no code examples but you're just adding your 'parent' as the constraint source

pliant ridge
#

i added constraints to my prefab for the sphere

night mural
#

when you add a source, does its weight default to 0?

#

might need to set that too (and don't add it twice? why are you adding it twice?)

pliant ridge
#

weight is 1

native seal
#

anyone know what this is referring to?

pliant ridge
night mural
night mural
teal viper
pliant ridge
native seal
#

when I dont disable it or enable it

night mural
#

it has an offset i think, that you can set if you want it to stick where it hit

pliant ridge
#

ah

#

i see the issue

#

i have no idea how to do that lol

#

i need it to spawn at the end of a raycast

#

then be parented to whatever the raycast hit

night mural
#

under constraint settings, there's a 'position offset'

solid sail
#

Can't "Time.time" be used in delegate?

pliant ridge
#

but like, how do i make the position offset what it needs to be

#

for it to be where the raycast hit the object

teal viper
night mural
#

oh, it'll be the difference of the position of the parent position and the object's current position (or i guess the hit point, in your case)

teal viper
native seal
#

no idea why it was even there

#

i assume some component automatically added it

pliant ridge
#

wait

#

im dumb

teal viper
foggy pine
#

yo guys what is the best way to make a game multiplayer?

teal viper
solid sail
teal viper
#

The problem is not the delegate itself, but where it is called from.

solid sail
#

Ohh I recall the delegate are called in ReceiveCallback

pliant ridge
# pliant ridge

theyre spawning on like the opposite side of where they should be

solid sail
pliant ridge
teal viper
pliant ridge
#

I GOT IT

#

i needed to use inversetransformdirection

#

yippee!

native seal
#

say the rigidbody on my projectiles have continious detection on but my enemies have discrete on. Is that a waste since the projectiles will still miss detections due to the enemies mode?

#

turning continous on for enemies tanks fps so

teal viper
#

It would help in half of the cases imho.

#

Specifically, if the collision was triggered by the projectile moving.

native seal
#

okay so keep it on

faint sluice
native seal
#

but its still missing when its flying fast

#

so i figured it was because the enemy was on discrete

faint sluice
# native seal but its still missing when its flying fast

If speed is too much it can still miss even if both have continuous on

Because it checks for collision every frame

Say projectile is still yet to touch the enemy in first frame, but if it's already passed the enemy in the next there won't be any collision detected

native seal
#

so no way to improve detection past that

faint sluice
native seal
#

so at a certain speed turn projectiles into raycasts?

faint sluice
#

No you normally want to have either one system in your game.. either all bullets are physical or all bullets are raycasts

native seal
#

so if they were physical no way around it

#

raycasts wouldnt really make sense

north kiln
faint sluice
# native seal so if they were physical no way around it

What i meant by raycast was if you really want to have a physical bullet you can check for collision by raycast when you fire the object , and if raycast returns the collision. You can manually calculate how many seconds later the collision occurs and then call the collision on desired object after that duration

native seal
#

ah okay

#

interesting

#

would that be efficient with 100s of projectiles and enemies?

faint sluice
teal viper
faint sluice
faint sluice
native seal
#

so any idea why my projectiles are missing?

#

even on continuous

north kiln
#

Are you using Box, Sphere or Capsule colliders?

native seal
#

circle 2d

north kiln
#

Ah, 2D

native seal
#

yep

teal viper
faint sluice
#

That's why it's accuracy is ass for even remotely fast objects

teal viper
#

Yes. All of them do it every physics frame. Checking collision in regular update would probably be a bad idea

north kiln
#

Physics only operates on fixed update, there's never a time it occurs on a frame. It's only moved every frame if interpolation or extrapolation is enabled, but that doesn't mean it's doing any physics calculations

north kiln
#

And is one of the bodies static, or are both dynamic

native seal
#

both dynamic

#

and when the projectiles are at high speeds they are passing through

teal viper
#

The other involved object is also moving and doesn't have continuous detection, so there's plenty of room for it missing.

north kiln
#

I am unfamiliar with 2D, but they don't seem to distinguish a Continuous Dynamic, so perhaps they only support it against static

native seal
#

there is a continous option though

north kiln
#

Yes, which in 3D means dynamic bodies sweep against static ones

#

3D also has a Continuous Dynamic, which does dynamic-dynamic sweeps, but I am unfamiliar with 2D and don't know whether its Continuous is Continuous Dynamic or not

native seal
#

okay

acoustic sun
#

What is back.cs?

#

I heard it comes with Unity

north kiln
#

Surely if you read this somewhere you would provide some context

acoustic sun
#

I was told that my back.cs script has been delted. It was part of an assignment I was doing for class. I accidently saved it as a score file but, it crashed everything so I ended up deleting it.

frosty hound
#

Where did you "hear" that it comes with Unity?

summer stump
acoustic sun
summer stump
#

So far nothing you've said makes any sense

acoustic sun
#

Im sorry I am new to unity

summer stump
# acoustic sun Im sorry I am new to unity

I guess to answer your first question: no one seems to have heard of back.cs or have any idea what it is.
You've been asked who told you it was a thing, but haven't answered it. Then brought up cameras, saying "it" was saying something.
What is it? Who told you about back.cs? What are you actually asking?

That would help clarify, so that we could answer you

faint sluice
summer stump
eternal needle
# acoustic sun Yup thats correct

Has your class taught version control yet? If not (and if you're not using it) then start using it.
The script is likely just in your recycling bin.

acoustic sun
#

Okay. Im still getting the issue that it cannot open my OneDrive\Library\Bee\artifacts\2000b0aE.dag\Assembly-CSharp.dll'. I have tried to move it to Desktop but I am still getting the same issue when I run it as well

summer stump
#

Oof. Do not put your project in onedrive

#

Desktop is a bit better I guess

#

What did you try to move though. The project or the file?

acoustic sun
faint sluice
summer stump
#

Oh, you're trying to open a dll? Interesting.

acoustic sun
faint sluice
#

As a beginner I wouldn't touch DLL files

acoustic sun
summer stump
teal viper
#

Get to the point. What is the actual issue?

#

If there's an error, share the whole error here. Or maybe even take a screenshot of it.

acoustic sun
#

That for some reason I am getting an error message when I try to run the game. Its saying that it cannot open OneDrive\Library\Bee\artifacts\2000b0aE.dag\Assembly-CSharp.dll

teal viper
#

Take a screenshot of the error.

#

Also what do you refer to by "run the game"? Clicking the play button in unity or building and running it?

acoustic sun
acoustic sun
teal viper
#
  1. The project is still in the one drive directory. Move it to a root of your disk or something.
#
  1. Do one first.
acoustic sun
#

How do I make it move when its already leaked to the project?

teal viper
#

Move the project.

acoustic sun
teal viper
#

Go to the project path. Copy the project folder, paste it in C:\ . Add it in the hub again.

charred spoke
#

Some basic computer literacy is required to make games

#

If you can not move a folder I suggest learning that first

teal viper
#

They probably thought that if a project is added to the hub, it can't be moved.

sly wasp
#

How would I make a part of a mesh that I assigned a vertex group to in blender move the uv of that vertex group based on the position of a bone

charred spoke
#

Vertex groups dont exists in unity

bright zodiac
sly wasp
sly wasp
charred spoke
sly wasp
#

Verts?

charred spoke
#

Vertices

hollow palm
#

I try to convert inputfield text to int but it always come error line 43.
I already set input field to contains only integer number.

Any idea how to solve this issue?

hollow palm
rich adder
#

iirc the built in InputField gives a weird char in there

hollow palm
rich adder
#

are you ?

hollow palm
#

yea

sage folio
#

(https://hatebin.com/vqbohqlpey) hey i have been trying to implement a easily maluable double jump toggle for my movement script for my 2D platforming character, but no matter what method i try i believe i am confused and blocked in the way by a previous feature (jump buffering), what would be the best way to impliment double jump? and could i possibly move the jump buffering to a seperate function that could be used when needed more practically?

hollow palm
#

legacy input field

rich adder
#

yup

#

I think you can verify and print string from .text before the parsing

hollow palm
#

oh i see

#

wait, is .text variable already string?

rich adder
#

yea

verbal dome
hollow palm
rich adder
#

do you need a field that only wants numbers?

hollow palm
#

ya

rich adder
#

Tmp Inputfield has that built in

hollow palm
#

ok ill try that

hollow palm
rich adder
hollow palm
#

yea it work using TMP. Thanks for the help. Have a nice day

nocturne parcel
#

What is the 2d version of Vector3.ProjectOnPlane? There is no project on line

#

Or can I just use the Vector3 and ignore the z axis?

#

Wait, vector - dot, right?

verbal dome
nocturne parcel
#

I'll try both, see if there is any difference

teal viper
#

Your plane would just be orthogonal to the camera plane

stone elk
#

is there a way to disable my floating joystick while im in the main menu?

brisk escarp
#

Dose anyone know a good 3d tutorial on how to pick up items and put them into my Inventory?

trim gulch
#

Hi! Is there any way to assing different instances of the same prefab to different events? In my game I have a door prefab, with an open function. Let's say I have a "FirstBattleOver" event, and a "SecondBattleOver", and I have two doors that are them same prefab for the room for each battle. Is there any way for me to assign them their events withouth having to create another script?

trim gulch
teal viper
# trim gulch How could I do that?

Well, maybe provide some more details, because it's not entirely clear what you're doing. Are the prefab instances spawned at runtime? Where do you assign the events?

topaz thistle
#

!code

eternal falconBOT
trim gulch
#

The prefabs are part of the map

#

So what I do is

#

I have a door script

#

Where, in code, I suscribe the "openDoor()" and "closeDoor()" functions to its corresponding event

topaz thistle
#

I'm trying to make my character move horizontally and vertically using rigidbody.velocity :https://hastebin.com/share/misoxusomi.csharp
Could anyone provide some advice? I understand the local and global aspect in transform.translate, but not with Rigidbodies

trim gulch
#

Like "GameManager.FirstBattleOver += openDoor"

#

But if I do that, when I want to create a door that is exactly the same but opens for the second battle, I'd have to create another whole script

#

So I'm trying to find a way to assign them in the inspector

#

So I can use the same script for all doors

teal viper
small gull
#

yo can someone help me

burnt vapor
#

At least share the error if that's what you are hinting at

small gull
#

i did

small gull
#

theres a } there idk how to fix it

#

mb if im confused or smthing

topaz thistle
#

Hey everyone, I didn't get a response, so i'm just asking the question again, how would I move my character around according to it's rotation with rigidbody.velocity. https://hastebin.com/share/misoxusomi.csharp

teal viper
ocean dove
burnt vapor
#

Hence the request to just share the error instead of making it guesswork

#

Until then we can't help

#

It's important you also learn to debug the issue yourself even though it's fairly obvious what is wrong

ocean dove
#

I guess they removed the } from the monobehaviour at the end of the script

small gull
#

dawg this is my first time doing allat

#

im watching a tut

burnt vapor
#

So what is so hard about sharing a screenshot of the error?

teal viper
burnt vapor
#

Hover over the red line and screenshot the message, or screenshot the Unity console when you compile

small gull
#

ok

#

one sec

burnt vapor
#

If you hover over the error it will also very clearly explain what the issue is, so you could even find out what goes wrong yourself

solid sail
#

If I pass "HelloWorld" to invoke 1st method then does 2nd method. Will the output be same? Seem like not same.Where I did wrong?

#

The question is the same as well as converting Int and string with each other.How to do it?

teal viper
burnt vapor
#

You're better off asking the !cs Discord for this or maybe #archived-networking considering handling bytes is mostly a networking thing

eternal falconBOT
burnt vapor
#

I never used endianness but it looks okay so idk

burnt vapor
#

@small gull Any luck with the error?

small gull
#

thanks lol

languid spire
burnt vapor
#

I made a Packet class and just resorted to using Encoding.ASCII for writing and reading instead of whatever BitConverter is

languid spire
#

i'm not sure how you expect "Hello World" to be stored as a single int value

burnt vapor
#

Also, maybe you should add some sort of indication when the string ends, assuming your byte buffer will contain more than just the string. For example, end with '\0' indicating null termination, and check for that when reading. Alternatively write a byte before the string indicating the length.

solid sail
burnt vapor
#

You can obviously ignore this if this does not apply

languid spire
#

Really, if this is for Web Encoding you shoud use UTF8 not ASCII

solid sail
#

But if I invoke the 2nd method with int sent by C++. I get the wrong string

burnt vapor
jaunty girder
#

Hi

ivory bobcat
#

Is this Unity related?

burnt vapor
#

I will use these suggestions in my next Unity networking project

teal viper
jaunty girder
#

I start use wits unity

#

Bad english

rare basin
#

ok

languid spire
languid spire
solid sail
teal viper
#

Oh, it wasn't about parsing, ok...

languid spire
#

So what you have is fine as long as you use ASCII and never use a string longer than 4 characters

solid sail
#

Yup.But thanks to u I got to know something important... Otherwise if I use 5 more characters it will raise an error and makes me big headache

languid spire
#

just wont work because when to convert to int the last character (if you use a 5 character string) will be ignored

#

Also you should really use UInt32 rather than Int32

solid sail
#

awkwardsweat My supiror was nearby. I have to hide....

#

So there's no alternative to make it?

languid spire
swift elbow
#
    {
        if (other.CompareTag("Soul"))
        {
            AudioSource.PlayClipAtPoint(shriek, gameObject.transform.position, volume);

            Destroy(other.gameObject);

            UpdateCachedSoulsArray();
        }
    }

    void UpdateCachedSoulsArray()
    {
        souls = GameObject.FindGameObjectsWithTag("Soul");

        soulsInScene = souls.Length;

        if (soulsInScene == 0)
        {
            DisableRandomWall();

            Debug.Log("All Souls Have Been Collected");
        }
    }```

for the code above, the int "soulsinscene" never goes below its starting value because even though there are no assigned gameobjs with the tag "soul" in the scene, there is still at least 1 element in the array. this is because in the OnTriggerEnter func, the gameobj with the tag is destroyed but the element that had stored its value in the array is now null. how can i make it so that i set soulsinscene to however many elements in the array that are not null?
#

is there something better to use instead of souls.Length that im unaware of?

solid sail
pallid nymph
languid spire
swift elbow
pallid nymph
swift elbow
pallid nymph
#

but you find them by tag there

#

don't find them again, find them once and update the list manually on destroy

swift elbow
#

is that not what im doing right now?

languid spire
#

Yep, HashSet<int> and use GetInstanceID() should work well for this

pallid nymph
#

no, you're doing souls = GameObject.FindGameObjectsWithTag("Soul"); which finds them at the moment of updating

#

my general assumption is that because Destroy actually destroys things later in the frame, you still Find the thing that was just destroyed

#

you could try doing souls = GameObject.FindGameObjectsWithTag("Soul").Where(obj => obj != null).Count(); if you want to be lazy, buuut am not sure if it becomes null immediately or again later in the frame

swift elbow
burnt vapor
#

Because Count counts the result

acoustic crow
#

What i make wrong ๐Ÿ˜ฆ

I want see Options and the Gears in the Game view but...

swift elbow
burnt vapor
#

The actual fix would be to stop using FindGameObjectsWithTag and just have a singleton manager with a buffer that holds all souls by reference

#

Then ask the manager for whatever you want

pallid nymph
#

but of course, as mentioned not doing Find again is preferable, Find sucks, tags also suck

burnt vapor
acoustic crow
swift elbow
burnt vapor
#

UpdateCachedSoulsArray would be in the manager and rather than finding them all by tag you could have a List buffer that is filled with souls that spawned. The souls could register to the manager when they spawn, or you could have a special "spawn" method in the manager that spawns the souls for you

sterile moon
#

Currently having issues with this code segment I followed a tutorial on. I think they did something wrong as comments on the video also complain about this issue. Here is the code https://hastebin.com/share/vucekifuvo.csharp

My issues are, the when its dropped or thrown the object changes size, more and more every time. And my other issue is that I can't rotate the object once its picked up. It just moves the mouse, I know I need to disable mouse movement, but cant find a good way to do it

opal portal
#

Hello there, I've been testing a bit with RigidBody, is it a bad praxis to (just for walk) force the speed with rb.velocity = motion, instead of using rb.AddForce(motion)?

teal viper
teal viper
opal portal
#

is the easier way i found to limit velocity without extra calculations ๐Ÿ˜› xD

steep warren
#

umm hey, I cant see text on my buttons can some1 help me with that?

nocturne parcel
# nocturne parcel I'll try both, see if there is any difference

Btw, using ProjectOnPlane and vector - dot both works. I decided to use the latter just so I can pretend I'm a good programmer who can create solutions to my problems on my own. But if you ever feel the need to project something onto 2d: you may just use the Vector3.ProjectOnPlane. It works as ProjectOnLine the same.

steep warren
queen adder
#

how can I fix this

#

It was working fine then I imported 7 assets

#

this happent

scarlet skiff
#

my collision is still not working

The players parry hitbox has this script: https://gdl.space/lerukiyeju.cs

Everything that has the Parryable should be added to a list, but it wont even detenct the collision.

The hitbox has trigger collider, and the projectile has rb and trigger collider, i use a ontriggerenter2d, why wont it work?

languid spire
#

screenshot the inspectors of both objects

queen adder
#

public Text CounterText;

private int Count = 0;

private void Start()
{
    Count = 0;
}

private void OnTriggerEnter(Collider other)
{
    Count += 1;
    CounterText.text = "Count : " + Count;
}
#

trying to increase the count in numbers if collided

#

when collided it wont increase counter and will give these errorrs

pallid nymph
#

CounterText is probably null

hexed terrace
eternal falconBOT
queen adder
#

colliding with "box"

#

it increasese counter

#

box has the script

#

so I copy pasted one of the cubes here

#

and added script to it

#

thought it'd work

queen adder
#

doesnt work with the cube I copied from the box parent

fierce shuttle
hexed terrace
#

counter text is null like @pallid nymph said

scarlet skiff
#

and the to be parried object:

hexed terrace
# scarlet skiff

this doesn't have a rigidbody, so it won't receive physics events (ie: Your OnTrigger methods in PlayerParry.cs wont get called)

pallid nymph
#

(only one of the objects need a RB for events to work, just FYI... although a moving object must have a RB, so yeah, you probably do need to add one)

hexed terrace
#

A moving object that requires physics events must have an RB

pallid nymph
#

A moving object that has a collider should also have a RB

hexed terrace
#

nope

pallid nymph
#

yes

hexed terrace
#

A moving platform doesn't need an RB

queen adder
queen adder
pallid nymph
#

it doesn't strictly need one, but it really should have one for performance and stability reasons, it's in the docs

scarlet skiff
#

i cant even add a rigidbody to the hitbox cuz the parent already has one.. or something

pallid nymph
#

otherwise it's considered static (and it really is not, because you know, moving)

languid spire
hexed terrace
#

it will only be considered static if you mark it as static.. surely

pallid nymph
hexed terrace
#

It also doesn't make sense when you remember the included CharacterController doesn't want a rigidbody component

#

Static Collider
This is a GameObject that has a Collider but no Rigidbody. Static colliders are used for level geometry which always stays at the same place and never moves around. Incoming rigidbody objects will collide with the static collider but will not move it.

The physics engine assumes that static colliders never move or change and can make useful optimizations based on this assumption. Consequently, static colliders should not be disabled/enabled, moved or scaled during gameplay. If you do change a static collider then this will result in extra internal recomputation by the physics engine which causes a major drop in performance. Worse still, the changes can sometimes leave the collider in an undefined state that produces erroneous physics calculations.

From 5.6 .. all the way up to 2019.1

pallid nymph
#

๐Ÿ‘

#

That is an interesting point about the Character controller - haven't thought about it ๐Ÿค” But yeah, as you can see, it was a thing some years ago ๐Ÿคทโ€โ™‚๏ธ I haven't really done much physics lately :/

hexed terrace
#

I sort of vaguely remember that now I've read it, but like you, haven't done much physics in a while.. certainly none that would touch this.

frigid flume
#

hello, i have those buttons and i want to turn them red and to add 1 to a variable on click. In order to make the color stay the same between sessions, do i have to create one playerpref for each of these buttons ?

#

because there will be a lot of buttons, they all do the same but it's important for each button to stay the same color, they each mean something different (meaning validated or not) between sessions

pallid nymph
#

mm... if they have some sort of ID / unique name, I guess you can easily store them in PlayerPrefs... I'd probably prefer to save them in a file, because PlayerPrefs kinda suck, but it would work quite similarly

hexed terrace
#

If it's info that doesn't matter that a user could change easily, be better to use a json, so you can just use an array of some sort

frigid flume
#

it is sort of tasks, when completed you click the button that changes color

queen adder
#

hello. So I have an object with 500 thousand speed and it rotates around another object. when it collides with an object thats in its path counter is supposed to increase. I tried with 100 speed it works fine. but with 500 thousand speed collision doesnt happen sometimes and happens inconsistenly how can I fix this

hexed terrace
#

it's going too fast, try changing to ....err... is it 'continuous' on the RB

queen adder
#

which one

#

fast one or still one

hexed terrace
#

fast

queen adder
hexed terrace
#

because it's the movement of that that does the detection

queen adder
#

changed it to continous

#

still same

#

its supposed to increase like 500 in one second

#

in one second it rotates around it 500 times

#

but counter only increases by 2 or 3

pallid nymph
#

how does it rotate around?

queen adder
#

with transform.rotatearound

pallid nymph
#

right...

queen adder
#

yea

pallid nymph
#

so... whenever you deal with physics - you need to use the Rigidbody to move/rotate the object, not the transform

queen adder
#

I know its bad but i chose it because was easy

pallid nymph
#

yeah, and as you can see - it doesn't work

hexed terrace
queen adder
#

ok I actually forgot how to do it with vectors let me research and come back here real quick

pallid nymph
#

now to the second part... even if you do it with a RB, it still wouldn't work for 500 collisions per second, if I get it correctly

queen adder
#

why wouldnt it

#

am trying to simulate the speed of light

pallid nymph
#

I highly doubt the physics engine would simulate 10 enter/exit per tick, because your object rotated 10 times over some other object

#

you'll need something custom to simulate such things

gusty hazel
#

Hello is there any way to find where i have set a player pref

#

Because i added a player pref to track what level the player is on and i dont remember where in the code i put it

#

As in which script

charred spoke
#

Use your ide search function ctrl+f

queen adder
#

is there something custom made already I could use

pallid nymph
pallid nymph
# queen adder is there something custom made already I could use

no idea, never needed something like this... google may know more about simulating such things... also you need to understand why are you simulating it - what's the goal? perhaps it doesn't need to be too precise and you can go with some fake but much simpler approach ๐Ÿคทโ€โ™‚๏ธ

queen adder
#

I guess yeah

#

there probably is a simpler approach

#

how can I learn the maximum limit

#

for detecting collision

#

like whats the collision limit per frame

#

yo u know nevermind. I fixed it by slowing down the timer

#

there was a timer like 0 1 2 3 and number of times collision hapens like 500 for example i set timer precisely to increase by 1 only when 500 is there

#

its nothing like realtime but I cant deal with writing my custom thing

scarlet skiff
languid spire
viscid needle
#

Hey guys, So I was just following the official unity Create with code tutorial series in which they moved the backround to the left by resetting it's position after it reached it's half point(the backgrounds). they do this with the help of a box collider and then using the box collider to divide the x size by half and then resetting it's position. but the background just goes down and stutters. The player jumps force also seems to decrease. Pls help

#

here is the code

languid spire
viscid needle
#

what is wrong in it?

languid spire
#

read it

viscid needle
#

it seems fine to me.

languid spire
#

sorry I meant 19 not 13

viscid needle
#

yeah still seems fine

languid spire
#

wrong, read it again, carefully

viscid needle
#

no still not seeing anything wrong

languid spire
#

since when do you terminate an if statement with a semi-colon?

viscid needle
#

ohh right thanks. You are a life saver

languid spire
#

when someone says 'carefully' it means character by character

somber ravine
#

But the physics is applied though

#

Also tried changing the layers

wintry quarry
pallid nymph
somber ravine
#

There are other aspects which have been coded

pallid nymph
#

well, I didn't see it too, and I do read a lot of code... it's not that one doesn't see it, it's that brain auto-ignores it ๐Ÿคทโ€โ™‚๏ธ

languid spire
#

yep, and the art of the good programmer is to see what is actually there not what you want to be there