#💻┃code-beginner

1 messages · Page 568 of 1

teal viper
#

Publishing is not the same as building.

hallow bough
#

oh

nova ivy
#

where should I post collision related issues?

#

or questions rather

wintry quarry
nova ivy
#

is that a question

wintry quarry
#

Your question is somewhat vague so yes

nova ivy
#

where should I go for help

wintry quarry
#

it's a problem with your code either way

nova ivy
#

okay i think it has to do with the entire collisionable tilemap being labeled as ground

#

can I split existing tilemaps up? or do I have to redo them

hallow bough
#

running my game on WebGL causes a strange issue. The game loads, then the camera is zoomed in. All assets are on a canvas layer.

#

please ping me if anyone gets a response, I will be unable to respond immediatly

teal viper
gaunt sandal
#

this should give you exactly what you're looking for

#

i don't think it gives the exact data of the object you collided with, but you can figure that out by spawning a very small ball there that is a trigger, then getting the gameobject from the OnTriggerEnter()

#

you could also use this: Camera.ScreenPointToRay()

cosmic dagger
#

that's half the solution; ScreenToWorldPoint returns a 3d world position converted from a 2d point on the screen. then you need to shoot a raycast from the camera to the world position. this will determine if anything was hit . . .

gaunt sandal
#

actually, it looks like there's an overload for Physics.Raycast() that accepts raw rays, so ig you could use either the ray or world point

cosmic dagger
gaunt sandal
cosmic dagger
#

i'm saying, you can use either method to get/check if an object collided . . .

gaunt sandal
#

so it'd look something like this @tame oriole :

Ray ray = Camera.ScreenPointToRay(mousePosition);
RaycastHit hit;

// shoot a ray to where we clicked and see if it collides with anything
if (Physics.Raycast(ray, out hit, distance) // distance = 100 in this case
{
   // tell us what we collided with
   Debug.Log("Hit object: " + hit.collider.gameobject.name);
}

now, of course, this will only work on objects that have collisions (i'm not sure if this will count triggers) so you'll need to add some sort of collider shape to any objects that you want to be able to interact with in this way.

also, i'm not going to tell you how to get the mouse position yet because i don't know which input system you will be using (the legacy Input class or the new Input System Package). That part you should be able to figure out from tutorials

cosmic dagger
gaunt sandal
#

aaaaaaaaaaaaaaaaaaaaaah

#

the mouse pos

#

i'm silly

blissful yew
#

This is the top level of my solution - can anyone explain what these mean or how to learn more? What's the difference between assembly and firstpass and editor firstpass, and why is odininspector and ink in their own categories..?

teal viper
plain imp
#

I've tried different methods to allow a character's avatar to 'sit', including reparenting to an empty node to the chair or couch to get the right height and rotation.
Is there a more efficient way to do this?

teal viper
teal viper
#

Oh, so first pass is for plugins.

slate haven
#

I want to implement Jumping (new input system) without rigidbody, I know we can use transform.translate(vector3.up * someSpeed)... but anything else i gotta take in my mind? Like creating my own gravity, then doing a ground check

charred spoke
#

Both of those things yes

slate haven
charred spoke
#

Definitely not. You either have a physics based controller or a fully kinematic one. Mixing the two is a recipe for disaster

slate haven
#

in what ways could it be bad

charred spoke
#

It’s mixing two mutually exclusive methods

astral falcon
# slate haven in what ways could it be bad

You want physics but do not want to use physics. And thats a paradoxon within itself. If you disable physics for a certain part and move everything manually, you can miss a lot of collisions you might want to check for. What happens, if you jump into a collision, an enemy, against a ceiling and so on. You will start to try to cover evertyhing, physics is already doing for you, just to workaround the physics engine for jumping. maybe you can explain, why you want to avoid rigidbodies for jumping

slate haven
slate haven
# slate haven because using rigidbody is making my movement jittery
    {
        if (movement != null)
        {
            Vector3 currentPosition = rb.position;
            Vector3 moveVector = new Vector3(movement.x, 0f, 0f);
            Vector3 newPosition = currentPosition + moveVector * moveSpeed * Time.fixedDeltaTime;

            //clamp player
            newPosition.x = Mathf.Clamp(newPosition.x, xMinClamp, xMaxClamp);

            rb.MovePosition(newPosition);
        }
    }```
#

thatswhy i made my player isKinematic = true.

#

Its an endless runner game

astral falcon
slate haven
#

thatswhy maybe

astral falcon
#

you rather wanna explain what "jittery" means and what code parts are running while its jittering

slate haven
#

When its not kinematic

#

When I make it kinematic, it runs smoothly

#

I do want to use rigid body as well for collisions and applying some physics

astral falcon
#

Wait, are you runing that code with MovePosition and you tried to isKinematic = false and it was jittery?

slate haven
#

yes

astral falcon
#

Its for kinematic only taking interpolation into account

slate haven
#

yes I know

#

for that i had to

#

make it kinematic and then interpolate

astral falcon
#

Or you move it correctly with rigidbody physics and do not have to turn it off randomly

slate haven
#

what I mean is, I do have to create a jump for my player

#

without using rigidbody

#

How do I create my own gravity?

astral falcon
#

okay, you ignore it, got it. 😄 well, then you have to calculate your own animatino curve in runtime, that lerps your y position of the MovePosition to go up fast and back to the floors hit point. You do you

slate haven
astral falcon
tiny wind
quick epoch
#

hello guys what would you recomend as a pathfinding for 2d top down rpg grid walk style for my enemies? i just want it to follow player within a radius and if player goes out of radius enemy goes back to spawn point and back roaming

tiny wind
#

nvm its fixed now

#

i mistyped something

echo ruin
visual linden
tiny wind
#

!ide

eternal falconBOT
lament gyro
#

Having a weird issue with Unity 6 this morning. I can't seem to run simple coroutines. I've tried rebooting computer, deleting library folder, restarting unity, it simply won't complete this very simple code. I created a new scene and only put these scripts in it and it still wont complete. https://codefile.io/f/cmz5zA1qd9

burnt vapor
languid spire
burnt vapor
#

Or that

languid spire
#

or was that too rude?

burnt vapor
#

Like, did you verify it's actually not called or do you assume it doesn't because the Test class is not called?

#

That way it can be determined what the root cause is. For example, maybe you didn't include the script at all

lament gyro
#

Because of the comments I put in, it says Begin Initialization in the console. After that, nothing. When I trace the code with a breakpoint it's almost like the coroutine in Test.cs never begins

burnt vapor
#

That's because you call it wrong

languid spire
#

this Test.Initialize(); is not calling a coroutine

burnt vapor
#
-Test.Initialize();
+yield StartCoroutine(Test.Initialize());
#

I'm surprised this worked at all, if it did

#

The extra StartCoroutine might not be needed, actually. I don't remember

#

If you yield the coroutine you wait for it to finish. This way you don't need to extra boolean and while loop

#

Also, side note, you can make your Start method a coroutine.

public IEnumerator Start()
{ 
    if (!IsInitialized)
    {
...
lament gyro
#

Oh for pete sakes you're probably right. I forgot I did change the way the initialization is managed in the code before I went to bed and didn't test it because I thought it was such a minor change. I changed it from the scripts starting their own initialization coroutine in start, to the game manager initializing them in it's initialization coroutine one by one. That didn't work this morning so I copied the code into these simple scripts and now, I feel like an idiot lol

burnt vapor
#

Either way the root reason is the fact you call the Coroutine wrong. Enumerations are not invoked with a simple method call, but have to be iterated. In your case it likely got to the yield return null; part and then paused and waited for something to continue it. However, nothing does that

#

So to comment on my previous point, you do need to wrap it in StartCoroutine then because then Unity handles the iteration

burnt vapor
languid spire
#

he knows how to start a coroutine as shown by his code, no need to belabour the point

burnt vapor
#

I know, this is just extra explanation as to why it would break specifically

lament gyro
#

Yes and it's working fine now 😛 I apparently need coffee this morning

#

Brain is still asleep methinks

languid spire
burnt vapor
#

Don't forget that coffee is the source of good code

exotic prism
#

https://paste.mod.gg/seoydkgszyrr/0
https://paste.mod.gg/tqrzxmnyeank/0
I've encountered a jittering problem that appears only in the Game View. It doesn't occur in the Scene View. My player movement and camera systems are implemented with separate scripts, and I suspect the issue might be related to how the camera follows the player or processes rotations.

  • The jittering happens when rotating the camera or moving the player.
  • It is more noticeable during rapid movements or rotations.
    Any help would be nice.
fickle plume
#

You also can omit StartCoroutine when starting it inside another coroutine, but it has to be yielded.
yield return MyOtherCoroutine();

languid spire
fickle plume
#

yep, it's situational

languid spire
#

interesting, not tried it, would stopping the outer coroutine also stop the inner one?

burnt vapor
#

Probably not since they don't rely on eachother. That would also make for weird edge cases

fickle plume
#

I forgot how it works exactly, I had a testbed checking all cases with them at some point. Move on to UniTask now.

lament gyro
#

Hey I did learn something though! I didn't know you could yield return StartCoroutine() lol

burnt vapor
#

Better to delegate cancellation with something like CancellationToken if you need things to cancel as a group

languid spire
visual linden
#

(Or did I misunderstand the issue and this also happens in standalone builds?)

exotic prism
fickle plume
exotic prism
exotic prism
wintry quarry
languid spire
wintry quarry
# exotic prism

Since your rotation code is directly modifying the player's Transform, it will cause the Rigidbody interpolation to break

#

You should never directly modify the Transform for a Rigidbody

#

Rotate via the Rigidbody instead

exotic prism
#

I saw that solution on some forum sites but never tried yet

wintry quarry
#

If you use MoveRotation it needs to be in FixedUpdate

#

And the mouse accumulation needs to be handled properly if you're using mouse controls

#

It's slightly trickier

exotic prism
#

I use player Input system for getting mouse input

bold rune
#

I'm brand new to game dev and was wondering if a good game to start to make would be a tower defense game? for a beginner, I do have a bit of coding experience.

visual linden
#

Sounds like a great first project

steep rose
#

sure, just make sure you !learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

bold rune
#

would i need to make my own assets or is there a place i can find free ones?

steep rose
#

you can make your own or find some online

#

you can use sites like sketchfab, CGtrader, etc as well

bold rune
#

ok thanks

languid spire
steep rose
languid spire
rancid tinsel
#

Isn't splitting the MusicManager into 3 separate classes here just overengineering? I can't think of a single benefit

swift crag
#

what is this from?

rancid tinsel
#

because I swear the more it's explained to me the less I understand it

swift crag
#

consider not using the infinite sludge generator

rancid tinsel
#

I think it's fine as long as I'm not taking it at face value

swift crag
#

it will produce an enormous amount of plausible-looking text

languid spire
rancid tinsel
#

I'm starting to believe no one does because everyone seems to think differently

visual linden
#

Let's not get carried away by the GPT'ness alright, I think @rancid tinsel 's original question is still valid :D

rancid tinsel
#

Which would be fine if I wasn't being graded on how subjectively "solid" my code is

steep rose
swift crag
visual linden
#

My unpopular opinion is that Manager classes are code smells and by simply not naming anything "-Manager" you're more likely to end up with a cleaner architecture.

steep rose
swift crag
#

trying to break that up into small pieces would be nonsense

steep rose
#

it is basically like cutting chocolate into small chunks and eating them 1 by 1, it is insanity

swift crag
#

chickenshit abstraction, in my opinion

rancid tinsel
#

that's my opinion too - I feel like the issue might be that SOLID only works in bigger projects

#

and that wasn't taken into consideration when designing the course

swift crag
#

it sounds like you're doing some kind of school project here

#

you have to have a coherent definition for "single responsibility"

#

You can always find some weird angle to split an existing object with

#

until you have 4,000 classes that all do nothing and a game that doesn't work

#

but hey, the code is Clean (tm)

steep rose
#

and it will cost roughly 1,000 dollars

swift crag
rancid tinsel
#

I've been told that code I wrote had multiple responsibilities: 1. determine sentence type 2. verify sentence based on their type 3. manages unity components, which makes me think that I'm meant to use classes like methods?

rancid tinsel
#

Professor's assistant

swift crag
#

"manages unity components" is an insanely vague statement

rancid tinsel
#

iirc

swift crag
#

oh, okay

#

I would want to separate "sentence validation" from "displaying text", yes

visual linden
#

Is this maybe a case where they expect you to adhere to a model-view-component pattern perhaps? I can imagine if that's been taught that it could be expected from you in the project assignment.

rancid tinsel
#

right?

rancid tinsel
visual linden
#

Controller* damnit

#

Model View Controller, my brain wasn't braining there

rancid tinsel
#

Yeah I just read about it and it doesn't sound like anything we've covered so far

#

could be wrong but seems more focused on software rather than games? (like front end, back end?)

swift crag
#

but I can imagine your game getting some input from the user, then handing the string off to a text validator

#

and then displaying something in your UI based on what the validator said

#

you don't want to shove the validation logic directly into the UI components

rancid tinsel
#

sort of, it takes input in the form of "nodes" and then tries to piece those together to then make some sort of string

swift crag
#

because then you have to have a UI component to be able to do anything with text validation

rancid tinsel
#

like making a sentence with blocks essentially

#

i can show the script in question actually one sec

#

its a bit of a mess because I was struggling to figure out the logic when writing it

#

so it was essentially the first working version

#

oh looking at it again its actually taking the value from the TMP component, and then using it to parse

visual linden
#

Ahh, yeah it's true it's not really best practice to just do a GetComponent call for a UI component, hope it's there so you can get the value.
You'll want a separate class that has direct references to the UI elements, and an instance of your SentenceParser class that it uses.

#

Ideally you'd want to be able to use your sentence parser regardless of whether you've got a dropdown selection, an input field or just directly feeding it options.. For instance.

rancid tinsel
#

Definitely, I think hardcoding was just the only solution I came up with at the time for the parsing logic which is also why the rules are methods instead of their own classes/child classes

#

btw, how does the unity inspector tie into all of the SOLID and clean coding stuff? from what I understood, it breaks encapsulation because you can change variables outside the class

#

idk if that is something that I need to worry about for the project but I'm just curious

visual linden
#

The Unity inspector just exposes serialized values for you to edit visually through the Editor. Conceptually there's no real difference between you setting a value through the inspector vs you defining that value directly through variable declaration in code.

wintry quarry
#

Well the main difference is two different copies of the script can have two different values.

visual linden
#

Sure, but in terms of "Clean code"

#

from what I understood, it breaks encapsulation
Encapsulation is a code concept. The Editor environment is a thing of its own and doesn't really apply when you talk about SOLID and clean code.
You'll just want to make sure that when you're writing your systems, they encapsulate their functionalities from other systems in code.

ornate aurora
#

Also, each tile is rendered with two triangles, and that makes up for 6 vertices total. Isn't that a waste? I mean, couldn't it just use 4 verts or am I missing something?

grand snow
#

dunno whats up in that screenshot but geometry needs to be made of triangles (defined as a set of 3 indicies)

#

4 verts should be enough however so not sure what its doin

ornate aurora
#

Hmm it seems like that strategy arises from this error:
Failed setting triangles. The number of supplied triangle indices must be a multiple of 3.
UnityEngine.Mesh:set_triangles (int[])

#

So was that a good solution or is there a way to save the 2 extra verts?

swift crag
bright siren
#

The author is wasting vertices - you would have to modify the code yourself. But first debug it

swift crag
#

You can re-use vertices

#

so two triangles can use the same vertex index

#

but you still have to specify all three indices

ornate aurora
#

Yes exactly

swift crag
#

(you could use the "triangle strip" mode, but that would be pretty awkward for a bunch of disconnected quads)

ornate aurora
#

Are there any alternatives? Any 2d tilemap library that allows for fast runtime tile modifications

bright siren
#

but if the library never sets indexFormat to 32bit you will soon go wrong too...

ornate aurora
#

Also. If I wanted there to be gaps between the tiles (only graphically) is it still viable to reuse the vertices of two adjacent squares? So that adding a row of n squares requires only n+1 extra vertices

bright siren
#

you can never re-use vertices from adjacent squares since theyw ill have different UVs

#

you can just reduce 6 to 4 per square

fresh arrow
#

hello! i wanted to ask what is the most effiecient way of developing player movement with animations?
is it with using input system or normally with coding

wintry quarry
#

And what do you mean by "efficient"?

bright siren
#

Though I have not used it Unity has its own tile map system - have you not tried it?

ornate aurora
#

Yes. SetTilesBlock (being the fastest way to change batches of tiles) is not fast enough for my use case

#

I have an infinite tilemap that calls SetTilesBlock on the chunks that the player sees and hides the ones off-camera. I managed to optimize a lot of other stuff, and the bottleneck ended up being that method

swift crag
#

I wonder if it'd be smarter to use multiple tilemap renderers

#

(and thus multiple discrete tilemaps)

sand swift
swift crag
#

Instead of storing everything in one enormous tilemap, you'd have a grid of tilemaps

swift crag
#

So instead of translating a world position into a cell position, you'd need to figure out both the tilemap and the cell position within that tilemap

#

This way, different chunks are completely independent

#

You don't have to mangle a single enormous tilemap every time you want to hide or reveal a part of the map

#

I have no idea what goes on under the hood, but I imagine that some operations have a cost proportional to the total number of tiles in a tilemap

ornate aurora
#

Hmm I'm not saving anything yet. I just change the already existing tiles because tilemaps do have infinite tiles, you just modify them. Currently I'm showing 128000 tiles at most and I update only batches of them at a given time

rancid tinsel
#

https://paste.mod.gg/qqnwvnpsqiro/0 how "clean" is this? I just wrote it with the intention of it: A. not caring about what string is passed into it, and B. only being in charge of managing the dictionary, which includes adding, removing and checking

#

is there anything else i should add/consider?

#

im not 100% sure on it being a singleton

naive pawn
#

if you want a global dictionary, why not just make a static dictionary
does it need to be aware of unity lifecycles at all?

burnt vapor
#

I'm pretty sure Add already doesn't throw on existing keys. If it does, you can just use the indexer

#

Remove also doesn't throw. Even better, it returns false if the key didn't exist so this code just limits the ability to know if it was removed at all

burnt vapor
#

Elaborate on what? Using the indexer?

rancid tinsel
naive pawn
rancid tinsel
burnt vapor
burnt vapor
rancid tinsel
#

oh so instead of removing/adding it, id set it to false/true instead?

naive pawn
#
- dict.Add(key, value);
+ dict[key] = value;
#

it also works as a replace

#

you're already setting it to true/false

burnt vapor
#

Note that if this code ends up doing more that justifies the point of these methods, then you could totally use them. But if this is just an alias (and just exists to check for a key) then note there are existing methods in the Dictionary and you basically limit your ability to communicate with the dictionary this was for no reason at all

naive pawn
#

if it's always gonna be true, no point in having it, may as well just use a set instead

burnt vapor
#

On the topic on improving the code, consider updating the error log:

-Debug.LogError($"SELF ERROR: WordDictionary already exists, deleting {this.gameObject.name}.");
+Debug.LogError($"SELF ERROR: WordDictionary already exists, deleting {this.gameObject.name}.", this.gameObject);

Reason is in the event you end up with a duplicate, you can click the error message and navigate to the gameobject.

#

Then you can remove it if needed. Maybe also do it for the actual singleton with a regular log message in case that one is the bad actor

naive pawn
#

i mean, is it really gonna be an error

burnt vapor
#

No, should be a warning

naive pawn
#

if you have the singleton able to initialize starting from many scenes, it'd be a normal part of the operation of the singleton

#

so it wouldn't be a warning/error/unexpected scenario at all

burnt vapor
#

Not sure I follow

naive pawn
#

if you only have 1 instance of the singleton throughout all your scenes (not at runtime), then you wouldn't be able to use that singleton from other scenes when testing, when the scene holding the singleton hasn't been loaded

rancid tinsel
#

ah i see yeah it should probably be a warning

#

or just a debug log

naive pawn
#

would it not be normal to have that singleton be able to load from any scene, where the Destroy part is normal and expected?

burnt vapor
#

Usually your singletons would always be loaded, either in an additive scene or with DDOL

rancid tinsel
#

at least thats how i understand it

naive pawn
rancid tinsel
#

in which scenario the one from the next scene is going to throw the error and destroy

naive pawn
#

just have it in every scene where it needs to be accessed

#

and let the Awake singleton logic handle that

burnt vapor
#

But then you have a copy pasted bunch of instances everywhere

naive pawn
#

how's that an issue?

burnt vapor
#

I mean I personally don't have instances in specific scenes. I usually have a provider that makes them. But even then copy pasting them everywhere makes no sense

#

Because imagine having a lot of scenes and having to place your singletons everywhere

#

Or editing them, and having to edit them all

rancid tinsel
#

is this more what you meant or am I still not following

burnt vapor
#

I usually just have an additive scene in the background that contains my provider

naive pawn
burnt vapor
#

Placing them in literally every scene is silly

rancid tinsel
#

just to clarify - AddWord will be used most likely only to populate the dictionary at the start, and RemoveWord will be used to get rid of words in there if theyve been guessed already

burnt vapor
naive pawn
burnt vapor
naive pawn
#

oh wait you can add in the inspector nvm

burnt vapor
#

I just don't think you should place your singletons in every single scene lol

rocky canyon
#

Additive Scenes be the way to go 👍 nice and simple

burnt vapor
#

Yeah that's what I mean

#

The scene basically has a system similar to .NET's IServiceProvider, if you know what that is

naive pawn
rancid tinsel
#

it's going to be for a game where you type a certain category of words, and if they match whats in the dictionary, the player gains points, some visual stuff happens and its removed from the dictionary to avoid repetition

naive pawn
#

where does the "dictionary" part come in?

#

sounds like you just need sets or lists

rancid tinsel
#

true actually

burnt vapor
#

HashSet

#

HashSet is unique and fast

rancid tinsel
#

wait but why wouldn't you use a dictionary? im still confused on that

naive pawn
#

or if you're going with a dictionary, set them to false instead of removing them

languid spire
naive pawn
rancid tinsel
#

so i could just use anything else

wintry quarry
naive pawn
wintry quarry
#

HashSet makes more sense for just checking for membership in the set

naive pawn
#

the value here is true, what does that mean

polar acorn
naive pawn
rancid tinsel
#

so if im following youre not necessarily saying you cant use a dictionary, its just that there are things better suited for what im doing?

wintry quarry
#

It's pointless to have Dictionary<string, bool>. It's just a waste of memory to store things there with false

burnt vapor
#

Point here is accessing the single instance?

rancid tinsel
#

ill look into hashsets then and report back if im struggling with anything

burnt vapor
#

HashSet literally works the same as a Dictionary. You just don't give a value when adding entries

#

Just please use case insensitive comparisons. You can set it on the HashSet constructor as a parameter

languid spire
burnt vapor
#

Huh? A singleton pattern doesn't ensure that multiples are gracefully destroyed

#

If there are multiple, that's an error

#

Nothing about a singleton pattern ensures this is done

naive pawn
#

depends on how you make the singletons imo

rocky canyon
#

instead of manually placing singletons in every scene.. which could be error-prone or just repetitive.. its possible to use them in an additive scene to help make life easier and scenes cleaner for those working w/ it..

languid spire
rocky canyon
#

i use singletons in persistent scenes.. (or u could just call them static classes)

polar acorn
#

The difference between "having a static instance variable" and "the singleton pattern" is gracefully having additional instances of an object self-terminate.

burnt vapor
#

Is the issue logging that multiple instances exist?

naive pawn
polar acorn
burnt vapor
#

Considering Unity doesn't guarantee order, I don't see the issue with logging an error

polar acorn
burnt vapor
#

What if it destroys the wrong one?

naive pawn
polar acorn
polar acorn
burnt vapor
#

There's definitely a wrong one when the available singleton is suddenly not in a persisting scene and it gets destroyed by Unity

#

A good singleton pattern would not even care about this. Instead of defining the instance in the scene you'd have a general provider do it for you and ensure the right reference is returned when you ask it for an instance

rancid tinsel
#

did i understand correctly that a hashset never allows for duplicates? as in, if its already in there it just replaces whats in the same "location"

polar acorn
#

Yes

burnt vapor
rancid tinsel
#

so like here I could just remove the if

#

and it would work the same

polar acorn
#

Technically, that's a property of any set, but the HashSet uses the hashcode of the object to ensure no duplicates

burnt vapor
#

And this is such a broad term that you really can't say that it would not allow duplicates

polar acorn
#

so HashSet is generally the one you want to use

burnt vapor
#

For example with your strings, casing already matters

burnt vapor
#

That's why I said you need to make it case insensitive

#

You can also modify the hashcode returned. It's a good idea to do this in some cases

#

But because of that different classes/structs/types will return a hashcode differently. It also means modifying a value in a class or struct might not suddenly make it unique

#

But whatever, too much explanation. Just make it case insensitive in your case and it will be unique 😄

naive pawn
polar acorn
#

Yeah, if the two objects are the same, there's no difference between replacing it and doing nothing

burnt vapor
#

Here's a class that when used in a HashSet will never allow for more than 1 entry to be added

public class Foo
{
    public override int GetHashCode()
    {
        return 0;
    }
}
wintry quarry
#

it will just be VERY SLOW

#

because every pair of objects will have a hash collision

#

HashSet also uses .Equals

#

The HashCode is used first to rule out things definitely not being equal, quickly

#

Such a HashSet would essentially be O(n) for insertion and removal

burnt vapor
#

Huh you're right

#

I was confident it strictly checks hashcode, but it does both

wintry quarry
#

What you can do though is something like this, which is occasionally helpful:

if (myhashSet.Add(x)) {
  Debug.Log("Item was added");
}
else {
  Debug.Log("Item was a duplicate");
}```
rancid tinsel
#

btw i just came across string.ToLowerInvariant - is it good practice to use that over just string.ToLower?

wintry quarry
#

Probably yes

burnt vapor
rancid tinsel
#

i know i wont need it in my case but i can definitely see that being useful

slender nymph
# burnt vapor Yes. For some reason the better practice is `ToUpperInvariant` according to my a...

https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2015/code-quality/ca1308-normalize-strings-to-uppercase

Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip. To make a round trip means to convert the characters from one locale to another locale that represents character data differently, and then to accurately retrieve the original characters from the converted characters.
huh, TIL

burnt vapor
#

Heh, well there you go

#

I just went ahead and turned that part of the analyzer off since I never understood why it required this

naive pawn
#

iirc the most notable (ig) culprit is the turkish lowercase i

echo copper
#

why do my raycast don't work? why do it returns me almost the same point as the ray creator?

slender nymph
#

show code and related setup

echo copper
#

public class rotator : MonoBehaviour
{
public Vector3 collisionpoint;
public GameObject checker;
public Ray ray;
private RaycastHit hit;
void Update()
{
ray.origin = transform.position;
ray.direction = -transform.up * 225;
Debug.DrawRay(transform.position, -transform.up * 225f);
if (Physics.Raycast(transform.position, -transform.up * 225f, out hit))
{
collisionpoint = hit.point;
}
}

slender nymph
#

!code

eternal falconBOT
polar acorn
echo copper
#

like, collision of my player?

polar acorn
#

Try logging the object you hit to see

slender nymph
echo copper
slender nymph
#

have you tried logging what was hit

echo copper
#

yes

slender nymph
#

so what does it say was hit?

echo copper
#

if (Physics.Raycast(transform.position, -transform.up * 225f, out hit) && hit.collider.CompareTag("Ground"))

#

let me check

swift crag
#

this does nothing to control what the raycast hits

#

the length of the raycast is also not what you think it is

#

the length of the direction vector is irrelevant

#

there is a separate parameter for the maximum length of the ray

wintry quarry
echo copper
polar acorn
#

Then it hasn't hit anything

wintry quarry
burnt vapor
#

I feel like you should look into debugging raycasts by drawing what it does

echo copper
slender nymph
#

how have you confirmed that

wintry quarry
wintry quarry
#

but yeah how are you confirming that

echo copper
#

ok, it returns me my ground block, but vector3 changes only if i touch another ground

#

like, when i'm moving on one platform, the hit.point isn't changing

#

and when i go to another platform, hit.point changes once and then don't change

#

i am really sorry to pissing you off (if it is)

polar acorn
#

hit changes every time you call Raycast, regardless of whether it actually hits anything

echo copper
#

urm... what? void Update don't make it changes constantly?

polar acorn
#

Every time this line runs:

if (Physics.Raycast(transform.position, -transform.up * 225f, out hit))

hit will change.

#

Regardless of whether it actually hits anything

echo copper
#

okay, now hit.point changes when my player rotates in other y direction

#

wth?

polar acorn
#

Again, hit will change literally every time you run the raycast

whole cliff
#

it is setup

slender nymph
#

check your spelling

rich ice
#

capital H

naive pawn
polar acorn
naive pawn
#

i told you the fix

whole cliff
echo copper
naive pawn
# whole cliff forgot

you have an axis Horizontal, you're trying to use the axis horizontal, those are not the same

polar acorn
rich ice
whole cliff
slender nymph
#

things need to be spelled correctly, yes

polar acorn
echo copper
polar acorn
#

No matter what

swift crag
#

In fact, it MUST assign a value to hit. The compiler demands it.

rich ice
swift crag
#

As far as the function knows, hit is completely uninitialized, and MUST be assigned to by the time it exits.

#

for exactly the same reason that this is illegal:

int x;
x = x + 1;
cerulean badger
#

im lf a system to save player data when quitting and loading at rejoining. What concepts do u think I should learn first to make it?

slender nymph
#

how to save and load data

cerulean badger
#

ok, u've simplified it all lol

slender nymph
swift crag
#

You can start by reading about PlayerPrefs -- it's extremely basic and not suitable for many tasks

#

but it's enough to store some numbers and read them later

slender nymph
swift crag
#

it's the simplest possible garbage :p

#

I think it's a fine place to start

cerulean badger
swift crag
#

You naturally bang into problems when you want to save, say, an entire list of numbers

#

and that naturally leads to more complex solutions, like JsonUtility and files

slender nymph
#

i sure do love when developers refuse to learn the right way to do things and bloat my registry with save data!

rich ice
#

well, its not like its going to be used on any big projects anyway. for a beginner, its probably fine

whole cliff
#

when i press a he goes right and when i press d he goes left

rich ice
#

!code

eternal falconBOT
whole cliff
#

is this normal?

slender nymph
# whole cliff

instead of solving your previous issue the correct way, you've gone and created a new axis that appears to be backwards

swift crag
#

the registry in windows, a plist on macOS, ...

naive pawn
polar acorn
# whole cliff

Show the config for your custom axis called horizontal

whole cliff
#

i just switched a and d

#

is that a valid fix?

naive pawn
#

did you make another axis

whole cliff
#

idk

slender nymph
#

the most valid fix would have been to spell Horizontal correctly instead of creating an entirely new axis

whole cliff
#

english is not mt first language ok😔

slender nymph
#

but you were already told the correct answer before you went and did that

naive pawn
#

im.. not sure what that has to do with anything

cosmic quail
naive pawn
echo copper
languid spire
#

what? The crylic alphabet has capital letters

swift crag
#

the remark is unrelated to capital letters

echo copper
cerulean badger
#

Just a dumb question: Can a player get prejudiced by hackers in a 100% offline game or it's alr?

cosmic quail
swift crag
#

if your game literally never communicates with another computer, then no, it can't possibly be a problem

cerulean badger
swift crag
#

we have seen examples of "offline" games being influenced by cheaters

naive pawn
#

i mean, it could be a problem with like, people not liking the behavior, but it's not going to have an actual effect on the game

swift crag
#

wasn't that a problem in GTAV?

#

I could be hallucinating

burnt vapor
#

Like, it's fast and easy, but even during development (assuming you switch in production) you just pollute your registry data with unneeded crap

#

Do it correct, write a simple file in a temporary folder or something. It's not hard to write

languid spire
#

tbf 99.99% of game players don't even know what a Windows Registry is

crimson pike
#

is there a simpler way to play a sound automatically when a particle system is triggered to play or do i have to get the audio source component and play it in script manually?

swift crag
#

some people found out when KSP2 decided to vomit huge amounts of data into PlayerPrefs

#

whoops

swift crag
#

if you're turning on the entire game object, then I suppose you could just put an audio source on the same object

crimson pike
#

script bcaDerp2

swift crag
#

okay, but what are you actually doing?

woeful bridge
#

public float speed = 50.5f;
private float defaultSpeed = speed;

crimson pike
woeful bridge
#

What is wrong with this??

rich ice
swift crag
woeful bridge
#

fucking why????

swift crag
#

why are you yelling

woeful bridge
#

I'm typing

rich ice
#

please, yell with caps

woeful bridge
#

IM YELLING NOW

#

lmao

rich ice
#

thank you

#

lol

swift crag
#

this is how the language is specified. I presume it's to prevent dependency cycles

crimson pike
#

its an evasion skill, the ship barrel rolls and the child particle system is just being called to play when it starts

#

its always active, but not set to looping or play on awake

queen adder
#

why is the gameobject field not showing up in inspector?

crimson pike
#

i guess i should use SetActive and play on awake then?

slender nymph
eternal falconBOT
burnt vapor
languid spire
swift crag
#

speed is a public field, so it's going to get serialized by Unity

#

this means it shows up in the inspector, and that you can set the value there

#

If you could initialize the defaultSpeed field with the speed field, this would happen before Unity applied the inspector values

#

so defaultSpeed would always be 50.5, even if you changed the number in the inspector

#

and yes: save defaultSpeed in the Awake method

burnt vapor
#

Oh, I removed the message because it will overwrite the inspector's value which I overlooked

slender nymph
#

also ideally it would be defaultSpeed that is serialized then speed would be assigned the value of defaultSpeed in Awake. the naming implies that it is the source of truth for what is default

naive pawn
#

idk maybe im tired but "defaultSpeed" sounds like what 50.5 is there lol

twin bolt
#

Question, I'm trying to set up a physical mic in a room of my game, and the best way I've found is by using a second audio listener, but the script is using the players audio listener and not the 2nd one for specifically the mic. What's the best way of doing this?

rich ice
#

are you using GetComponent or setting it in the inspector

whole cliff
#

Operator '<' cannot be applied to operands of type 'Vector3' and 'int'

#

how do i fix this?

rich ice
slender nymph
rich ice
#

but probably vector3.magnitude

twin bolt
#

I'll just find other help then

cerulean badger
#

there's a method that runs when the player's quitting the game instead of joining?

slender nymph
#

did you look at the docs?

slender nymph
#

there are beginner c# courses pinned in this channel. stop what you are doing and start by learning the basics.

whole cliff
#

im followinmg them rn

slender nymph
#

"what is an int" should not be a question you need to ask by the time you're coding in unity

cerulean badger
whole cliff
cerulean badger
whole cliff
#

are there any unity c# courses tho?

slender nymph
#

just learn the basics of c# on its own then learn how to use it in unity

languid spire
whole cliff
slender nymph
#

then you're going to fail.

cosmic quail
eternal falconBOT
#

:teacher: Unity Learn ↗

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

cerulean badger
whole cliff
whole cliff
#

but i just got a error and they dont tell u how to fix it

slender nymph
whole cliff
#

maybe if u tell me i remember

#

bc i made some kinda beginner working code

slender nymph
#

lol no. i'm blocking you now because you're just refusing to bother putting any effort into actually learning

whole cliff
#

alr

languid spire
cerulean badger
#

Supposing that I dont know what raycast is, how would I search for what I want to make that uses it?

cosmic quail
steep rose
cerulean badger
steep rose
steep rose
languid spire
whole cliff
#

Operator '<' cannot be applied to operands of type 'Vector3' and 'int'

#

why does it say this

#

i just dont understand'

slender nymph
#

hint: you've been told why 😉

steep rose
#

because that is not possible, use the magnitude of the vector or whatever box said above

slender nymph
steep rose
slender nymph
#

well they just gave -10 as the int they are likely using. they are trying to compare if something is less than that. the magnitude cannot be less than 0

cerulean badger
#

I've tried searching on google for a method that runs when the player quits the game and found OnApplicationQuit. Is that right?

steep rose
#

ah, my brain was not braining

cerulean badger
#

ok fair enough

languid spire
whole cliff
#

if(transform.position.x < -10)

#

is this good?

cerulean badger
polar acorn
cerulean badger
#

i think I've understood it by reading it like 10x

steep rose
#

what are you trying to do?

whole cliff
#

yeah but for some reason it kinda shakes at -10

whole cliff
languid spire
cerulean badger
#

i think so but im gonna test it to make sure

languid spire
#

good plan

polar acorn
whole cliff
#

yeah ill fix that tommorow ill sleep now

#

ty tho

cerulean badger
#

ok, it worked, nice

magic burrow
#

hey can one of you guys help me with this code
the rotation part just is not working

`using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerControler : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{

}

// Update is called once per frame
void Update()
{
    // basic controls
    transform.Translate(Vector3.forward * Time.deltaTime * 20 * Input.GetAxis("Vertical"));
    transform.Rotate(Vector3.up, Time.deltaTime * 20 * Input.GetAxis("Horizontal"));

    // keeping upright
    transform.rotation = Quaternion.identity;

    transform.rotation *= Quaternion.Euler(0, transform.rotation.y, 0);
}

}`

languid spire
#

this

 transform.Rotate(Vector3.up, Time.deltaTime * 20 * Input.GetAxis("Horizontal"));

        // keeping upright
        transform.rotation = Quaternion.identity;

        transform.rotation *= Quaternion.Euler(0, transform.rotation.y, 0);

is complete nonsense

magic burrow
#

damn i was told that was how to keep stuff upright

languid spire
#

there is so much wrong with it I don't even know where to begin

polar acorn
#

If you've just set transform.rotation to the identity quaternion, which I believe is 0, 0, 0, 1, then why do you want to rotate it by 0 degrees on the next line?

languid spire
#

even ignoring the fact he's using a quaternion.y as a euler.y

wintry quarry
polar acorn
#

Yeah, there's that, but in this case it's always 0 so even if you thought it was euler it still is doing nothing

eternal falconBOT
sick jay
#

in order to allow wall climbing in my game, im writing a raycast that checks for a climbable wall in range, but i need it to be able to still detect the wall is 'in range' if a player is looking slightly to the left or right of the wall. if i just make the raycast longer, it means the wall can be climbed from further away, which i dont want. how should i do this?

sick jay
wintry quarry
sick jay
wintry quarry
#

Why would you care about the other direction

#

you're not casting it in the other direction

#

you're casting it in the direction you're facing

sick jay
#

sorry i misunderstood. i thought it cast outward in all directions from the point of origin

wintry quarry
#

nope

crimson pike
#

does scriptually fading a 3d object's material cause any issues

#

yes i made up a word

wintry quarry
#

Imagine casting a ball in a straight line through the scene.

wintry quarry
crimson pike
#

i heard messing with materials at runtime can be problematic

wintry quarry
#

Why would that be problematic? It's a perfectly normal thing to do.

The problematic thing to do is to mess with material assets.

#

As long as it's an instanced material, you're fine

#

If you're doing myRenderer.material, it is instanced

crimson pike
#

shrugs i just picked it up, wouldn't know every best practice somehow

#

aite thanks

inland cobalt
#

(The video looks off centered due to it showing my left eye, but it's not when using a headset)

gloomy cosmos
#

I really need some advice, I'm getting increasingly frustrated trying to make a bullet system which isn't terrible (for a bullet hell game like Touhou). But it all ends up too unflexible, slow or boilerplate as hell. Like I'm currently trying an approach where I make scripts in C# (cause it's easier to get working in Unity, sure it requires recompilation but it could be acceptable), but even after many days of thinking and coding getting anything done is a horrible pain.

For example to test this system out I wanted to make a simple demo scene where the boss shoots out a circle of differently colored stars, each star deccelerates, stops, explodes into another circle of stars which move outwards and bounce off the screen edges once before eventually leaving the screen and despawning.
This is nothing special or even complicated for todays standard of bullet hell games, in a good engine I imagine that's like 30 lines of script at most, in my stupid boiletplate madness it's like 300 and still unfinished. How do people manage to get around these problems? I just don't get it.

Thanks for reading my ramblings and for any tips 🙏

This is a pastebin of the unfinished bullet behaviour... I think it becomes pretty clear what I'm talking about with "boiletplate": https://pastebin.com/YGxKadLi

cosmic dagger
#

have you tried using separate prefabs or SOs for each bullet type?

gloomy cosmos
gloomy cosmos
# cosmic dagger have you tried using separate prefabs or SOs for each bullet type?

Each bullet script has it's own SO, simply so I can assign which scripts to use in the inspector.
Also all bullets share the same prefab for better object pooling. Another small (but surprisngly good) optimization I use is batching, basically instead of having thousands of bullet prefabs with MonoBehaviours, I have a big list of BulletObject classes which are all updates together in a single monobehaviour, and the positions are simply saved to the game objects. This sounds like it shouldn't increase fps that much, but it's a big improvement.

cosmic dagger
cosmic dagger
# gloomy cosmos Well in my research they were recommended, and logically it seemed like a great ...

since this seems unflexible, slow, and/or boilerplatey, have you thought of a different approach?

i mentioned SOs because you can create them with different behaviour and plug the SOs into a variable on a Bullet script that reads or uses the data

i have the idea that each bullet would contain an SO of their desired behaviour and even spawn new bullets (per your example) that had different SOs for their behaviour . . .

gaunt sandal
#

!ask anyone here have experience with Vuforia?

ivory bobcat
#

!ask sounds like something you ought to ask the asset developer though (if it's an asset)

eternal falconBOT
ivory bobcat
#

(the last would be most appropriate if the others are exhausted)

gloomy cosmos
swift crag
gloomy cosmos
swift crag
#

a ScriptableObject is just a way to create your own kinds of Unity objects

#

(with no extra implications, unlike with, say, MonoBehaviour)

#
public void What : ScriptableObject {
  public void DestroyGame() {
    Application.Quit();
  }
}
cosmic dagger
# gloomy cosmos SOs mainly hold parameters though, no? How can you write custom code for them to...

e.g., a while back, i created a turret with a Reload, Track, and Seek MonoBehaviour. each have their own SO field for their behaviour

the Reload script can use various reloads like AutoReload SO, QuickReload SO, DelayReload SO, etc., to effect how it interacts when reloading

the Seek script can use a LOS (Line of Sight) SO, FOV (field of view) SO (uses an angle), or Radial SO (uses a radius) to easily change how the turret searches for a target . . .

swift crag
#

They are sometimes used as "bags of data", sure, but there's no reason they have to be

cosmic dagger
swift crag
#

(just like any other function written anywhere else!)

gloomy cosmos
#

oh you mean like that

swift crag
#

I tend to use [SerializeReference] instead of scriptable objects, because I don't like creating an entire asset instance for every unique configuration of something. But the idea is the same

gloomy cosmos
#

well thats pretty much waht my terrible system does, it just also allows each SO to create as many instances of the class as needed without having to instantiate SOs (as its kind of slow, and due to the specific nature of each one you cant really object pool super well)

swift crag
gloomy cosmos
woeful bridge
#

Ok question I saw a lot of tutorials just having all the items you can pick up as inactive game objects within the player then when you take it out it makes it active but that sounds kinda bad
Whats the sorta half decent solution like cloning everything?

cosmic dagger
swift crag
swift crag
gloomy cosmos
#

it uses scripting cause trying to parametrize this quickly turns into a nightmare as behaviours can get very specific and relatively complex

woeful bridge
#

Actually I guess the objects would have to exist so making inactive objects sounds like it would be the solution nvm then

cosmic dagger
gloomy cosmos
swift crag
#

if all you have is a list of BehaviorSOs, you don't know exactly what types of obejcts you're working with

gaunt sandal
#

🧵

cosmic dagger
swift crag
#

if all I know is that I have a field that holds a BehaviorSO, I don't know whether I actually have a FooSO or a BarSO

#

so I can't do anything that'd be specific to one of those two types

wintry kelp
#

Absolute beginner here and reached my first hurdle....All I want to do is rotate an object by 1 every frame. Just to see that I know what i'm doing.
I've created an empty game object, and applied to it a regular rigidbody, probably not necessary, but then I went and read the documentation on how to rotate using the Transform.rotate function.

I then, try adding a new component to my empty object, a script named "rotate".
All I add to the script under the update section is "Transform.rotate(0,1,0);"

I encountered an error, and think I may have possibly just installed something incorrectly.

Here's the script


public class Rotate : MonoBehaviour
{
   // Start is called once before the first execution of Update after the MonoBehaviour is created
   void Start()
   {
       
   }

   // Update is called once per frame
   void Update()
   {
       Transform.rotate(0,1,0);  
   }
}

And attached is the error.
What on earth have I missed?

swift crag
wintry kelp
swift crag
#

If so, you should fix that first.

#

!ide

eternal falconBOT
swift crag
#

It'll help you avoid making the typo that caused the error, too (:

cosmic dagger
cosmic dagger
#

configuring your IDE would easily help solve this issue as well . . .

swift crag
#

if this says "Miscellaneous Files", that means that Visual Studio doesn't understand that you have a project

woeful bridge
#

Ok heres another question
So when I did roblox I would like modualize everything like if I had a pick up script I'd make a single script with some modules that would just single handely handle everything
But so far in unity I feel like most things revolve around making one script then attaching it to like every pickupable am I missing something or.. is this just how things work?

#

Like can I just have one script not attached to anything handle every single pickupable object or am I really just suppose to have a script per item

sleek notch
polar acorn
woeful bridge
#

So what I'm doing is the correct way?

wintry kelp
#

🤦‍♂️

polar acorn
#

You should make a script that generically handles something and then put that script on everything that it should

woeful bridge
#

It just feels so wrong cuz its nothing how roblox is so its flustering me

swift crag
#

Components add features to objects

polar acorn
#

and then modify the public fields of it

woeful bridge
#

ok so I am doing it right

#

I'm making one generalize script and just slapping it onto objects that need it

wintry kelp
sleek notch
#

No problem 😄

polar acorn
#

that seems like a very quick way to making a frustrating developer experience

swift crag
woeful bridge
#

Well lua's power is dictionary tables so it wasn't that bad

swift crag
#

How would the game know what is actually a pickup-able item?

#

surely you need to attach the "pickup" feature to the item

woeful bridge
#

I would loop through every item thats a item in a single script and create a event

sleek notch
#

sounds weird

polar acorn
#

But how do you tell it which objects to loop through?

#

You'll have to specify it somewhere

woeful bridge
#

loop through every object with a tag item

swift crag
#

this almost sounds like an ECS

#

ish

polar acorn
#

So, if you want to see what an item does, you'd need to go somewhere else and just check the code for what that tag does?

#

Seems incredibly annoying

#

Compared to just "Click on object -> See pickup script"

swift crag
woeful bridge
#

so it look something like

for i, v in CollectionService.GetTagged("Item") do
   v.Prompt.Triggered:Connect(function()
    --Pickup function
  end)
end```
#

yeah in roblox its considered bad practice to put a script into every object that would need it lol

swift crag
#

that's so alien to me

swift crag
#

I guess that you know that you need to find the "item system" when you see the "Item" tag

#

which is very ECS-like

woeful bridge
#

its not that bad once you get use to it its how I started I found it enjoyable

#

Like handling guns in my roblox game is a single script and thats it

polar acorn
#

Imagine if you wanted to change something, you'd need to either remember where you put it or Ctrl+Shift+F for "Item" to find it, as opposed to just right click edit on the object you're currently looking at

woeful bridge
#

thats why unities way is so alien to me

woeful bridge
#

hold on

#

most scripts just look like this

#

and you store them in these places

#

but yeah you would have to find your script

swift crag
#

Roblox provides many more "things" than Unity does, too

woeful bridge
#

thats why unity is hurting my brain

#

I know it holds your hand a lot

swift crag
#

I actually may be learning a bit of Roblox soon

#

👻

woeful bridge
#

Ooo good luck going
Man roblox doesn't let me do this? Thats bullshit

#

lmao

grand snow
#

Unreal gives you a bit more to start with but most engines will be like this (apart from source engine which is basically HL2)

woeful bridge
#

I think roblox is pretty good learning if your getting into networking since roblox doesn't do everything for you + letting roblox do everything for you will end badly

#

I'm pretty good at networking cuz of roblox

#

mostly because roblox gives you so little recourses you kinda gotta optimize networking in every way you can lol

swift crag
gaunt sandal
#

cause i swear i've tried literally everything to make this stupid API work

woeful bridge
gaunt sandal
#

so i'm pretty sure i don't understand how to use it, but no tutorial online uses SIMULATOR mode

woeful bridge
#

ok i'm going back to coding lol

polar acorn
# woeful bridge lmao

I refuse to acknowledge lua as a programming language because their arrays start at 1

woeful bridge
#

I LOVE THATTTT

#

WHO COUNTS 0 1 2 3 4

gaunt sandal
steep rose
polar acorn
woeful bridge
#

I hate computers

#

I want to go back to writing on slabs of stone smh

gaunt sandal
#

welp, you're coding, so you gotta get used to it

swift crag
#

i don't think C# allows that at all

woeful bridge
#

nah roblox would probably be the craziest experience to anyone on unity like how unity is the craziest thing ever to me rn

polar acorn
grand snow
#

why do arrays start from 0? Pointer maths yay!!

polar acorn
#

I had to do some coding in lua and I literally wrote helper methods to access arrays with 0 indexing because that's the only way it makes sense

cosmic dagger
gaunt sandal
polar acorn
#

1-indexing is an abomination and should be destroyed

swift crag
#
  • 1, not - 1, silly
#

I don't really mind for (int i = 1; i <= myList.Length; ++i)

steep rose
#

who would even make arrays start at 1

gaunt sandal
#

complaining about 0-based indexing is like complaining about having to count in base-2

polar acorn
#

Yeah because 0-indexing actually does make sense. 1-indexing "because it's natural" is a lie, it's much more natural to use 0-indexing. So much math just works with 0-indexing

woeful bridge
#

idk in my brain it makes sense that the index and length are the same thing

#

plus I don't gotta do length-1

steep rose
#

you literally are taught in school
0, 1, 2, 3, 4, 5

swift crag
#

it's natural because you've done it for years, tbh

steep rose
#

0 being a number

woeful bridge
#

yes I did say length and index being the same not that 0 isn't real lol

gaunt sandal
#

which is probably where the justification comes from

swift crag
#

oh god we're on Natural Numbers discourse

plucky kernel
swift crag
#

sometimes 0

#

hey, is 0 prime

#

is it positive

gaunt sandal
#

no

#

no

swift crag
#

💥

woeful bridge
#

ok heres the real like answer to this discussion
your biased is probably based on the language you use the most lmao

steep rose
#

0 is included

woeful bridge
#

I used lua so I like arrays starting at 1 cuz I coded in lua for 3 years

gaunt sandal
#

er, it's the other way round

woeful bridge
#

but its ok you can make fun of me for letting a corporation take 70% of my games income lmao

plucky kernel
#

roblox cuts are insane

gaunt sandal
#

whole numbers include 0, natural don't, real numbers include all decimal numbers (irrational and rational)

woeful bridge
#

we should start arrays in decimal numbers...

gaunt sandal
woeful bridge
#

true

gaunt sandal
#

technically quantum indexing works like that (if you really boil it down)

swift crag
#

can't forget surreal numbers

ivory bobcat
woeful bridge
#

On the bright side though I did get a sucessful roblox game so my hope is I can reuse my community for a unity game I make to give it a better chance

polar acorn
#

Arrays should be indexed by vibe.
myArray[springtime] = 4

woeful bridge
#

Its really ass and I really don't wanna say it LMAO

#

I got like 5k group members and 1.3k discord users tho

plucky kernel
#

it's bad yet successful, interesting

woeful bridge
#

do be how roblox games work

plucky kernel
#

I'm still curious, you can DM me it if you want

woeful bridge
#

It was a portfolio piece then algo picked it up and it got popular

#

its not insanely popular I average like 300 ccu at my prime lol

plucky kernel
#

some good games average less :C

steep rose
normal token
#

I’m new

woeful bridge
#

I know I'm super happy about it I don't wanna sound ungrateful lol I make like 1k usdish a month from it

#

Just my ideas go beyond the capabilities of roblox so I'm trying out unity

steep rose
#

roblox pays you?

woeful bridge
#

yes 30% of my earnings

plucky kernel
#

barely unless it's CRAZY popular

woeful bridge
#

I mean i'm happy with 1k usd a month but yeah its barely anything compared to there cut

naive pawn
#

indexing at 0 and 1 both make sense for different contexts
in computing 0 tends to make more sense to not have a lot of off-by-one issues

for example the arithmetic/geometric sequence formulas are a_n = a_0 + nd/a_0r^n instead of a_n = a_1 + (n-1)d/a_1r^(n-1)

gaunt sandal
#

it turns off their Mesh Renderer when I hit play mode but i don't want it to do that. It feels weird that the API would expect the user to manually program the ImageTarget's MeshRenderer to forcefully stay visible, so i wanna double check that i'm not being stoopid

normal token
#

IM NEW

woeful bridge
#

I think roblox your more likely to get players than if you made a unity game cuz you have there egosystem and algorithum but also they do take 70% of your revenue so theres a trade off

#

hi new I'm niko

plucky kernel
#

a lot less people on roblox than the general gaming landscape, but both got their own costs (literally)

woeful bridge
steep rose
plucky kernel
woeful bridge
#

yeah thats what i'm saying I don't have to do the leg work or costs of advertising

#

the algorithum does it for me

#

thats the main difference

#

not saying its worth losing 70% of your income but generally I'd say getting players on roblox is probably easier than a steam game

#

especially if your new

plucky kernel
#

I agree

steep rose
#

Steam does push new games sometimes on the front page I believe

#

I could be wrong

woeful bridge
#

I mean fuck dude standing in like simulator have like 6k ccu rn

ivory bobcat
woeful bridge
#

ok rust and pokemon go have triple A devs

plucky kernel
#

for something Pokemon Go they had huge advertising and backing from a triple A company

woeful bridge
#

yeah lmao

#

I'm talking about like if your new or a single person

plucky kernel
#

for some other games, like Liar's Bar (although I'm not 100% sure), their success is from word of mouth and/or YouTubers playing it

steep rose
#

look at battlebit, that got insanely popular even with a single dev, so you can do it

polar acorn
#

You just have to make something good enough that people don't even notice that it's in Unity, like Hollow Knight or Cuphead

steep rose
#

ah yeah people will turn if they see the unity logo for some reason

woeful bridge
#

roblox has like 88 million users a day

plucky kernel
#

it seems really hard to get your fresh new game out there on other platforms in general. Roblox isn't a guarantee either, but seems a bit cheaper than off the platform.

steep rose
#

well probably because they see all of the bad games made with unity so thats probably why

woeful bridge
#

theres like a big part of the market there your forgetting about the markets steam can't get into
Mobile

#

roblox is mobile console and pc

plucky kernel
steep rose
#

That's because it was actually good and people were looking at it for a while so it kind of slid past that

plucky kernel
#

yeah

#

I was just saying something how it's not always the case

steep rose
#

Oh yeah for sure

ivory bobcat
polar acorn
#

Success is mostly a lottery, but it's a lottery you can only get a ticket for if you make a game worth playing in the first place

woeful bridge
#

Thats what I tell everyone game deving is a shit load of luck

#

theres a lot of ways to sway it in your favor but

#

my game got popular cuz some random ass other small game said this game is cool then it got me 20 ccu then the algo picked me up and brought me to 300

#

now i'm at 50 but

#

My game survived like 6 months so I'm happy for a first game

crimson pike
#

Get a streamer to notice it

woeful bridge
#

nah its near the end of its life spand i'm fine with that it wasn't suppose to be a popular game anyways

crimson pike
#

That’s how I got an old sc2 custom map to explode. TotalBiscuit found me

polar acorn
woeful bridge
#

I mean if it does get a 2nd resurgence thats cool but

ivory bobcat
woeful bridge
crimson pike
#

Yeah, but making a decent quality game that appeals to a lot of people for a solo project will make that luck factor less lucky

woeful bridge
#

yes you can sway it in your favor but theres still a lot of luck involved

crimson pike
#

Sure

woeful bridge
#

theres plenty of insanely fun games i've found that people just don't seem to notice

plucky kernel
woeful bridge
#

ye

#

like I said theres always luck involved

crimson pike
#

Thing is there’s a lot of bland games being pushed out there that might look ok but don’t quite grip anyone effective to promoting you

woeful bridge
#

which is why a lot of new game devs quit

#

they make a game it doesn't get players then quit

#

kinda gotta keep on that grind

#

also having roblox kinda like punch you over and over sucks too but YOU KNOWWWW gotta make sacrifices lmao

crimson pike
#

What’s this about Roblox ?

plucky kernel
#

the entire conversation

woeful bridge
#

yes

crimson pike
#

If anything else do it cuz you enjoy making games not for the glory

#

If something pops off then be grateful

woeful bridge
#

I need money to make cooler games

#

shit ain't free D:

#

but yeah i'm happy my game is popular

crimson pike
#

Or you just got to get really good at everything

woeful bridge
#

thats not typically a good idea

#

imo

crimson pike
#

And don’t aim higher than your manpower allows

ivory bobcat
#

I mean.. you're making the game because you enjoy doing so as a hobby or dream and not because you're wanting to make millions, riight!??

plucky kernel
#

isn't that's what niko is doing?

woeful bridge
#

I mean I'd like to make money so I can do this as a job one day so I can make things I like and other people like

crimson pike
#

It doesnt hurt to have some adequacy in all the components. If nothing else showing off a solid demo that showcases your broad skillset will attract collaborators

woeful bridge
#

but not really the ultimate goal no

#

trust me if I wanted money idk if game deving would be my first go too Waaahh

#

not with coding at least

plucky kernel
#

if you wanted money, you would've made a brainrot super popular simulator game on roblox

crimson pike
#

lol the industry is just over saturated it’s not worth it for like 99% of people

#

Get a job in boring dev. Web dev pays great and that could seed your project vision

#

It’s also easy as shit. Lot of free time cuz the work is too easy

manic kelp
#

Hey, is there a way to translate this shader to a shader graph?
I followed a tutorial on how to do a Stencil Shader for a Portal which i want to show on my Apple vision Pro, but the AVP does not support shader (the coded ones) so i need to translate this into a graph. Has anyoen done that before?

Shader "Custom/StarfieldStencilShader"
{
    Properties
    {
        [IntRange] _StencilID ("Stencil ID", Range(0, 255)) = 1
    }
    SubShader
    {
        Tags { 
            "RenderType"="Opaque"
            "Queue" = "Geometry"
            "RenderPipeline" = "UniversalPipeline"
        }
        
        Pass {
            Blend Zero One
            ZWrite Off

            Stencil 
            {
                ref [_StencilID]
                Comp Always
                Pass Replace
                Fail Keep
            }
        }
    }
}
woeful bridge
#

yes I happen to be in a place where I have a small community so games released by me have a starter following so I have a slightly easier time making a 2nd game than most people

crimson pike
#

You’re on your way then

woeful bridge
#

Mostly banking on the fact at least 5% of my discord will look into my game which would be a W lmao

crimson pike
#

Just don’t lapse and you’ll keep building more followers

ivory bobcat
manic kelp
#

Oh did not see the separate channel thanks xD

woeful bridge
#

swapping game engines is a big risk for me anyways so but I think in the long run I'll enjoy this more

crimson pike
#

I’m just working out a demo for now, maybe try and get a small team going

#

But not being able to pay for time is a setback.

#

Unless you need something that engine can do better idk why bother. Unity can do a more than enough for small time devs

woeful bridge
#

I'm coming from roblox to unity lol

#

and yes unity can do a ton more than roblox

#

and also not take 70% of my income

#

win win

crimson pike
#

Roblox idk anything about but it sounds like similar to sc2’s custom maps system

woeful bridge
#

wat

plucky kernel
#

what is SC2

woeful bridge
#

startcraft is nothing like roblox

#

lmao

crimson pike
#

Is anyone here older than 10? notlikethis

plucky kernel
#

I don't know every game based off of their abbreviation instantly

crimson pike
#

Yeah like I said idk anything about Roblox other than it has some creation engine

woeful bridge
#

the only platform that I would say is similar to roblox is what Fortnite is doing rn

#

which is why roblox gets away with everything cuz theres zero competition in how they do games other than fortnite recently

crimson pike
#

If it’s compartmentalized its own engine and exposed creation tools to the public then it’s just like sc2 mapping

#

There was some interesting games you could make with that editor.

woeful bridge
#

I mean.. thats like saying unity is like sc2 mapping lol

crimson pike
#

Unity’s a full engine

woeful bridge
#

so is roblox except for the fact I can't release games off of there platform

crimson pike
#

Sc2 has a creation engine

#

Then it’s a creation engine

woeful bridge
#

idk I think thats a really weird comparision

crimson pike
#

Sc2 custom maps worked the same way. You used the sc2 engine to make games that were only playable inside of itself

plucky kernel
#

ohhhhhhhhhhhh okay

polar acorn
woeful bridge
#

yeah ig

polar acorn
#

The only difference is Starcraft doesn't let you charge for games built in it

crimson pike
#

It wasn’t limited to maps for the standard sc2 game although you could do that too

#

Yeah, that is different

polar acorn
#

People have made entirely different genres within the SC2 engine. There are card games, roguelikes, RPGs, all sorts of things

plucky kernel
#

Halo Infinite???

polar acorn
#

You have to jump through hoops to do so, but the same for making anything other than a platformer in Roblox

woeful bridge
#

yeah roblox is trying to pivit into charging usd for games which is kinda weird

crimson pike
#

Idk if anyone remembered Bloodline champions but I made a custom map for it not dissimilar

plucky kernel
woeful bridge
crimson pike
#

Battle net was shit and the fact one potato pc in the lobby brought everyone down

woeful bridge
plucky kernel
#

okay, I guess they've changed that since the last time I tinkered with that system

crimson pike
#

Holy exploitation