#💻┃code-beginner

1 messages · Page 721 of 1

cosmic quail
#

why not a tuple tho?

naive pawn
#

sounds.. unnecessary

thorn kiln
#

So what would mine be returning? True and something else?

naive pawn
rich adder
#

most Try functions return a bool with an out

#

TryParse, TryGetValue etc

regal marsh
#

I need urgent help can anyone help me

slender nymph
rich adder
#

if its urgent why not type the actual problem instead of extra unecessary question

regal marsh
#

Idk im panicing

rich adder
#

unless you got a gun pointed at you, you're gonna be fine lol

regal marsh
#

i imported an old package intending to to import only the materials and textures

#

it imported all the scripts

#

and overwrote all the code

rich adder
#

I'm assuming you didn't bother Version Control it beforehand ?

regal marsh
#

I havent done a git push in a while as i was very close to finishing

#

I did, i just havent pushed.

slender nymph
#

provided you have committed your previous changes you can just revert the latest changes to go back to the previous version

regal marsh
#

I havent

slender nymph
#

pushing is not required as that just pushes the changes to the remote

regal marsh
#

i havent commited either

#

is there any way to undo the import or something anything

fickle plume
#

If you use any client app for Git you can also view visually what files have been added and remove/roll back selectively.

regal marsh
#

i have git extensions

slender nymph
regal marsh
#

it overwrote the files

rich adder
#

so git should've tracked that?

regal marsh
#

I havent commited in ages idk

fickle plume
#

Also if you are using new version of the package you can just reimport that to clean up.

#

Then add selectively whatever you intended to add from old one

rich adder
#

they should be still in the stashed files

regal marsh
#

Idk what you mean...I imported a package from my old code, a different project that has very similar script names. It overwrote the files of my new code

fickle plume
hallow acorn
#

hey if i have logic in void update and it should call a method that usually should be called in fixed update, what would be the best way to do that? right now i have a bool that gets set to true when the function in fixed update gets called but i dont know if thats really optimal

hallow acorn
# rich adder like what? example?

just as an example of course if we take the code you wrote yesterday and we would try to move the character with rigidbody.velocity instead of transform position, we should usally call physics through fixedUpdateRight?

naive pawn
#

velocity can be set in the frame update just fine

#

it's stuff like addforce that has to be done in the physics tick

polar acorn
#

But yes, setting velocity in update is fine, it's adding forces that should be done in fixed

hallow acorn
#

oh ok i thought everything physics based should be call from fixedUpdate

polar acorn
#

It doesn't hurt

#

and it might be a good idea to get in the habit of doing so

hallow acorn
#

thank you it makes me really happy to have found the correct solution for once lol

covert sinew
#

https://hastebin.skyra.pw/zizilojude.csharp

Can someone tell me where I'm going wrong here? My goal is extremely simple. I just want to rotate an object to face another object, but only along a single axis (like a turret, in essence).

Here is a Gif demonstrating the code's behavior. It ALMOST works, but for god-knows-what-reason, certain positions result in the entire object flipping around.

I do not know how to fix this, nor do I know the "correct" way to do this.

wintry quarry
#

So it's making its best guess

#

based on your gif you probably want the up vector to be along the red axis in the move gizmo

#

(or the opposite)

covert sinew
#

I am providing the second parameter.

polar acorn
#

Or rather that you're giving it the wrong axis for that

wintry quarry
#

oh

#

then you're giving it the wrong value

polar acorn
#

Probably one of those should be not negative

wintry quarry
#

it's hard to say what's right without seeing the object's orientation

#

If you can select the rotating object with tool handle rotation set to "local" so we can see its axes, it would help

covert sinew
#

It's set to Desired Axis Zero, the first image is the object rotating, and the axis provided to Lookat is the second image's axis.

covert sinew
#

The second image. Here is a pic of the hierarchy, where TranslationGizmo is the Owner to "The Arrow" which is the one being tested

#

TranslationGizmo's transforms are never changed during any of these tests.

wintry quarry
#

Ideally the yellow/up direction of this key thing would be pointing to the left 🤔

#

(or right)

#

in these images

thorn kiln
#

Should I be using this same thing if I want an enemy colliding with the player to destroy the player, or is comparetag fine in that case?

wintry quarry
#

you won't be able to just use one of the local directions of the Owner object here

rich adder
wintry quarry
#

you're going to need to essentially take the forward direction and rotate it along the plane normal 90 degrees to get the up direciton required

wintry quarry
#

If the red object's Up direction was to the left in those screenshots (along the long axis so to speak) you could just be doing LookAt(_GlobalCamPos, Vector3.right)

wintry quarry
#

yeah exactly

covert sinew
#

I separated the graphic from the object itself

wintry quarry
#

that will make it easier

#

now you can just do LookAt(_GlobalCamPos, Vector3.right)

rich adder
# thorn kiln Sorry, player

when gameobjects have scripts you should use those instead of tags.
Tags can be somewhat useful on objects without any scripts

#

TryGetComponent has limitation to check only current object you call it on, for finding components on parent/child
use GetComponentInParent / GetComponentInChild respectively

covert sinew
# wintry quarry now you can just do `LookAt(_GlobalCamPos, Vector3.right)`

It wasn't QUITE that simple, since I needed to be able to rotate the owner object, but I do believe I have it working fully now, thank you very, VERY much.

I never would have figured this out in a million years.

(For context, the end goal here was to have my runtime translation gizmo's arrows always rotate to face the camera)

wintry quarry
covert sinew
#

Yup, that's how I got it working.

primal trench
#

can you include functions in scriptable objects

primal trench
rich adder
#

unity just interprets them as assets you can create from it

covert sinew
# cosmic quail yes

Not only can you include functions, but you can even add buttons to them. I use Easybuttons + SO functions to make editor tools a lot, because I'm too lazy to figure out how to make actual editor tools

polar acorn
rich adder
#

the only difference from a regular class is they dont need to be created with new()
like monobehavior

thorn kiln
#

Nevermind, figured it out, I can lock the inspector

slender nymph
#

lock the inspector tab. but also if you just immediately drag instead of clicking and waiting to drag it won't change the inspector window

thorn kiln
#

Looks liek I actually can't do that anyway

rich adder
thorn kiln
#

At least not the non-blue one that I can open in the heirarchy window

#

I guess because you can't put things from assets in things that are in the heirarchy window/

rich adder
simple hawk
#

hey guys, is there a way to hide my comments or collapse them or something? I want them around to help me understand the code, but they take up so much space

slender nymph
rich adder
#

@thorn kiln still doesnt answer why do you even have a field on the player for an individual enemy 🤔

thorn kiln
#

I dunno, it's what I did with the weakpoint thing we did

rich adder
#

the weakpoint only knows about the objects in that hierarchy when its a prefab

#

so it only references its own parent

#

You would want to only grab enemy from player or vice versa at runtime

thorn kiln
#

Eughhhh, I know how to make this work with comparetag. All this other stuff is so convoluted in comparison.

rich adder
polar acorn
rich adder
#

except you're not at the mercy of strings

polar acorn
#

Show the inspector of it

thorn kiln
#

Im just trying to destroy the player when an enemy collsides with them

polar acorn
#

So show the inspector of the object that is the other in your OnTriggerEnter function

#

The object you want to detect collision with

rich adder
#

Triggers and all , its the same exact thing lol

if(other.CompareTag("Player")) Destroy(other.gameObject)

thorn kiln
#

Hmm, I was putting this stuff on the player controller

rich adder
#

you crossed your wires somewhere no biggie

#

GetComponent / TryGetComponent when we usually want to detect something at runtime
SerializeField/Public when we are on the same hierarchy to what we want

thorn kiln
#

Well my enemy script is current doing stuff like

    private GameObject player;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        enemyRb = GetComponent<Rigidbody>();
        player = GameObject.Find("Player");
    }```
#

So I guess I gotta change that?

rich adder
#

if you were needing to get a component / run a function on the player then you could put it to use. Although is not recommended using GameObject.Find. at very least you'd use FindObjectWithTag or Component

thorn kiln
#

Well it's how I've been telling the enemy where to move towards

thorn kiln
rich adder
#

its not "wrong" to do so, they are good as quick results straightforward

#

but they are less efficient , something you shouldn't care as much as beginner so they don't go in the nitty gritty

polar acorn
thorn kiln
#

The enemy has that code on it

#

I want the enemy to destroy the player

polar acorn
#

Okay, and what two objects are involved in the collision

thorn kiln
#

Player and Enemy

polar acorn
#

And which object do you want to destroy?

thorn kiln
#

The player

thorn kiln
#

It's very frustrating that anytime I do anything the answer is "unlearn everything you've been taught so far and do it differently"

polar acorn
#

Just use whatever script your player uses instead of Player

rich adder
#

learning new ways to do similiar thing but better is part of the learning process

#

more important you question why you'd want to use one over the other, whys is important to understand before going further with a change

thorn kiln
#

Well it feels like trying to learn breaststroke while still in the kiddy pool

simple hawk
polar acorn
polar acorn
#

that's not that complicated

simple hawk
polar acorn
simple hawk
#

can you hide the region or, like, collapse it?

polar acorn
#

Yes that's what they're for

simple hawk
#

omg, this is amazing, thnx guys

glossy vigil
#

how do i fix this?

Building /Users/mmasw/Downloads/ewewq.app/Contents/PlugIns/FirebaseCppStorage.bundle failed with output:
System.Exception: Cannot sign '/Users/mmasw/Downloads/ewewq.app/Contents/PlugIns/FirebaseCppStorage.bundle' because it is not a valid Mach-O binary.
at MacOSCodeSignDylibCopy.Run(CSharpActionContext ctx, SignFlags signFlags) in /Users/bokken/build/output/unity/unity/Platforms/OSX/MacStandalonePlayerBuildProgram/MacOSCodeSigning.cs:line 67
�u�
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindow.cs:189)

rich adder
glossy vigil
#

and what does that mean

rich adder
#

you tried googling it

glossy vigil
#

but how do i fix this

rich adder
#

guessing it has to do with code signing something

glossy vigil
#

is it because i orginally created on windows and then now tried to import it to macbook m1 chip

rich adder
#

doubt it. I use the same project on 3 different OSs a day and no problems.

#

if you dont give any context there isn't much anyone can do with just that line of code other than "google it" like you could

glossy vigil
#

what context could i give

#

if u want i can share u my project

#

in dms and u can try to run it

rich adder
#

I don't need the project but you can just start by giving context like, I'm trying to build x for x, but this shows , I tried xyz, but giving me yze .. etc. stuff like that idk

glossy vigil
#

im trying to compile my idle game and out of nowhere i get this error i havnt seen before

#

that i managed to compile not long ago and now i get this shit

#

chould i get that error because of this

rich adder
#

what changed since ?

glossy vigil
#

besides the missing project id, cuz im not on same account as pc on laptop and a few tweaks thats ab it

#

thats where the sign in issue is coming from? the missing project id

rich adder
#

this seems more to do with Firebase than Unity cloud

glossy vigil
#

and when i try to compile it i get 6 error all realted to firebase

polar acorn
thorn kiln
rich adder
polar acorn
thorn kiln
#

When the player and enemy touch

polar acorn
#

So, inside OnTriggerEnter or OnCollisionEnter

#

Because those functions run when an object collides

thorn yoke
#

if im having an issue with like a window in the door opening with the door where would i got to ask for help about this? i was told something about dont cross post but cant remember what channel to go to i may just be dumb but idk

rich adder
glossy vigil
#

on the internet its a common mac issue

rich adder
thorn yoke
#

i will just didnt want to put all that in the wrong channel and im on windows

thorn kiln
#

Okay, looks like I got it working, followed by a million errors because I just deleted the player and camera

#

I'm guessing I probably don't wanna destroy it

#

Just make it invisible and intangible and stop controls working

#

Or just make the camera not a child of the player, but that seems like it's gonna cause more work

rich adder
#

sometimes you can just get away with simple null checks or some type of way to skip those things when the desired object isn't there

thorn kiln
#

I'm figuring it out as I go

#

Most likely just simple gameplay stuff. Game over screen, press button to reset.

#

Thats for later though

rich adder
#

yes those also require forethought, in reset , do we reset the scene or just certain objects. etc.

thorn kiln
#

The pathway is making me do all this work on a personal project before I've even learnt half of the tools needed to pull it off

rich adder
#

your first projects should just be test / learning projects not your "dream game" type project

thorn kiln
#

At the end of the "Missions" it gives you a "Lab", which is it telling you what aspects of your "personal project" to work on

#

SO Im doing stuff like this

regal marsh
thorn kiln
#

But it expects you to fill out a whole game design document before you've even learned how to do anything. I just skipped it because I thought that was stupid to ask me to design what a game will be before I even know what I'm gonna be capable of building.

rich adder
#

GDD is important to at least know about. You don't have to do everything there to a T.

thorn kiln
#

I just think it's silly. It's like asking me to plan a circus performance before I've hired any performers.

rich adder
#

I mean I do agree that it should probably be at the end or a sepearate course but still. If you think you won't need it now just skip it , no biggie

regal marsh
#

@rich adder You can extract the assembly.dll files and get the scripts that way

thorn kiln
#

My problem for right now is that I want the character to bounce up after jumping on the weak point on top of the cubes (it's basically mario stomping goombas but with spheres and cubes), I tried using ForceMode.Impulse, but physics movement is... inconsistent, so I'm wondering how to do it.

rich adder
thorn kiln
#

Before anyone says it, yes, I know it's not "inconsistent", it's the same force every time it's just competing with the force of gravity which is why it's different

rich adder
#

are you using velocity or addforce to move ?

thorn kiln
#

So force is the best way to handle this?

#

addforce

rich adder
#

AddForce Impulse

thorn kiln
#
    private void OnTriggerEnter(Collider other)
    {
        if (other.TryGetComponent(out EnemyHurt trigger))
        {
            Debug.Log("Collided with weak point");
            Destroy(trigger.enemy.gameObject);
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }
    }```
slender nymph
thorn kiln
#

Right, right, just reset the Y axis velocity... hey, quick question...

rich adder
slender nymph
thorn kiln
slender nymph
#

it's also incredibly easy to google how to do something like that

thorn kiln
#

You do get that google is just typing things into a box to get answers, and that this discord is also typing things into a box to get answers

slender nymph
#

you do get that wasting time bitching about everything here and not doing actual research is hindering your learning journey and you're just adding useless noise to the channel, right?

regal marsh
# rich adder still unclear what you're trying to decompile and why...

So for the past month i have been recreating a project that I already made, using cleaner code and efficient systems.
I tried to import a package from my previous project which was suppose to be only textures.
I didnt see at the time but it also had my old scripts folder.
When the import finished, it overwrote all scripts with the same name and added a bunch of scripts im not using anymore, I.e. I had ServerMinion, ServerGameManager etc. which where the same name for both old and new project. and unity overwrote the files completely.

But since unity doesnt allow build with errors, the oldest build still had my old code in it, so I was able to get that code, tweak it a little and put it back into the original scripts.

thorn kiln
#

To the channel... code-beginner?

slender nymph
#

also #🌱┃start-here explicitly states that you should actually make an effort to google your questions yourself before posting here

polar acorn
rich adder
regal marsh
#

No its unity native build it wasnt complied

#

like when playing from the engine

rich adder
# regal marsh No its unity native build it wasnt complied

the oldest build still had my old code in it, so I was able to get that code, tweak it a little and put it back into the original scripts.
I meant you had made a build, then not committed the scripts but then replaced everything with new assets?

#

its whatever as long as it did what you wanted it to do, just thought it was strange.. You outta make commits before doing such changes. hopefully lesson learned ?

regal marsh
#

I only intended to add textures :e never thought something like this would happen

elder osprey
glossy vigil
#

@rich adder i fixed the error

#

but now i can build the app

#

but it says this

#

can anyone help here?

rich adder
glossy vigil
#

What😭

#

i just fixed the the fire bullshit

#

that i had earlier

rich adder
#

no idea. have you tried refresh the library folder

glossy vigil
#

or what does that mean

rich adder
#

its a hail mary but worth a shot

glossy vigil
#

i tried to re enter and now i get this

rich adder
glossy vigil
#

i will try ur hailmary

glossy vigil
#

XDDDDD

#

just removed the fire storage all together

rich adder
#

why did you even have it lol

glossy vigil
#

so when u open game

#

u can log in

#

with google play

rich adder
glossy vigil
#

or log in with account on my cloud

rich adder
#

alr.

#

personally the Google SDK is always been dogshit.
you can always switch to unity auth and get the same login features

glossy vigil
#

im cooked

#

im getting this The type or namespace name 'DG' could not be found (are you missing a using directive or an assembly reference?)

rich adder
# glossy vigil

fix the top 3, and the last one might actually fix itself from the suggestion I made with library

glossy vigil
#

for liekt he first 3

#

bet

#

ill try

#

or should i first

#

just delet library and open it again

rich adder
#

fix the DG error first

#

might be related to you deleting the Plugin folder especially if you had something other than Firebase...

glossy vigil
#

yea most likely

#

i think i got this

#

brb

polar acorn
#

DG is DOTween

#

I mean, they probably have other assets too

#

but it's probably DOTween

short condor
#

I need help because it doesn't let me have my asset move

#

What am I doing wrong

polar acorn
#

What are you doing to try to move it

short condor
#

Im using set position

polar acorn
#

Show !code

eternal falconBOT
polar acorn
#

-# 🦗 🦗

glossy vigil
#

how to fix these, bruhhhh

polar acorn
glossy vigil
polar acorn
glossy vigil
#

where does it say which line the error occurs?

polar acorn
#

Line 13, fifth character

glossy vigil
#

so thats what live 13

grand snow
#

now go check whats on line 13

glossy vigil
#

#endregion

#

and now i deleted that and guess what

polar acorn
#

What is line 13 doing

glossy vigil
#

9 new eerors

polar acorn
#

Congratulations, you fixed an error that prevented anything from compiling

glossy vigil
#

i ran firebase from there but i recently deleted it

polar acorn
#

Now keep doing the same thing, start at the top, look at the line, and see what the problem is

glossy vigil
#

alr thanks for the help

glossy vigil
#

@polar acorn

#

i deleted like half of the game alr

polar acorn
#

Start at the top and fix the issues from top to bottom

glossy vigil
#

i did

#

and just endded up deleting

#

player.cs

polar acorn
#

Do you need player.cs

#

That sounds like something that you are probably using

#

Why delete it?

glossy vigil
#

i fs use it

#

idk dude im kinda lost ngl

#

i dmed check what i wrote

polar acorn
#

Are you just deleting random files

#

I don't know why you expect that to fix things

grand snow
#

Is this some demo or something you made?

glossy vigil
#

demo ish

grand snow
#

Then hopefully you know what "Manager" is and why its missing

glossy vigil
#

yeah

#

anyways thanks for the help

grand snow
#

😂 okay good luck

glossy vigil
grand snow
#

free will go do as you want

#

be respectful though and dont break the rules of this server

polar acorn
#

I would highly recommend reading the errors to know what the problem is rather than just deleting random files

glossy vigil
#

problem is

#

im an idiot that integrated firebase into the whole game and i now realized it somehow messed my whole game up and dont have a backup pre integration

grand snow
#

then you would either update firebase to get it working OR remove firebase + places where you use firebase

rich adder
#

so put the sdk back and see if compiles now that you refreshed those errors / library

grand snow
#

😆 im gonna guess its a lost cause

polar acorn
#

And also probably all the other random files you deleted

#

Hopefully you didn't delete player.cs without a backup

glossy vigil
#

i went wild, but with a backup

rich adder
#

wasnt it only DG namespace missing, how did we even get here..

polar acorn
rich adder
#

very strange since they already did all this codebase...

#

all they had to do was put the plugin back or comment out the lines rq lol

glossy vigil
#

by fixing DG

#

i get 9 more errors

polar acorn
#

Then you fix those

glossy vigil
#

and by fixing them i get 33 more errors

#

and then i get 399 errors

#

and then i delete my game

polar acorn
#

If the compiler can't get past a file, it can't get to further ones

#

Also, how are you "fixing" them

rich adder
#

deleting entire plugin folder vs you just had to temporarily test project build without firebase plugin

polar acorn
#

Are you actually solving the problem or just deleting the files that have errors

rich adder
#

or even folders..lol

#

bro is on a deletion rampage

polar acorn
#

I don't know why but I can't help but think of this XKCD

#

Deleting a file gets rid of the errors but it doesn't actually fix anything

thorn kiln
#

I've managed to get rid of the errors by adding if (player.gameObject != null) to the enemy script, though I'm not sure how to handle the camera being destroyed along with the player

polar acorn
thorn kiln
#

That's a solid idea. It's a child of the player though. I might be able to fix that if I rewrite the code to make the camera follow the player instead, but that's just a maybe because of my skill level

rich adder
#

follow , no code needed

thorn kiln
#

So do I then make the main camera or the CinemachineCamera the child?

#

Well, for osme reason the CinemachineCamera just keeps moving further and further away on the z axis by itself even when the scene isn't playing... thats probably not intended 😂

grand snow
#

you dont do that

grand snow
#

you use its follow and framing functionality and it will follow the target

thorn kiln
#

Thanks guys, that's pretty much solve it

#

I feel bad I didn't have to code it though

grand snow
#

I use cinemachine its great

#

its soo great that even unreal has a version of it now 😆

thorn kiln
#

I think I'm doing okay. Not great, but you know, okay. This is definitely a form of gameplay.

rocky canyon
#

that is indeed gameplay

thorn kiln
#

Yeah, it's on Stream Early Access, where it will stay indefinitely for the next 30 years, like pretty much everything else on Steam

#

Please pay me £60 for it now

grand snow
#

Makes me sad when a game has the same price in pounds as it does in usd

thorn kiln
#

I'm sorry you feel that way... please pay me £80 then

#

I've decided it's a quadruple A game now

#

I guess I should probably add a power up

languid pagoda
zenith wren
#

I have an object that can be destroyed by two other objects, how would I differentiate them on the "OnDestroy" method so I can have 2 different things happen depending on what destroys it

languid pagoda
devout socket
vale robin
#

Is it possible to make objects from tiles? I want to give that blue platform a special behaviour with a script but creating an entire tilemap for each platform seems excessive. Is it the right way or is there a better way to do it?

thorn kiln
#

Eugh, the thing that makes enemies destroy my player when they collide is on my enemy script, but I wanna add an if statement to not destroy it if powerup is true, but haspowerup is in my playercontroller script. Now I gotta remember how to access variables in other scripts

#

Guess I'll try asking chatgpt, I paid £20 for it after all

teal viper
thorn kiln
#

Nope, chatgpt is not being helpful, so that's a bust

sly vortex
#

Oh god, ChatGPT on game development? Are you trying to cause everything to crash and burn?

shell sorrel
#

also ChatGPT is not going to be very helpful for most things and certainty not help you learn

thorn kiln
#
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.TryGetComponent(out PlayerController player))
        {
            if (player.hasPowerup == true)
            {
                Destroy(gameObject);
            } else {
                Debug.Log("You are ded.");
                Destroy(player.gameObject);
            }

        }
    }```
#

Okay, thats what ended up working

#

No idea if it's good, all I know is it works

rocky canyon
#

u should try to work out why it works more often and less bout ai

code makes perfect sense to me..
-> collision -> if has player -> if player has powerup destroy this -> if player doesnt have power up destroy player

rich adder
thorn kiln
#

AI didn't help with that, it wanted me to do lots of roundabout stuff that wasn't working

#

I just tried typing player in my enemy script to see if anything came up

cerulean bear
thorn kiln
#

I dunno, maybe I should become a vibe coder

#

I hear that works really well

shell sorrel
#

it does not

sly vortex
#

Definately don't become an AI coder, you'll get nowhere fast

thorn kiln
#

I wonder if Tea is still hiring

rich adder
cerulean bear
#

the button activates in runtime I can give a screenshot

rich adder
#

btw thats funny I have a monopoly project I made a year ago..

cerulean bear
#

rn I'm trying to get it working and then I'm trying to add an ai

#

what was your project about

rich adder
#

monopoly lol

cerulean bear
rich adder
cerulean bear
vale robin
rich adder
rich adder
rich adder
#

oh please not this shit again

flat sphinx
#

cant say for unity but in zig at least it does snippets well

sly vortex
#

I found it to cause massive damage vs slightly helping. It may fix one issue, but it'll cause you 500 other problems

rich adder
#

keep it there if you want to discuss it, this place is gonna flood with that crap

flat sphinx
cerulean bear
# rich adder ok then most likely somewhere else in code you're not running the addListener / ...

this is where I activate it if it helps

using System;
using UnityEngine;

public class Middleman : MonoBehaviour
{
    public GamePlayerDataManager[] allManagers;
    public Player triggerPlayer;
    [SerializeField] private PropertiesPopupManager propertiesPopupManager;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        foreach(GamePlayerDataManager game in allManagers)
        {
            game.onPropertiesShown += ShowProperties;
        }
    }

    private void ShowProperties(Player player)
    {
        propertiesPopupManager.gameObject.SetActive(true);
        propertiesPopupManager.ShowProperties(player);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
thorn kiln
#

Okay, tried looking online and couldn't figure it out. How do I change the material of an object when I pick up a powerup?

cerulean bear
shell sorrel
cerulean bear
shell sorrel
#

like what is the material on, oh the renderer so go look at the docs for that

rich adder
shell sorrel
#

and find its material and sharedMaterial properties

languid pagoda
#

Anyone know sane pakejka 5.2 coeffecients?

flat sphinx
shell sorrel
#

why would you just not write the bitmath out though, find it alot of it easier to repersent what i want in code then written language

cerulean bear
#

bc lambda stores the operation rather than the value

rich adder
sleek light
#

@grand snow im the guy you helped earlier. can i ask you about a specific thing im having trouble with?

cerulean bear
rich adder
cerulean bear
#

so at the start player.propertiesOwned.Count is 0

rich adder
cerulean bear
rich adder
thorn kiln
#
private Material playerMaterial;
playerMaterial = GetComponent<Renderer>().material;
playerMaterial.color = Color.red;```Okay, these lines are working at least. But that's just colours. I need ot figure out how to change it to a material I have in assets.
cerulean bear
rich adder
thorn kiln
#

I thought I'd jsut be able to do playerMaterial = gold;, but guess not

cerulean bear
rich adder
#

just make a field and assign it in the inspector, whats the big deal

rustic laurel
cerulean bear
rich adder
sly vortex
cerulean bear
#

ohh I see what you mean

rich adder
#

you already established its not printing / reaching that part

#

work your way backwards

cerulean bear
#

I'll start in AddProperty

rich adder
#

yes you have a few things to debug in that method

#

especially the loops / quantities

shell sorrel
thorn kiln
shell sorrel
thorn kiln
#

Well I did, that's what this is, right?
playerMaterial = GetComponent<Renderer>().material;

#

Changing that to MeshRenderer also doesn't work

shell sorrel
#

what i am saying is you want to override the mateiral on the renderer, not on just a var you made locally

thorn kiln
#

Ah, so GetComponent<MeshRenderer>().material = gold;

wintry quarry
cerulean bear
# rich adder not in the method only lol thats pointless you have to follow the flow of the co...

how does this look

    public void AddProperty()
    {
        string inputText = amountInput.text;
        bool isValid = true;
        foreach(MonopolySpace owned in triggerPlayer.propertiesOwned)
        {
            if(owned.Name.Equals(inputText, StringComparison.OrdinalIgnoreCase))
            {
                Debug.Log("You already own this property!");
                isValid = false;
                break;
            }
        }
        if (isValid)
        {
            foreach (MonopolySpace space in MonopolyBoard.Spaces)
            {
                if (space.Name.Equals(inputText, StringComparison.OrdinalIgnoreCase))
                {
                    triggerPlayer.propertiesOwned.Add(space);
                    Debug.Log($"Player properties position: {triggerPlayer.propertiesOwned[triggerPlayer.propertiesOwned.Count - 1].Name}");
                    place++;
                    propertyTexts[place + 1].gameObject.SetActive(true);
                    propertyTexts[place + 1].GetComponentInChildren<TextMeshProUGUI>().text = $"{space.Name}, {space.Color}, Price: {space.Price}";
                    int indexCop = triggerPlayer.propertiesOwned.Count - 1; // Capture the current value of place
                    propertyTexts[place].onClick.AddListener(() => PropertyClick(indexCop, triggerPlayer));
                    //isValid = true;
                    Debug.Log($"Place: {place}");
                    //triggerPlayer.propertiesOwned.Add(space);
                    break;
                }
            }
        }
    }
}
thorn kiln
shell sorrel
#

just use a differnet var name for it

#

unity used to have older accessors for communally used components

wintry quarry
#

or you declared it in a different scope than you're trying to use it

#

so it's falling back to the defunct Component.renderer property

shell sorrel
#

you are most likly missing the typename infront of it, i would recommend going through the basic learning stuff for C#

rich adder
#

just test it lol

cerulean bear
rich adder
#

you outta print out values like quantities before loops etc.. see if they match what you expect

thorn kiln
#

Well it doesn't work in initilizers, doesn't work in Start(), and if it put it in OnTriggerEnter then IEnumerator PowerupCountdownRoutine() cant see it

shell sorrel
#

you need to learn the basics

#

would need to make it a field to access it in multiple methods like that

thorn kiln
#

Thanks, I'll try and learn the basics while I'm already trying to learn the basics.
I'm doing the beginner courses. I can't get more basic.

eager stratus
#

I'm trying to make a jump using natural gravity (9.81) just to make sure the formula I keep seeing around (Mathf.Sqrt(2 * 9.81 * h)) works. I have the height plugged in as 1 and am expecting the jump peak to be 1, but every time I run this code in FixedUpdate the highest value I get output is 0.956185. Is there a reason for that?

    {
        //For now just make sure the jump height is not only consistent, but peaks where I specified
        //Well, the determinism is there. Now I just have to make sure the force is correct for the correct jump height
        if (!Mathf.Approximately(transform.position.y, 0)) { print(transform.position.y); }

        //Actually perform the jump
        if (jumpQueued)
        {
            rb.linearVelocity += Vector3.up * Mathf.Sqrt(2 * -Physics.gravity.y * jumpHeight);
            jumpQueued = false;
        }
    }```
rich adder
thorn kiln
#

Yeah, well the c# courses online suck
"Microsofts one is good"
No it's not.

cerulean bear
#

@rich adder I got it working thank you for the help

rich adder
shell sorrel
#

its a established langauge used for many things, there is so many sources for learning it

rich adder
#

also they mentioned js which has simliar structures

cerulean bear
#

honestly just do the code pathway and maybe follow a codemonkey tutorial

#

the second one is probably better

#

though either one of the two works

#

I did both

desert patrol
thorn kiln
thorn kiln
teal viper
#

Can you link/screenshot it?

thorn kiln
teal viper
# thorn kiln

I mean where does it ask you to do something that they didn't teach you yet.

thorn kiln
#

Well because the personal project is just something you make up yourself, I don't wanna just copy the other games they've had me work on already.
But in trying to make my own I've had to use stuff they haven't taught like
Cinemachine, linearVelocity, TryGetComponent

#

Maybe I didn't need to use those, but when I'm stuck on something and ask here, the response is always "the way you've been taught is bad, use this instead"

teal viper
#

I don't see them implying anywhere in that tutorial that it's a "free to do anything" tutorial. They teach you specific things and expect you to follow the instructions. Obviously if you go beyond that(things that are probably taught later on), you're on your own.

#

If you still want to do that, you need to be ready to read the manual/api docs and look at extra tutorials.
Or just proceed with the learning path correctly. Once you finished all of it, you can experiment freely and work on your own project.

#

You're typically not expected to do your own thing while in training. At least not before the very end of it.

#

It's like you ask first year physics student to build a nuclear reactor.

thorn kiln
#

You sound like an ad

#

You've got a sketchy name, have been in the server a week, DMd me to offer help instead of just offering in the server and instead of just telling me the name of the source you have, you're suggesting it teaches everything in the most vague way possible. If you don't understand how you sound like you're about to try and sell me a limited edition course, then you have zero self-awareness

#

I don't care what zombienet is. It doesn't stop everything about you coming off as sketchy

#

Yeah yeah, and I'm sure your dad works at xbox. It's not on me to trust strangers on the internet, it's on you to come off as trustworthy.

teal viper
#

Just to note, but uncolicited personal messages are not welcome on this server. I think it's actually in the #📖┃code-of-conduct

#

Indeed. But the idea behind it is the same: don't bother people that might not want to PM. Keep it on server.

zenith wren
#

is there a way to have only 1 collider that is both a trigger and prevents clipping? my code runs twice because it has 2 different colliders

naive pawn
#

the point of a trigger is to be a volume you can pass through

#

what exactly are you trying to achieve? is a single non-trigger collider not sufficient?

wintry quarry
zenith wren
#

it's and object that needs to know if the player is nearby and once it hits a different collider it adds a score but since it gets both colliders it runs the add score code twice

#

my workaround was just making it add a 0.5 score so it rounds up anyways

naive pawn
#

yikes

zenith wren
#

I guess I'll just stick with that

wintry quarry
zenith wren
#

oh that's smart

#

thank you

#

it worked, thanks alot

west sonnet
#

How can I reference an Enum in my Scriptable Object?

naive pawn
#

you can just.. do so?

#

what issues are you experiencing

west sonnet
#

I wasn't sure how to reference it, but this is what I've written. is this correct?

rustic laurel
rustic laurel
eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
Collaboration & Jobs

modest harness
#

This is driving me madnotlikethis
In some projects when i open .cs files in /asstets/scripts IDE says something like "The active document is not part of the open workspace. Not all language features will be available."
Even though its RIGHT THERE and a file right next to it is opening just fine!
AI says to reopen the workspace (the workplace is correct) or to regenerate project files (which is not a thing i dont think)

#

anyone had that before?

grand snow
#

!ide

eternal falconBOT
grand snow
#

make sure your ide is setup correctly as unity should be managing it for you so code files are "in project"

modest harness
#

it was setup correctly 😭

#

but thanks to this i found out vs code package was outdated

#

so it works now

maiden basin
#
private IEnumerator Trap()
    {
        // Disable movement
        playerMovement.enabled = false;
        botBotMovement.enabled = false;



        // Fade to black
        if (screenFader != null)
        {
            for (float t = 0; t < fadeDuration; t += Time.deltaTime)
            {
                float alpha = t / fadeDuration;
                screenFader.color = new Color(0, 0, 0, alpha);
                yield return null;
            }
            screenFader.color = new Color(0, 0, 0, 1f);
        }

        // Teleport
        player.transform.position = destination;
        botBot.transform.position = destination + botBotOffset;

        // Fade back to transparent
        if (screenFader != null)
        {
            for (float t = 0; t < fadeDuration; t += Time.deltaTime)
            {
                float alpha = 1f - t / fadeDuration;
                screenFader.color = new Color(0, 0, 0, alpha);
                yield return null;
            }
            screenFader.color = new Color(0, 0, 0, 0f);
        }



        // Re-enable movement
        playerMovement.enabled = true;
        botBotMovement.enabled = true;
        
        // Play sound
        if (audioSource != null)
        {
            audioSource.Play();
        }
        Destroy(gameObject);
        Destroy(parentTile);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == player)
        {
            StartCoroutine(Trap());
        }
    }
}

So basically with this coroutine, my audio source doesn't play when I have it like this. If I move the Play Sound bit into the OnTrigger Enter, before the coroutine plays, I do get the audio but then the player doesn't move position like it's supposed to. Any idea why? Seems weird to me.

keen dew
#

Assuming audioSource is on this object, you're destroying it right after starting to play it

maiden basin
keen dew
#

Do you want it to play only after those fades?

maiden basin
# keen dew Do you want it to play only after those fades?

I added the wait, and even just doing that breaks the teleporting bit and doesnt move the player.

Ideally I want it to go in this order:

Hit collider > screen goes black > audio plays > player and NPC teleport > objects get destroyed > Screen fades back in. But I can't do that because destroying the object stops the coroutine and the screen stays black forever.

keen dew
#

Leave the parts that destroy the object at the end

maiden basin
#

Yeah IK, but ideally I want the object to break (Destroying it) while the screen is black. Should I just instead make the object render fully transparent during the black screen to fake it?

keen dew
#

You can disable/destroy the renderer

maiden basin
#

I'll go dabble ty/

thorn yoke
#
{
    public bool isOpen = false;
    public float openAngle = 90f;
    public float closeAngle = 0f;
    public float smooth = 2f;

    void Update()
    {
        Quaternion targetRotation = isOpen ? Quaternion.Euler(0, openAngle, 0) : Quaternion.Euler(0, closeAngle, 0);
        transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation, smooth * Time.deltaTime);
    }

    public void OpenCloseDoor()
    {
        isOpen = !isOpen;
    }
} ```
i cant seem to get this door to sit proper the other set of doors ive done this exact same steps to works just fine but im at a loss of whats causing this. when i disable the script on this hinge the door sits fine right where it should be so im jsujst completely lose
hexed terrace
#

You've changed the scale to -1 .. which might affect the positioning/rotation too - depending on what that does to the pivot.

What would be better, and easier to track, would be to set the scale back to 1,1,1. Create an empty parent, put the door script on that, put the door as a child and rotate it 180 on Y - Making sure the pivot of the parent is at the hinge side of the door.

#

Maybe it's already parented?, it's hard to tell with the cropped images

thorn yoke
#

so i have them parented like this i knew missed showing something im sorry

hexed terrace
#

which one has the scale of -1 ?

thorn yoke
#

the left hinge

hexed terrace
#

Change that back to scale 1 , as that is what's being manipulated by code

thorn yoke
#

SpiderDoor lol

hexed terrace
#

Change the children to be orientated the correct way

#

scale 1 on all 3 axis ;p

thorn yoke
#

i swear im listening ;-;

hexed terrace
#

no rotations -> 0,0,0

thorn yoke
#

the rest of the children are 1,1,1 and now we are here

#

y 180 fixed it

#

now i just need it to do that when i hit play

hexed terrace
#

2 things

  • hopefully the pivot mode is set to center
  • change the Children rotation, not the parent
#

your code is going to set the rotation to 0 or 90, so rotating the parent by 180 will only work until the door is interacted with

#

ideally, you'd want your code to be += / -= 90 .. so that the rotation of the parent doesn't need to be at 0

thorn yoke
#

you helping with the orientation literally fixed it that y 180 was the last step holy shit you beautiful person ive been at this for 3 hours

thorn yoke
grave ocean
#

is anyone around to help a bit with an issue im running into uploading a vrchat world?

hexed terrace
#

!vrchat

eternal falconBOT
grave ocean
#

yeeep done just noone wanted to answer ahaha

#

thanks anyway

fiery stone
#

quick question, if i have a player which has a script which has a function to damage the player, how would i call that script from another object, like a bullet or a laser

fiery stone
frosty hound
#

Who was it?

fiery stone
frosty hound
#

!ban save 1194024921467191367 Continuing to spam DMs despite previous warnings.

eternal falconBOT
#

dynoSuccess buga_henry was banned.

fiery stone
#

oh sorry, no images?

frosty hound
#

It's fine, just ignore it.

fiery stone
#

ight

fiery stone
naive pawn
#

you shouldn't use names for checking objects

#

anyways, you didn't actually say what the issue was

fiery stone
#

no log

#

nothin

fiery stone
floral garden
#

hi, i need some advice,
in 2D for narrative game,
is it better to make an animation ours self with script
or
using animator of unity + clip

naive pawn
fiery stone
fickle plume
fiery stone
#

i guess im making a bullet hell game without collision

grand snow
#

did you perhaps think to search "unity layers"

fiery stone
grand snow
#

we can give advice and help but i wont read you a bedtime story

fiery stone
fickle plume
eternal falconBOT
grand snow
eternal falconBOT
#

:teacher: Unity Learn ↗

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

rotund root
#

is there something wrong with this code? I tried to run on my phone and it doesn't show the camera feed
in unity editor i can see the "obs logo" so i assume i placed the components correctly?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CameraFeed : MonoBehaviour
{
    WebCamTexture camTex;
    public RawImage img;
    void Start()
    {
        camTex = new WebCamTexture();
        img.texture = camTex;
        camTex.Play();
    }

    public Texture2D Snapshot()
    {
        // capture current camera frame to a Texture2D
        var tex = new Texture2D(camTex.width, camTex.height, TextureFormat.RGB24, false);
        var pixels = camTex.GetPixels();
        tex.SetPixels(pixels);
        tex.Apply();
        return tex;
    }
}
grand snow
#

Could be permissions are required to access the camera

#

unity offers things to check + request permissions
they also need to be added to your AndroidManifest

rotund root
naive pawn
#

you opened it in a browser instead of an editor

shell sorrel
#

open it in a text editor

#

not a browser

naive pawn
#

you can edit files in..editors

shell sorrel
#

would just use your ide or code editor

rotund root
#

oh

grand snow
#

You are looking at the build output, do not do this

rotund root
#

oh thanks! it's working now
is there a easy way to set up a pop up to ask for permission?
I have to get the permission manually by opening setting > app on my phone :/

hexed terrace
#

o/s level permission popups usually appear automagically - try installing the app fresh

frosty hound
#

We don't allow modding here.

deft tree
#

Huh? But that is unity server though

frosty hound
#

Yes, and on this Unity server, we don't allow discussions on modding, pirating or asset ripping. You'll have to find another community.

deft tree
#

The hell?... How do you put modding in the same line as other two things?? I am modding a licensed game that I bought!

That is weird. Farewell

sour fulcrum
#

They all break tos

rotund root
sour fulcrum
#

This is an official unity server so we can’t talk about em

#

most people here don’t actually dislike modding it’s just not the right place

fickle plume
#

A lot of people got into game dev learning through modding. It's just this server is dedicated to learning Unity and modding always about overcoming limitations of some existing application build (which is out of scope of this community), while also in most cases is against game's TOS.

floral lotus
#

how i can make this effect on unity?

floral lotus
hexed terrace
#

don't crosspost

hexed terrace
floral lotus
#

my english is bad

#

im portuguese

#

srry

hexed terrace
#

you'll want to get the distance from the camera, and increase/ decrease the scale

floral lotus
#

in godot it's so easy, but I can't enjoy using godot. I think I've gotten used to unity

hexed terrace
#

You'll also probably want to do transformOfTheText.LookAt(cameraTransform);

balmy vortex
balmy vortex
#

how do I do that?

hexed terrace
#

Doesn't even look laggy, just slow jump

#

google -> how to use unity profiler

subtle scarab
#

try that and hope that helps 🙂

balmy vortex
naive pawn
#

that isn't in itself an issue

#

linearVelocity can be set in update just fine

#

this is an issue though

airTime += Time.fixedDeltaTime;

#

the AddForce as well

west sonnet
#

The values in my PlayerWeaponScript are not changing to the values in my SO. Am I doing this correctly?

#

The Method is definetely being called since the Debug.Log is working

balmy vortex
naive pawn
#

because it's in Update

balmy vortex
#

well where else would I put it?

naive pawn
#

FixedUpdate

grand snow
#

Why not just keep a ref to the scriptable object...

naive pawn
#

using fixeddeltatime does not automatically make it part of the fixed time step

west sonnet
subtle scarab
grand snow
# west sonnet What do you mean?

If you want to access information about the "currently held weapon" you could just keep a reference to the scriptable object for that gun instead of copying all its fields

#

would be easier wouldnt it? (presuming you do not try to modify it)

balmy vortex
grand snow
#

Update is every frame, FixedUpdate is each physics update

#

thats why the docs and any good tutorial does physics stuff in FixedUpdate() !

#

a quick google answers the question

west sonnet
grand snow
mighty citrus
#

Hey! I've been trying to replicate a grid system video from youtube, and so far everything works except for the onmouseenter highlight of a tile. It seems that the only thing I would need for this is a collider 2d for the tile prefab, yet somehow I don't get anything

mighty citrus
#

I'm not sure if I'm doing something wrong in my code since it's pretty basic just a Debug.Log in the OnMouseEnter method

rich adder
naive pawn
grand snow
rich adder
#

most likely defaulted to new input system

grand snow
#

all new projects use the new system now

mighty citrus
#

how do you check that?

rich adder
#

switch to the IPointerEnter interface and use the Physics2D Raycaster

west sonnet
mighty citrus
#

I have this so maybe the new?

mighty citrus
rich adder
#

You can switch it to Both inputs or Old in the Player Settings of Project Settings

hexed terrace
mighty citrus
#

alright i'll try to get both on and see if it works

#

thanks!

grand snow
#

we work with a reference to a scriptable object that holds the weapon data/information instead.

grand snow
#

many events exist check doc page above ^

west sonnet
grand snow
mighty citrus
grand snow
rich adder
#

It works if your player uses a controller to move a pointer, unlike OnMouseEnter which is stuck to mouse

west sonnet
grand snow
rich adder
mighty citrus
#

Alright yeah it does sound better that i can use both systems and make it work for any pointer

grand snow
#

no you only use the Ipointer events and event system way

rich adder
mighty citrus
#

yeah I'm going to use the ipointer thing, not the onmouseenter

grand snow
#

oh good

#

It requires an event system in a loaded scene to work

#

as well as a physics raycaster OR physics 2d raycaster to work with the colliders you want

rich adder
mighty citrus
#

Does the event system come whenever I use the Interface or do I have to add it myself?

mighty citrus
rich adder
rich adder
#

the "Ignore Raycast" layer you see

mighty citrus
#

Yup found it in UI > Event sytem too!

mighty citrus
#

I don't wanna mess it up

polar acorn
rich adder
#

if your UI item is non-interctive (like healthbars, scores etc.) and you don't want it to block the ray to Collider then you can untick the Raycast Target option

mighty citrus
#

is that option in the collider component?

balmy vortex
rich adder
mighty citrus
#

so for objects I have to disable the collider if I don't want it to interact, and UI disable the option?

rich adder
#

Imagine a giant Panel / Healthbar covers your object with the collider, your IPointer will not fire on collider object if its behind UI

mighty citrus
#

I meant that if I don't want an object specifically to be interactive at runtime, all I gotta do is disable the collider

rich adder
#

in terms of PhysicsRaycaster only

#

but other interactions too sure, OnColliderHit , or physics

mighty citrus
#

okay okay I'm starting to get it a little

#

my only 'concern' is that I might be a bit lost on how to make it work, as I do I have to check all the time where the pointer is, or can my objects just react like with onMouseOver

rich adder
#

for colliders a Physics Raycaster is needed on the camera

mighty citrus
#

ooh alright thanks for the doc!

rich adder
mighty citrus
#

I added the 2d one

hallow acorn
#

https://hastebin.skyra.pw/wexemuwupu.csharp hey im trying to give my line collision using an edgeCollider2D, but i get a NullReferenceException on line 34 ann i dont know why. could someone help me? thanks in advance

rich adder
#

therefore its null

#

Unity auto-initializes an array only if its serialized in the inspector, hence why points works without errors

hallow acorn
#

oh

#

ok i fixed that, but now i get an ArgumentOutOfRangeException

#

how would i fix that?

rich adder
#

well you don't have enough elements and you're going out of bounds

hallow acorn
#

what do you mean exactly?

rich adder
#

oh wait..

rich adder
hallow acorn
#

idk it changed a bit wait

rich adder
#

heres an examplecs var list = new List<int> { 10, 20, 30 }; list.RemoveAt(5); // Index 5 does not exist throws that error

hallow acorn
polar acorn
rich adder
#

points2D and points quantities dont match

hallow acorn
polar acorn
rich adder
#

points2D is literally empty

#

you initialized it, great.. now your points2D count is literally 0

hallow acorn
#

do i have to set a length?

#

i dont get lists

polar acorn
# hallow acorn i dont get lists

A list is a collection of things. You can add stuff to it. But you can't say "Get me the fifth thing in this list" if the list only has two things in it

hallow acorn
#

in a for loop ofc

polar acorn
#

That list is going to get very long very fast

hallow acorn
#

so i add them in start and replace them afterwards in update?

rich adder
#

what is even the point of points2D if you already have points

#

ohh I see SetPoints wants a list of Vectors..

hallow acorn
#

points is an transform array which is required for the LineRenderer and edgeCollider2d needs a list of vector2

hallow acorn
#

i dont really get why they wouldnt just use arrays tho

rich adder
#

List<Vector2> points2D = new(points.Length)

#

this might be pretty heafty too though..creating a new array every frame is ugly

#

cant you just do it in SetupLine ?

#

need more context to make a suggestion, like why is this looping in Update

hallow acorn
left violet
#

Hey, just have a quick question. We're trying to add local multiplayer and need seperate UI's for each player. We've found out that theres a MultiplayerEventSystem and are trying to use it, but although the setup seems correct it doesn't want to recognize UI when hovering over e.g. buttons. Our current setup consists of a player input whose actions both have a gameplay and ui component, aswell as the eventsystem as the UI input module. The event system itself has the same action map, aswell as the player root being the canvas of our player UI. I know this isn't much information, but I don't want to spam the channel so please tell me what kind of information you need ^^ - thanks!

#

it would probably not be bad to say, I do generate the UI using code whenever I need it, so since that might be relevant I thought ill post it here instead of unity talk. All it does is replicate prefabs and places it under the canvas though

hallow acorn
#

hey, i have a softbody system with a lot of spring joints. to make it a little easier to adjust the values i wanted to make a script to handle those. is there a way to differentiate between those springs if there are multiple on the same gameObject?

hexed terrace
hallow acorn
acoustic belfry
#

Hi, i tried to make (now a normal) movable plataform, tho it makes the player slip to the direction is moving, i mean, if the plataform goes right, the player gets yeeted right. It makes sense but i still dont know how to "calm it"

    {
        RaycastHit2D hit = Physics2D.CircleCast(transform.position, groundcolliderradius, Vector2.down, groundcolliderdistance, groundlayer);

        if (hit.collider != null)
        {
            // Check for WalkingBox component on the object we hit
            walkingBox walkingBox = hit.collider.GetComponent<walkingBox>();

            if (walkingBox != null)
            {
                Rigidbody2D boxRb = walkingBox.GetComponent<Rigidbody2D>();

                if (boxRb != null)
                {
                    rb2D.linearVelocity += new Vector2(boxRb.linearVelocity.x, 0); // Only add horizontal velocity
                }
            }

            return true;
        }

        return false;
    }```
polar acorn
acoustic belfry
#

everytime it touches the floor

polar acorn
acoustic belfry
#

i guess as long

polar acorn
#

Because every time this runs you add velocity

#

If you're running this every frame you're going to add the velocity every frame

acoustic belfry
#

o h

#

that explains the yeeting

#

well, thanks

stuck current
#

I’m making a fighter game like stick fight but making sliding work is annoying.
The player never slides because of the move force how do I fix this?

acoustic belfry
frosty hound
#

That's how.

polar acorn
acoustic belfry
#

o h

#

but wouldn't that cancell the imput?

polar acorn
#

You would include that

acoustic belfry
#

wat

polar acorn
#

You would set the player's velocity to their movement plus the platform's velocity

acoustic belfry
#

oh, ok

scarlet skiff
#

i need some advice on how to structure my items with my inventory, to simplify alot, currently the inventory is a script containing a field which is a list of IDs that (and helper methods and such), through ItemDatabase static method (a class that holds all the ItemData scriptable objects) you can get the full itemData through the ID, and i have a "Use" method that gets the index slot, find what id is stored in that slot but then.. thats where i got stuck, currently, that is all that the items are, an SO with these general fields every item would need, however i want each item to have its own ability, so each item would have to execute a unique method related to it, where we give the gameobject player as a parameter and from it, it can get any references it needs meaning this method can be static, no reference to an actual item in game is needed. but i dont know whats the best way to build a database with such methods and how to get the right method with the id.

i mean i could have children of the SO where each item has its own SO that inherits from the main ItemData SO and then inside it i can have a function or something but ill neeed like 100+ files each with its own SO unique child and that just seems impossible to track and chaotic.

i cant really think of an effective way to build an efficient system using what i have as the foundation

brave robin
acoustic belfry
polar acorn
acoustic belfry
#

but wasn't this how should be done?

#

also, player's velocity in theory would be 0

#

im AFK

scarlet skiff
# brave robin Will items ever have their own instance data? Like once an item is in the world,...

yes, the inventory is actually 2 dimentional, made that way so each item stored can have unique data, that way i can stack items that are of the same type but have different use amounts left, kind of like beign able to stack tools in minecraft. This also means when an item is "dropped", its specifics are passed onto the gameobejct version of the item.

this will be easier to explain with visuals, so in plain terms the inventory is a list of these structs, and ItemPickup has a "uses" field that is set to the amoutn of uses the items struct has when dropped, and likewise when we pick up the item, we set the new structs use amount to the itemData amount, so they do sort of hold specific data

polar acorn
acoustic belfry
#

oh right, 1

#

and so go on

#

but then what i should do?

polar acorn
#

You would do the things you'd normally do to set the player's velocity for your input, but then also add in the platform's velocity

brave robin
# scarlet skiff yes, the inventory is actually 2 dimentional, made that way so each item stored ...

It would be simpler if the Item instance class remained consistent from inventory to world gameobject. Only difference with the latter is that the gameobject refers to the Item it physically represents in the world. So Item contains instance data, and refers to an ItemData with all of its other information. ItemData also has a reference to the Ability you want it to possess. The Ability can also be a scriptable object type, with an abstract method for executing, and you just derive a new form of it for each ability you need.

polar acorn
# acoustic belfry i add force for the imput

Then you're probably just going to have to detect when you enter and when you exit the platform and change the velocity then, or else you're going to need to figure out how much force the platform imparts on the player to give it the same velocity and add that as well

acoustic belfry
#

o h, ok

hallow acorn
#

can someone help me creating a plane mesh from a few verts basicly acting as an outline? never did this before and i need it to fill in my softbody with color

grand snow
#

what do you have rn?

hallow acorn
# grand snow what do you have rn?

i dont have much that could be useful. just an array of transforms that could be used to construct the plane. but i also dont have points inbetween like a grid

grand snow
#

for a quad you just need 2 triangles
but you could just use the unity quad and scale/rotate/translate it as needed then

hallow acorn
grand snow
#

a plane wont cut it. use a inverse hull shader to do an outline of a mesh
or some post processing effect

hallow acorn
gleaming shadow
#

Small help
what is the correct way to do this line of code
follow.TrackerSettings.BindingMode = follow.TrackerSettings.BindingMode.WorldSpace;
for cinemachine?

summer wren
#

Could someone help with an issue with InputField in a layout group?
This issue it is pushing me to take another break due to days of frustration and different changes yet no results.

rocky canyon
ivory bobcat
#

Context would help

rocky canyon
#

you need to grab the CinemachineTransposer and setting the binding mode enum

#

yea more context would be helpful.. and also what ver of cinemachine u using?

rocky canyon
grand snow
rocky canyon
#

it draws the shape a bit bigger than the object originally..

#

and then thats placed behind w/ a black fill for example

hallow acorn
gleaming shadow
# rocky canyon `transposer.m_BindingMode = CinemachineTransposer.BindingMode.WorldSpace;` i be...

I am using Unity6 so CinemachineTransposer is obsolete now and it uses CinemachineFollow

On awake i am trying to set the bindingmode to worldspace for a safety measure

private CinemachineCamera vcam;
private CinemachinePositionComposer composer;
private CinemachineFollow follow;

void Awake()
{
    vcam = GetComponent<CinemachineCamera>();
    if (!mainCamera) mainCamera = Camera.main;

    composer = vcam.GetComponent<CinemachinePositionComposer>();
    follow = vcam.GetComponent<CinemachineFollow>();
    if (follow)
    {
        var settings = follow.TrackerSettings;
        settings.BindingMode = follow.TrackerSettings.BindingMode.WorldSpace; 
        // ! Member 'BindingMode.WorldSpace' cannot be accessed with an instance reference; qualify it with a type name instead
        follow.TrackerSettings = settings;
    }
}
rocky canyon
#

explain "opposite"

grand snow
#

as i said, we can place a square/rectangle easily so we dont have a good reason to "make" a plane procedurally

rocky canyon
#

and then ~~assign ~~ modify them and reapply

#

follow.TrackerSettings = settings;

#

but im going off dusty knowledge.. and cinemachine did that big update and now im still discombogulated

gleaming shadow
rocky canyon
#

ya, i believe it kinda works like how u'd change a material..
you'd instead copy that material, (change the copy) and apply it back to the renderer

#

i just know im always using vars when messing with cinemachine 🎥 😅

#

in this case a struct

hallow acorn
rocky canyon
#

TrackerSettings being a value-type and not a reference

rocky canyon
#

each one being a vertex.. and then connect them with triangles

hallow acorn
#

thats exactly what i try to achive

rocky canyon
#

ohh coolio.. its pretty straight forward.. unfortunately im not one of the ones that would know how to do it 🤣

hallow acorn
#

but im... lets say not really experienced

grand snow
#

if the vert count can change you may need to trianglulate and gen uvs to then make a mesh

#

otherwise it could just be pre made

#

if you just need an axis alined box behind the bounds that is easier

rocky canyon
gleaming shadow
#

@rocky canyon
Just in case wanted updates - i figured it out
its so weird!
had to add using Unity.Cinemachine.TargetTracking;
and then this just worked...
settings.BindingMode = BindingMode.WorldSpace;
sighh
Cinemachine is doodoo cheeks

rocky canyon
#

gotta go treasure hunting thru namespaces for any kind of functionallity in the new cinemachine system 😄

grand snow
#

wow namespaces anyways

rocky canyon
#

always.. even the old cinemachine was a lot of namespace fiddling

hallow acorn
rocky canyon
#

reminds me of doing any kind of post processing

ivory bobcat
rocky canyon
#

BindingMode got moved out as a top-level enum inside the TargetTracking namespace.

Old muscle memory (CinemachineTransposer) expected it to live under the component type itself.

Unity6 modularized Cinemachine to reduce cross-dependency
-# ai explaination

#

keepin the docs close-by helps

#

theres certain docs more important than others..
for me its cinemachine and DoTween

grand snow
rocky canyon
#

ohh looks extensive

hallow acorn
grand snow
#

going from an ngon to triangulated mesh is not simple but if you can find a good algoritm to impement it may be worth it but there is a reason why libraries exist

hallow acorn
grand snow
#

gpus can only draw triangles so you MUST solve the problem

hallow acorn
#

aw man😔

grand snow
#

software like blender has automatic ways to triangulate an ngon for us

hallow acorn
grand snow
#

3d software is not the same as a game engine

#

Hmm actually I wonder if probuilders poly shape could be used for this

rocky canyon
#

posssibly

grand snow
#

I just did some searching and they use a lib poly2tri in probuilder 🤔

#

this could be used hopefully to just do everything for you @hallow acorn ⬆️

hallow acorn
#

what exactly is that?🤔

rocky canyon
#

hold up.. clarify something to me.. is this meant to be a solution to build the shape at runtime or before?

#

can probuilder be utilized @ runtime? just curious

grand snow
grand snow
hallow acorn
#

but im completely overwhlmed by what im seeing

#

how tf do i use that

#

why is it so complicated to color in points held together by hopes and dreams

rocky canyon
#

just not a common thing thats done all that often ¯_(ツ)_/¯

grand snow
#

Its just how it is, procedural geometry is not an easy thing to do
Try making a pro builder poly shape in editor and see if it makes a shape as you expect

rocky canyon
#

therefor theres no drag and drop simple solution that exists just yet

#

you could be the first! 😉

hallow acorn
#

dont even know how to install the package or what it is😭

grand snow
#

well thats easy. go to the unity package manager, unity registry and search

#

cant find it? google time

hallow acorn
rocky canyon
#

headstart 💨

grand snow
#

well try to use the information we have given you to achieve this if you want

hallow acorn
#

rn im having endstage imposter sydrome haha but i wont give this project up! atleast not if i dont get the damn color working

rocky canyon
#

^ it'll be a combination of

  • installing the package
  • looking at examples
  • reading the docs
  • googling what ur attempted + probuilder
  • find threads and convo's / maybe tutorials doing what u want to achieve
#

or if its not 💯 do what u can w/ what u know then try to fill in the missing pieces... its all about experimentation, trial and error, and iteration

#

find other softbody resources (similar to urs already)
see how they make the shapes-> fill in the vertices

hallow acorn
#

cmon bro...

rocky canyon
#

i remember there being a softbody tetris prototype

#

seemed pretty epic

grand snow
rocky canyon
#

or just install and import manually

hallow acorn
#

what is git?

grand snow
#

wait hangon a sec what are you doing

hallow acorn
#

i only know github

grand snow
#

install pro builder

hallow acorn
rocky canyon
#

probuilder is avail via the asset store / package manager

grand snow
#

and was this error a result of that installation?

hallow acorn
rocky canyon
hallow acorn
grand snow
#

ah no no that was me sharing the lib they use as reference

#

so dont do that and you are good 😆

hallow acorn
#

so what is git now?

grand snow
#

dont worry you tried something incorrectly so dont bother

hallow acorn
#

what should i do instead then?

proper needle
#

its inside a monobehavior class too

grand snow
rocky canyon
grand snow
#

lets crawl before they run to the moon

rocky canyon
#

but probuilder is a good tool to start

#

yea true

grand snow
#

They dont know what git is so probably too much for em rn 😆

hallow acorn
#

THEN TELL ME WHAT GIT IS MAN

rocky canyon
#

ya, just as a resource tho to kinda double back to and compare.. the more the merrier ya know

#

has some basic concepts which are still prettty relevant

grand snow
dapper ferry
hallow acorn
#

i have github installed

tacit prism
#

why did the mp4 import like that.

ivory bobcat
proper needle
rocky canyon
ivory bobcat
#

The entirety of the script.

#

How to post !code

eternal falconBOT
grand snow
tacit prism
rocky canyon
proper needle
ivory bobcat
tacit prism
#

Alright, trying again, character is only moving towards "true north" and not changing direction based on which way they are "facing" ontop of just not turning

tacit prism
rocky canyon
#

u need to run it thru a function to make it direction relevant / local to the player/cam

proper needle
tacit prism
#

ill see what i can do, im still pretty fresh with this though

rocky canyon
#

~~something like the TransformDirection method here ~~(edit: incorrect, i seen later that he's multiplying w/ the local transforms x and z)

tacit prism
#

]rethaepwease

hallow acorn
#

@grand snow i dragged the folder in my project and got 54 errors i cant do this anymore

grand snow
#

what folder what are you doing???

hallow acorn
#

idk man😭

tacit prism
rocky canyon
#

u already have ur movement vector and stuff working?

hallow acorn
grand snow
hallow acorn
#

what im i supposed to do now tho