#archived-code-advanced

1 messages Β· Page 11 of 1

winter obsidian
#

that is not a problem

#

oh okk thanks mate

chilly nymph
#

I didn't think it was that bad.

Don't be stupid with fonts. If you only need a single size and a single character set, configure it. If you can use Unity's UGUI instead of TextMesh Pro

I would have thought the GPU instancing of TMP would be better?

#

Fuk, I guess I'll swap them out.

#

Question since it sounds like you know webgl. I'm currently spinning up Tasks in order to wait for an character animation to finish. BUT it seems there's some issues when the browser enteres into a background process, it skips frames and the conditional to check when an anim is done is broken.

Would coroutines solve this?

torn basalt
#

Does anyone here have that one concept that they can't seem to memorize no matter how many times they have to implement it?

chilly nymph
#

I just join the channel.

#

This is native C# tasks.

jolly token
torn basalt
jolly token
chilly nymph
#
  internal virtual async Task Run(int round, CancellationTokenSource cancellationTokenSource, bool lastStep = false)
    {
        if (animator.GetCurrentAnimatorClipInfo(0)[0].clip.name == currentHit)
        {
            await IsAnimFinished(currentHit, cancellationTokenSource);
        }

...

    internal async Task IsAnimFinished(string name, CancellationTokenSource? cancellationTokenSource = null)
    {
        var isFinished = false;
        while (!isFinished)
        {
            if (cancellationTokenSource != null && cancellationTokenSource.IsCancellationRequested)
            {
                cancellationTokenSource.Token.ThrowIfCancellationRequested();
                return;
            }
            if (animator.GetCurrentAnimatorClipInfo(0)[0].clip.name == name && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 0.99f)
            {
                isFinished = true;
            }
            await Task.Yield();
        }
        return;
    }
torn basalt
chilly nymph
#

It works, it just breaks on background process.

#

Sometimes two anims will play when it should check if the isAnimFinished.

#

Should I refactor to coroutines you think?

#

How so?

#

check if current clip is current, is it in transition, and is it done.

#

I literally just implemented that.

#

πŸ˜„

#

After reading your forum.

#

It was 30 before.

#

What's the solution?

#

Just fire off a delegate?

#

Or listener?

#

In terms of the current code, you think I can do anything in terms of checking the normalized time?

#

Yeah, I assumed when a animation was completed it would stay at +1 for a normalized scale.

#

normalizedTime >= 0.99

#

GetCurrentAnimatorStateInfo\

#

Does the Animation lib contain a function to call when a fired animation is completed?

#

i think the best thing would be to check if unitask already has this implemented I don't really know what you mean by this.

#

Okay so implement that and what's the logic that handles the animation end?

#

"when all"?

#

States should have states, start, playing, end that's literally the point of states. πŸ˜„ unity hasn't made the best choices on how to consume that.

#

https://forum.unity.com/threads/how-to-wait-for-an-animation-to-finish.626842/

You have several options to achieve this.

1) Add an Animation Event to your last key frame.
See https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html

2) In Update you can continuously check if the animation has completed.
See AnimatorStateInfo

3) Start a coroutine that yields and waits for the animation to complete.

4) Use StateMachineBehaviour
#

And I'm doing #2

#

kk, thanks for your help!

#

Yeah, wish I knew this was an issue with browsers before I did it.

#

Browsers will drop frames more than desktop.

fringe apex
#

anyone know procedural world generation

chilly nymph
fringe apex
#

yes i would like to know how to use it with sum like the backrooms

chilly nymph
fringe apex
#

thank u

jolly token
#

Since decimal is integer representation, Is decimal calculation deterministic across platform?

novel plinth
#

my bet would be it's not guaranteed, due to Mono, but I may be straight up wrong here

jolly token
#

Also not sure about IL2CPP πŸ€”

#

Well but if it is basically integer calculation then it shouldn't be different, should it?
I failed to find any doc that says if it's deterministic or not.

novel plinth
#

my argument didn't put il2cpp into consideration, so yeah, just ignore that.. lately I've stayed away from aot entirely for my pet projects

jolly token
#

I wish I could too πŸ˜‡

obtuse arch
#

Hello,
This is a basic setup for char controller where lock on movement is 8 way and non locked on movement is forward run with 3 clips blended.
My question is setting animator.Play("blendTreeName") every frame incur a performance penalty or not ?
Call same method twice in Update() does cause jitter which proves that state is resetted.
But what about calling it every frame i.e. Each time Update is called ? Since animation(blendTree) doesnt restart it means animator would be maintaining it.
So not calling it every frame is efficient or is same as calling the Play every frame ?

Also,
This is a question about how animator will behave and not about how to handle states.Im just asking to know what happens in this specific scenario.

Thanks.

tribal pivot
obtuse arch
untold moth
obtuse arch
untold moth
obtuse arch
light falcon
#

Is there a way to generate image sprites of prefabs using a camera?
I have to generate a whole lot of item image sprites and want to do so in a custom environment with lighting and a background.

stuck onyx
#

runtime? or ...?

light falcon
#

editor, on demand

#

i have to avoid manually taking screenshots of every single item

stuck onyx
#

so you want to automatize it somehow?

light falcon
#

exactly.

#

would be great

stuck onyx
#

those objects are 3d and you want to get sprites out of them

light falcon
#

yep. But in a custom environment with lighting. I don't want to take the prefab preview image that unity provides

plucky laurel
#

yes you have all the apis to achieve that

stuck onyx
#

i use something for that let me check

plucky laurel
#

make a scene, place a camera in it, call EditorSceneManager apis to load scenes, call Render on the camera, save it with texture.EncodeToPNG

stuck onyx
#

here you have it all done already, what i did is to take this and modify it according my preferences

plucky laurel
light falcon
#

awesome, will take a look! thx

plucky laurel
#

just saying

stuck onyx
#

why?

#

curious

plucky laurel
#

you lose all flexibility that you will need later

#

and will have to rebake for every occurence of that image in the ui

#

different ui elements display same image, all may have different frames, ui designer can change the frames etc

#

it asks for problems

stuck onyx
#

ugh sorry im not familiar with that kinda stuff

light falcon
#

then leave front layer empty

stuck onyx
#

i have a question, im having problems with people in arabic countries with their calendar

#

something about converting utc to datetime fails

#

now... if i do this on the start of my game....

#
 CultureInfo.CurrentCulture = new CultureInfo("es-ES");
        CultureInfo.CurrentUICulture = new CultureInfo("es-ES");
#

am I forcing the culture to be es? es = Spain

plucky laurel
#

DateTime dt = DateTime.Parse(date, cultureinfo);

#

you have to pass that culture to the parse method for it to do anything

#

i think, for datetime

stuck onyx
#

wouldnt be easier to ignore the user's culture and use always our calendar?

#

(internally)

plucky laurel
#

no idea, not familiar with this issue

stuck onyx
#

but the example you sent i cannot use because first i need to create a datetime based on a unixTime

#

so... hmmm

#

okay i need to research more, ill see this datetimeparse thing

maiden turtle
#

need more context. a prefab can mean a thousand different things

#

an example maybe

#

or some code that repeated in your tests

#

I haven't played halo

#

and why is testing single scripts not enough? what do you expect to test in that test exactly?

#

I still don't understand what you expect to find. If you want to test interactions between components, test those separately. If you want to test if a prefab is configured correctly, check if the required components are in place

#

also, prefab variants are your friend if you forget to include certain components

#

you can make a prefab base with all required components, then make variants for your various monsters

#

if you change the base prefab, they'd all get the change

#

I feel like you just need normal integration tests here. Like a scene with a bunch of characters, a scenario that they should follow, and approximate results. Haven't done stuff like this, so can't say how hard it'd be to nail down the expected results reliably. It depends deeply on the particular problem

#

imo probably not worth the effort

unborn vortex
#

No advanced coding shenanigans, but advanced logic (to me it is at least haha):

New issue with that mf walljump feat acceleration implementation: my character always make the air-deceleration phase in the wrong direction after a walljump, no matter if I try to move to the opposite direction, or if I input nothing, or if I try to come back in the wall (which works well since I'm being pushed this way)

I'm pretty sure there's an easy logic modification that could fix that, I tried a lot of things between the MovementInput() and WallJump() methods, I'm pretty sure it's somewhere in between those methods, but nothing worked, if you have any idea, feel free!
https://paste.ofcode.org/uUjc6aFynTr9BLKyymJEmE

#

Oh I already use logs etc, I'm pretty much aware of what's happening, and when it's happening, I just can't figure out what logical change would fix this, that's above my logical skills, I went too deep haha but now I gotta end it

#

Not following a tutorial! (I wish haha)

#

One thing I just thought of: it shouldn't consider a direction change if we're going in the same direction the walljump propels us, because it's not a direction change, but my logic considers it is, so it triggers a deceleration phase

#

Now I gotta figure out how to not trigger changedDirection only in that situation haha, gonna be fun

#

Nop never, but I'll rework the entire shit with coroutines because for now it's a mess

#

But I want things to work properly before reworking it, cause if I rework something not working well, I won't know if I made a mistake during the rework or if it's just a mistake that was there before

unborn vortex
#

So, no idea to fix that logical issue?

obtuse arch
unborn vortex
#

|
What I would like to happen:

  • if I try to move in the same direction the walljump sent me
    ----> skip the deceleration phase and keep maxSpeed toward that direction

  • if I input nothing
    ----> deceleration phase while falling

  • if I try to move back toward the wall
    ----> deceleration phase in the direction the walljump sent me, then acceleration phase toward the wall

I'm aiming at the same behavior they have in Celeste (and basically the same behavior I have when in the air after a jump or falling off a platform, weird things only happen when walljumping)

humble leaf
#

@lost urchin Don't crosspost.

lost urchin
#

Apologies. I read the read me after posting.

#

I thought it might have been beyond the code beginner channel knowledge so I tried going to general.

#

@humble leaf if nobody is helpful in another chat, when is it appropriate to post in one of these chats?

humble leaf
#

You can post again sure, after a bit though. You can't jump around while your previous questions are still visible in other channels.

lost urchin
#

Would someone be able to assist me with building an assetBundle?

I followed the unity website's workflow but I keep getting namespace errors for classes that aren't referenced, in the assetBuilder script, in the Editor folder.

The project runs with zero issues outside of building an assetBundle so I do not believe there are any build errors in the code.

thin mesa
#

likely not an advanced issue. and you still haven't provided relevant details. are we supposed to just guess what the error(s) is? or what the relevant code is?

lost urchin
#

The namespace errors are for scriptable object classes that can't be found. Which they're not being referenced in the asset bundle.

Also I asked what other information you needed in the other chat and you didn't respond. So are you trying to actually help or just follow me around?

thin mesa
#

i did respond actually. i informed you that you should look at #854851968446365696 to see what you should provide when asking for help. but hey, if you just want to post vague questions and wonder why nobody is actually helping you, then you do you man. πŸ€·β€β™‚οΈ

lost urchin
#

I asked after that what other information I could provide for you.

You essentially just said "ask better questions" and then disappeared.

#

I hope this works.

using UnityEditor;
using System.IO;

public class AssetBundleCreator
{
    [MenuItem("Assets/Build AssetBundles")]
    static void BuildAllAssetBundles()
    {
        string assetBundleDirectory = "Assets/BundledAssets";
        if (!Directory.Exists(assetBundleDirectory))
        {
            Directory.CreateDirectory(assetBundleDirectory);
        }
        BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
    }
}```

Here's the code for the assetBundle script.
obtuse arch
lost urchin
#

I tried googling assetBundle browser but it looked like it was deprecated?

#

Maybe I didn't look hard enough

obtuse arch
# lost urchin

Code you pasted above is deprecated too, THats y I suggested using CompatibilityBuildPipeline

obtuse arch
# lost urchin

Ig this is an AssemblyDefinitionReference Issue. are there Any asmdef File ? IfSo Are they properly referenced ?

#

Also why not use Addressables ?

lost urchin
#

Why the heck is unity showing deprecated code on their wiki. xD

Where do we find the proper workflow for using assetBundles then?

I was currently trying to see what the differences were between Addressables and AssetBundles. For referencing sprites at runtime would Addressables be the proper thing to use?

jolly token
lost urchin
jolly token
#

Addressable is just organized way of packing/loading asset bundles

obtuse arch
#

I would suggest using Addressables as it provides proper GUI and other api support. Addressables are essentialy assetBundles. They are just wrapping API over AssetBundles

#

Then again I think you are looking at wrong direction, Can you elaborate on ref sprites at runtime ?

lost urchin
#

So it sounds like Addressables are the way to go as far as referencing sprites/etc at runtime?

#

So I can use my sprites at runtime no issues, save them via json but obviously you can't load them, so I need to reference the location of the sprite for when loading them.

obtuse arch
#

Why not Resources.Load ?

#

Are sprites generated At Runtime ?

#

I think not but just asking for clarity

obtuse arch
#

deployed with build *

lost urchin
#

No they're preset via scriptable objects currently. Saving them works but you can't load them since it's loading a reference to the sprite I believe.

The sprites are deployed with the build, which makes me lean towards addressables being the proper usage here?

#

It sounded like assetBundles were really more useful when hosted on a server

obtuse arch
obtuse arch
lost urchin
#

So the code creates an "Item" that has a sprite. I currently save the item, it's stats, it's image, etc in a json file. However when loading the item this doesn't work after a while due to serialization shenanigans.

I believe I need to instead save a reference to the sprite, since you cant save the sprite itself.

obtuse arch
#

Oh I see, Ig you were thrown at wrong track my friend

lost urchin
#

Then at runtime when loading I can find the reference and then go grab the sprite from the addressable / asset bundle

#

Part of my problem is I'm also trying to figure out what the best practice for this is.

#

It seemed like using assetBundles was the right way to go but that might have been wrong

obtuse arch
#

Lemme clear few things.
Addressable/Assetbundles and Resources are way to go when you want to manually handle Memory Management and/or deploy assets from web (not resources), live ops basically

lost urchin
#

Can you clarify what you mean by deploying assets from the web?

#

Nothing is being hosted ideally

obtuse arch
#

Have you played Asphalt or any such mobile game ?

lost urchin
#

Yeah, that's the racing game right? I've played a bunch of mobile games.

obtuse arch
#

At first you have to download some 200mb/900 mb of game but rest of the content is downloaded as you progress further

#

you simply click download the game takes care of rest of it ?

lost urchin
#

Is this what you would be seeing when using assetBundles?

obtuse arch
#

For That Addressables are used (Im gonna refer to them as Addressable now for sake of simplicity as assetBundle is dep)

obtuse arch
#

you offer content in game and not as a build (apk) update

#

For persisting sprite its a simple solution and I can guide you in DM(if okay) since its a bit simple and we would be hogging the chat

lost urchin
#

So if I wanted all the sprites to be in the build and be able to access them at runtime what would be the best way to do that then?

#

Yeah that's fine with me!

#

Thank you!

obtuse arch
obtuse arch
unborn vortex
obtuse arch
#

Um lets jay jump starts at 0,0,0 and height is 5 the vertical point vector would be 0,5,0 and the character would move towards that point.

unborn vortex
#

Tbh I'm pretty sure there's something easy to change, just one thing in the states or something like that, in the logic

#

But after trying various things that almost worked, there's always one thing wrong, I can't find the right line to change

obtuse arch
#

Unless the code is clean this is bound to be an issue. Anyways best of luck, Since im unable to make out much from it .

wooden wind
#

Hey, Does anyone know how to store a byte array ( from texture) into a file? It is for offline access to the textures of the google place api photos that I stored in an new array.

wooden wind
#

I tried that i already and my file was empty then but is it also possible with more images I want more then one image stored in my file

upbeat path
#

probably your byte[] was empty invalid if the file was empty.
Storing more than one image in a single file is a lot more complex

wooden wind
#

Do you know how i can store more images in a file or is it better to split them in one file each image?

hot gale
#

What's the URP equivalent of "OnPreCull" ?

unborn vortex
#

I don't want to use an asset, I want to learn making it myself, but I'll try to find that youtuber, thanks πŸ™‚

stuck onyx
#

I didnt know this, very interesting

maiden turtle
lost urchin
#

Thanks for the reply @undone coral πŸ™‚

obtuse arch
#

It most definately works.
Secondly,
This is something I wouldnt do as scaling up there will be tons of paramaeters and tree will grow in terms of complexity as there will be state transitions and to control those there will be parameters which again would have to be controlled by script by some sort of state mechanism implementation (basically animator hell scenario).
In my case as game is heavily dependent of physics controlled animations

Im handling them differently altogether but then again this is outta scope of my question as i have stated earlier.

Thanks for info though, much appreciated:)

#

imo it would be better the db would be scriptable, that way each instance could provide categorization by default, Or all sprites can be hogged into one no problem. And that would also discard the scene dependency or extra ddol management incase there is multiscene setup.

eager plume
#

Hey guys, I'm trying to manually implement some functions that the Unity API has, rn I'm working on converting the mouse position from screen space into world space coordinates, my question is, is there a way to explicitly calculate the view matrix of the main camera?

#

This is my current idea, but I have no clue if this is correct or not (I'm assuming it's not because the resulting position is crooked)

obtuse arch
#

You will need to take Screen details (usually found in Screen class) into account , As different resolutions will mess up ur algo.
Apart from that cant suggest much.

jolly token
eager plume
eager plume
#

And this would be my plan for actually making the transformations

#

Ignore the comments, I was trying some stuff prior

eager plume
upper smelt
#

Hello my friends. I'm trying to install Unity on Ubuntu 20.04 with terminal. Because I wanna build project via CLI. I've noticed this is more difficult since Unity Hub came to Linux. Do any of you do this? (CI/CD)

(I couldn't find another channel to send this message)

jolly token
#

Using pre installed docker image may be better for your mental health

upper smelt
#

game-ci seems very neat

jolly token
#

game-ci with github actions has been worked well for my project

upper smelt
#

Github actions are a good idea but I feel like it only makes sense for public repos. Because even if there is a cache, the build times are not short.

#

For private repos, there is a high probability that I will be stuck on the monthly minute limit. Unless using upper github plan

#

Thanks for help, i'll look game-ci

hybrid lark
#

@jolly token did you come up with any other ideas for my issues by chance?

#

I tried creating a new gameobject, set it as the parent of the meshrender transform, scaled it, then set it back to it's original parent

#

that didn't do anything

#

I need to find some sort of 3d transform guru

jolly token
hybrid lark
#

that's fair

#

hmm, you would basically need the whole project then

jolly token
#

Yeah for this issue anyone you find to get help would be, I think

hybrid lark
#

Alright, I cleaned it up a bit, I had some resources outside of the project, you want me to send it to you?

jolly token
#

--
Question: If I add hidden component to a prefab itself on runtime, will prefab variants affected by it?
If so, would there be a way to prevent it?

Context: I'm trying to do PoC of caching inner component references as serialized field on prefab root, as when you initialize it they will be converted into reference to instance. So you only query components once for prefab, and don't have to query components for instances.

tribal pivot
#

I dont really understand your context

#

What do you mean query components for instances?

jolly token
tribal pivot
#

Oh yes, you should definitely not use getcomponentsinchildren, just serialize a reference to your component.

#

I'm not sure if you are aware, this is code-advanced, but when you instantiate that prefab, the serialized reference of the instance is updated. It does not point to the prefab, it points to the instance.

jolly token
#

It's for DI plugin, so it is gotta be somewhat generic. Serializing direct reference is not working here

tribal pivot
#

I dont think i understand, but i wish you the best of luck with it!

jolly token
#

Thank you πŸ‘

wooden wind
#

Does anyone know how to do this in Unity? I searched a lot, tried a lot but don't know how? The planes you see are based on prefabs that spawns automatically when the api is called and these planes display images.

wooden wind
# chilly nymph Ii's just a carousel.

It the first time I made a imagecarousel and I have already displayed the planes front-faced but this specific orientation I dont know how to make it do you have any tips that can help me with this?

#

I cant use packages

chilly nymph
#

2 sided shader?

#

Or just 2 planes?

wooden wind
#

planes with textures of images

maiden turtle
#

kinda looks a bit like spherical projection

#

I don't know if cameras support custom projection

#

I might be wrong

maiden turtle
#

but these don't look euclidean to me

wooden wind
#

It is a weird shape and front faced is easier to do these shapes have a lot of other directions

wooden wind
#

but ty for the help

maiden turtle
#

you're welcome

proven phoenix
#

has somebdoy here ever integrated the discord rich presence into a unity game?

#

im having a problem where when I set my activity, the game and the unity editor crash

tribal pivot
#

I have

flat gull
#

Guys, for a really complex platformer, do you guys think its better to make a class for playerphysics (for the main movement) and a state machine system (for other many abilities) and they will work together, or is it better to put everything in a state machine system ?

flat gull
#

Ah yes, locomotion will be a better word. So i guess it does make sense to make it that way

#

Anyway thanks for the Quora kind of answer

compact ingot
# flat gull Guys, for a really complex platformer, do you guys think its better to make a cl...

an architecture for character controllers that always makes sense is to split the physics bits (collisions, step smoothing, platform recognition) into a "motor" component, that is driven by a "controller" (implementing abilities like jump, walk, run etc), which gets its inputs set from an "input (player)" or "brain (ai)" component, control flows only in one direction from brain -> controller -> motor

#

you would then potentially implement an FSM inside that controller to handle various states the controller can be in and split that controller into multiple components when it gets complicated

quartz stratus
# wooden wind Does anyone know how to do this in Unity? I searched a lot, tried a lot but don'...

Seconding @undone coral 's suggestion. I would just position/rotate these prefab instances statically, then just store the position/rotation Vectors on some class or on SOs. Then just drop DOTween into the project and ship it lol. Totally understand the desire to want to do this dynamically, but sometimes it's nice to remember that it's not strictly necessary. The end user won't know if you calculated these positions/rotations from scratch or used static values.

#

And of course, you could use the static version as a prototype/tool to help discover how to generate this carousel in a more clever fashion.

jolly token
#

This I’m pretty sure you can
I’ve learn that by mistake 😌

#

Though Awake would not likely to be called

#

Yes, but I’d still need to prevent it if loading order matters. For example: Loading from AssetBundles. I’m just thinking comparing cached instance id and invalidate cache if different

Also it is likely to have little different behaviour when running from Editor vs build. So I gotta make some test case. I’ll let you know if interested πŸ™‚

flat gull
#

Mainly 3d

jolly token
#

Yeah unless original prefab is in another asset bundle. Which would be asset bundle dependency and they can be loaded different timing

#

That is also convincing. πŸ€” I’d test that out too

silk sable
#

Is there a way to cancel async functions the same way we do coroutines?

compact ingot
silk sable
jolly token
#

recent Unity is .NET standard 2.1 compatible btw

silk sable
#

wdym it doesnt exist

#

There are things way over it

jolly token
silk sable
jolly token
#

Just like how windows 9 doesn't exist πŸ™‚

silk sable
#

this is where I read it

fresh salmon
#

Probably meant Framework 4.x

silk sable
#

On the accepted answer

jolly token
#

That's .NET framework 4

silk sable
#

Well the dude used the wrong terminology

#

fuck me

jolly token
#

Their versioning is confusing to be fair lol

cerulean sky
#

hello !

#

i'm looking at the unity reference for Mesh and I see that, for instance, the vertices property has set & get overloaded with another function. this leaves me a bit clueless as to what calling the [] operator of vertices would do... like myMesh.vertices[0] = Vector3.up; does it simply get piped into the void, or does it modify something? edit: ah wait, does it do like a whole copy of the array and then modifies the copy? i feel like that's what's happening

#

I have a part of my code where I need to modify precise points of a mesh the fastest possible, and to avoid modifying my vertex array & then calling Set Vertices() for the whole array i thought i'd be smart and only set manually the Vertices that had changed (cause it's not so much, usually only a dozen or so on a 65336 long vertex array)

#
                if (isFastUpdate) {
                    for (int y = zGridMin; y < zGridMax; y++) {
                         for (int x = xGridMin; x < xGridMax; x++) {

                            int modifiedVertex = HardEdges ? (x + y * Width) * 4 : x + y * VerticesW;

                            mapMesh.vertices[modifiedVertex] = vertices[modifiedVertex];
                            mapMesh.uv[modifiedVertex] = uv[modifiedVertex];
                            mapMesh.uv2[modifiedVertex] = uv2[modifiedVertex];
                            mapMesh.uv3[modifiedVertex] = uv3[modifiedVertex];
                            mapMesh.uv4[modifiedVertex] = uv4[modifiedVertex];
                            mapMesh.normals[modifiedVertex] = verticesNormals[modifiedVertex];
                        }
                    }
                }
#

Except this does nothing as far as I can tell

#

What is the normal, fastest way to set the value of one precise vertex/normal/uv/etc in the array, by index ?

chilly nymph
cerulean sky
#

sorry I'm not sure I understood what you meant

#

How do I modify and update only the specific vertex? πŸ™‚

chilly nymph
#

When you modify a vertex you store it's index[n] just add that to a stack, then when you update you just iterate through your stack.

#

It's basic IsDirty architecture. Does that work for you?

cerulean sky
#

I'm already doint that, now the issue is replicating the change to the mesh

#

Without setting all the vertices including the ones that have not changed πŸ™‚

cerulean sky
#

ah, that's what I was looking for! Thanks a bunch !

#

I might come back with more questions 😁

sly grove
#

Every time you call the property it creates a fresh copy

#

Just pull the copy out once, do all your modifications, then assign it back

cerulean sky
#

Yea that's the thing I'm trying to avoid, cause I'm only modifying ~100 vertices on a 65k long array

#

So i'll guess i'll switch to low level API then :>

sly grove
#

Catheis thing then yes

tardy lance
#

how can i switch the default layer with script?

cursive dew
#

anyone know how to make ready up thingy for multiplayer

cursive dew
#

whats that

sly grove
#

and just have the server keep track of which players are ready

sly grove
# cursive dew whats that

You should go follow the tutorials for whatever networking framework you are working with. They will be covered

cursive dew
#

ok ill look

tardy lance
#

How can i change layer for Gameobject childs too?

jolly token
sly grove
#

or be cute and use GetComponentInChildren<Transform>()

tardy lance
sly grove
#

Do it for only the ones in the list

#

in any case

#

doing all this stuff in Update is kind of horrible

tardy lance
#

ok, but how?

chilly nymph
#

You also shouldn't be iterating and finding them.

tardy lance
#

right

sly grove
chilly nymph
#

Only a student should know it's targets not an upper manager.

sly grove
chilly nymph
#
 if (cancellationTokenSource.IsCancellationRequested)
                {
                    return default;
                }```
#

I should be putting all UI's that do heavy operations on separate canvases, correct?

chilly nymph
#

You'd think Unity would have done that by now.

jolly token
#

They never do things for you 😒

gray pulsar
chilly nymph
urban sequoia
rapid latch
#

I am trying to create an android plugin in Java that unity can read and execute its functions.
I am able to achieve basic function call execution but now I am working with listeners and it is causing issues.
The listeners are not attached since they are attached in onCreate method of Android on the View which relies on Activity class.

How do I Invoke this Activity using unity?

obtuse arch
chilly nymph
#

Anyone know if there's any support to auto listen for speech using webgl? Or would I just roll my own?

chilly nymph
#

Also is there support for JWT or would I need to roll my own too?

compact egret
#

i need lep with animations

#

help

somber swift
compact egret
#

help*

tribal pivot
compact egret
#

i have four animations

#

one is going to door

#

second staying in front of door

#

third going back

#

an fourth is idle

#

when its on idle it stays still but

#

there is a fps controller

#

and it shouldnt be still

#

how do i do that

tribal pivot
#

Yeah thats neither one post, nor coherent, nor what you tried, nor in the right channel.

compact egret
#

where should i post it

maiden turtle
#

What should I do to have a render texture whose resolution follows the screen size? Currently, I'm recreating it if the resolution changes. Should I just fix it at some max resolution and only write to and read from a part of it? Should I manually tweak it to powers of two? What's the best way to detect resolution changes? Currently, I'm checking canvas.renderingDisplaySize in update. Is there some sort of resizable texture, or a built-in abstraction for such a texture?

#

Also, it seems I can't reuse a shared material with a reference to this render texture for this purpose. When the resolution changes and I destroy the previous render texture, my UI elements don't get an update sort of signal that the material's render texture has changed

#

They just start outputting nothing to the screen at that point

tribal pivot
#

afaik some ways of making rt you can pass in -1 to get the screen size

#

Hm but i cant find it atm

maiden turtle
#

but the textures can never be resized?

tribal pivot
#

Indeed, you have to make new ones

maiden turtle
#

welp, that's a bummer

warped violet
#

what about tiling

#

and offset

maiden turtle
#

what about it?

warped violet
#

you could use it to zoom in/out

tribal pivot
#

Please no

maiden turtle
#

Then it would become blurry

#

I'd guess

warped violet
#

so you put ultra quality right away

maiden turtle
#

or bad

warped violet
#

then it wont get

turbid tinsel
#

Is there any actual difference between doing

using System;
namespace Something
{
  [Serializable]
  class A
  {
  }
}```
and
```cs
namespace Something
{
  using System;

  [Serializable]
  class A
  {
  }
}```
?
warped violet
#

if works then no

maiden turtle
shadow seal
maiden turtle
#

example

#
// It's in the same file
using Thing;
namespace A
{
    using Stuff;
    // both thing and stuff visible here
}

namespace B
{
    // only Thing visible here
}
turbid tinsel
#

ahhhh, I see!
But if I have 1 namespace per file, then it doesn't matter, yes?

maiden turtle
#

yes

turbid tinsel
#

I see

#

thank you

maiden turtle
#

you're welcome

maiden turtle
# turbid tinsel ahhhh, I see! But if I have 1 namespace per file, then it doesn't matter, yes?

Also, nested usings are good for aliases. Assume you want Dictionary<string, int> be called Map. You could do

using Map = System.Collections.Generic.Dictionary<string, int>;
namespace A
{
    // use Map
}

But if you do it inside the namespace, you don't have to fully qualify it, it sees the imports then

using System.Collections.Generic;
namespace A
{
    using Map = Dictionary<string, int>;
}

I use this one all the time

#

using static would see the imports if used within namespace too

sonic widget
#

I dont know if abstract class questions belong here but ill try here as well . :

public abstract class Enemy : MonoBehaviour
{

void Update()
{

        Debug.Log("A MESSAGE");

}

}

public class Walker : Enemy
{
}

I attached walker to an object and I expect the console to show message, but nothing happens

craggy spear
jolly token
#

Question: In my plugin I use reflection to set propety value. If platform is AOT the property setters can be stripped out. I want walkaround other than [Preserve] or link.xml. Would it safe to set value of backing field of the property?

#

Right? I think they don’t put any constraints for backing field

exotic gull
#

Ok, so I need a way through scripting to save the bounds of a Collider object in a JSON file. With mesh/box colliders, is there a method that gets the coordinates of the vertices? And for sphere/cylinder either coord equivalents or some alternate method? I just need to get these properties from it in a format that can be interpreted by non-Unity code

chilly nymph
#

That's not optimized.

#

This is for webgl

#

But any changes to the canvas dirtiest all the elements.

#

Unity suggest handling multiple canvases.

#

It's how elements are dirtied on change.

#

Do you know how uis are rendered?

jolly token
#

One more question: Would there be a way to know if the property had setter but stripped out?

chilly nymph
#

I can agree on that. But uis are agnostic to engines.

jolly token
#

But getter only properties would have that too

chilly nymph
#

It's the same with update issues on iOS
it's how ui is updated.

#

I disagree.

#

You don't lose anything having 2 canvases for heavy operations.

#

You don't lose anything. That's like saying I lose arcetecture design because I have 2 game objects.

#

The same can literally be said for your argument.

#

Hearthstone uses a in game engine.

#

In house *

craggy spear
#

Hearthstone is Unity

chilly nymph
#

I'll check it out.

#

Read the first suggestion.

#

Do you know how ui is rendered?

#

All elements need to be updated on any change.

#

They are flagged as dirty.

#

Great so you know the hit you take when you dirty one element.

#

I don't see why you are saying that's bad advice.

#

Performance isn't relevant to you? πŸ˜„

#

Well it does. You're trying to make your own argument and telling others it's bad advice.

#

Why?

#

You're saying it's bad advice.

craggy spear
#

by saying incorrect things πŸ˜„

chilly nymph
#

By telling me out of context advice that I know to be true is bad advice? Weird.

#

Then what's your argument?

#

"I don't think it's relevant so it's bad advice"

#

Sorry but I think this is pretty bad advice.

#

The profiler isn't a deployed product.

#

Yes it all depends on the use case. So why are you talking about certain games.

#

If your code is not abstracted enough to handle multiple canvases I have some bad news for you.

#

I'm a SE of 10 years mate. You're arguing semantics and your own arguments to try and prove that having multiple canvases is bad advice when we can all agree it's not.

#

Tweeting is now bad to you?

#

Tweening *

#

Changes made to a canvas dirty all elements. Those elements need to be updated.

#

It's simple design.

jolly token
#

IMO premature optimization can result in some hassle 😌 I think that’s what doc trying to say

jolly token
#

You don’t really have to optimize something until you profile it

chilly nymph
jolly token
#

You don’t have to use profiler, I meant profile in general

chilly nymph
#

The animation issue I was having was in fact solved by seperating the canvases.

chilly nymph
#

The approach was to seperate the canvases to reduce the loss of frames.

jolly token
#

Yeah for my own use I would do that but I want the my asset to work out-of-box for other users.
Imma just support getter-only property as well by using backing field.

chilly nymph
#

It's not a perfect solution but optimizing frame rates is never a bad thing.

jolly token
#

The thing is I can’t also do this because I’d have to preserve user’s assembly 😌

#

It sounds horrible already lol

humble leaf
#

@deft tangle Don't crosspost

exotic gull
exotic gull
#

This just gives the bounding box though, not necessarily the coords of the vertex of say, the mesh in a mesh collider

#

Right?

chilly nymph
#

Do you have convex collides?

#

The bb should be sufficient. If that's not then you get the mesh verts.

#

Your json would be:

Gopos, vertlocalpos[]

exotic gull
#

So BB doesn't just give a box, it gives the convex shape of the object?

#

Because I'm just imagining the smallest possible rectangular prism the object fits inside, if that makes sense (just max X - min X, etc.)

chilly nymph
#

That is how a bb works.

#

It's the bounds.

#

A bb should work for you 99% of the time.

#

And how colliders shpuld be anyways.

sly grove
sly grove
#

there are no vertices for sphere/capsule colliders

#

those overlap calculations are done purely with geometry

#

probably the same for boxes

exotic gull
#

aight

#

So just BB + Pos + Rot + Scale should give a pretty good estimation for most objects

sly grove
#

bounding boxes are quite crude

#

and the scale/rot will already have affected the AABB

#

making larger or smaller

#

depends on your game design really

#

and the shapes of things

chilly nymph
#

I'm assuming this is 2D?

exotic gull
#

3D

#

Should have specified

sly grove
#

Doubt it since mesh colliders were mentioned

chilly nymph
#

Depending on what exactly you need I would personally just use the mesh data.

chilly nymph
#

How is it consumed?

exotic gull
#

Working on a project where I try to play a game w/ TensorFlow

#

So I'm trying to give the relevant game info to the program

#

It doesn't need textures to be able to navigate the level, but it for sure needs to know where colliders are

#

So it can interact and "see" the world

chilly nymph
#

Can you construct the object as a primitive on TF?

#

If you can, you can just pass it ID and POS, rot.

upbeat path
#

but a fun one

exotic gull
#

Hey, I have a semester!

#

The game is Human: Fall Flat if you're curious

#

Hey, I got the game knowledge

#

Oh 1000%

upbeat path
exotic gull
#

Not officially, but the community has modding tools that I'm familiar with

#

(I mean, it's just BepInEx but still)

exotic gull
# upbeat path And, that qualifies you for what exactly?

If I'm gonna choose a game to play with AI, why would I choose one I know nothing about? Playing doesn't give me knowledge of the inner-workings of the game, but it gives the project purpose and I have a good mental idea of what I want the AI to do

#

Plus, why not?

#

Mainly the learning experience and documentation of the project. If it doesn't work I'm still good

upbeat path
exotic gull
#

Yeah IK

#

I mean, I guess working with the ML & interfacing it with programs. Just building some experience and problem solving, etc. while I'm at it. This isn't something serious and I'm well aware there are more practical choices. But it's something I've been wanting to try for a while and the teacher's on board so why not give it my best shot?

chilly nymph
#

You both are acting like he needs to pay for his crimes.

exotic gull
#

Reenforcment learning specifically

chilly nymph
#

The dude wants to fuck with ml

#

Hff uses unity.

#

He's making a mod.

exotic gull
#

Yeah, I'm fine working with Unity

#

To some degree, sure

#

Not the main one

chilly nymph
#

You haven't even asked his knowledge...

exotic gull
#

I'm already like 3 weeks into this. The multi-page proposal is done and graded

#

I've already gotten a list of all relevant components & filtered through them

chilly nymph
#

Use that, 99% of the time that's handling the colliders

exotic gull
#

Imma be real, this is 100% a "fuck it, it sounds fun" project

chilly nymph
#

Anything different write something that would visually display them.

#

Telling someone 5 min after talking to them that their project is worthless is shit advice.

#

But you do you doctor.

exotic gull
#

I mean, once I get the data from the components, the rest of the project is gonna hardly involve Unity

#

And I'd say I'm 60% there

#

Of the Unity part

chilly nymph
#

"You don't know what you're doing. Scrap the project"

upbeat path
exotic gull
#

dnSpy's worked well enough for viewing source so far

chilly nymph
exotic gull
#

I'm fully aware that I'm oversimplifying, and that this project is a massive reach. This project will most likely result in an AI that can't make it through levels, probably.

upbeat path
upbeat path
chilly nymph
exotic gull
#

Β―_(ツ)_/Β―

chilly nymph
#

That's not his main focus.

#

He just needs the data.

#

Dude just pull any data.

exotic gull
#

They're very complicated

#

Especially at this scale

#

Ah

#

I'll look through it

upbeat path
# chilly nymph Ain't you the loser who didn't know about player prefs?

Use the Player Prefs Plus from SteveSmith.Software on your next project. Find this utility tool & more on the Unity Asset Store.

Use the Player Prefs Lite from SteveSmith.Software on your next project. Find this utility tool & more on the Unity Asset Store.

chilly nymph
#

You sure you know what you're doing?

upbeat path
chilly nymph
#

Like that's your wheelhouse right?

upbeat path
exotic gull
#

Aight, well Imma get back to the project

chilly nymph
upbeat path
exotic gull
#

Current plan is to give the AI the collider data + 1 or 2 other properties of all objects within a set radius of the player + the positions of the checkpoints, loading zones, fall boundries, etc.

#

That much is true

chilly nymph
upbeat path
chilly nymph
#

There's no mention of player prefs because you didn't know you could use player prefs in webgl.

upbeat path
chilly nymph
#

"What's the process with Webgl and serialization."

upbeat path
exotic gull
#

Here's the current idea more fully laid out (subject to change, also still oversimplified):

1) When a new level is loaded, gather list of relevant objects in level (done)
2) Use the "NetIdentity" component (which is on every object whose state/position can change over the course of the level) to determine which objects I need to recheck every few frames
3) Use sockets to transmit the data to python
4) ML (massive oversimplification)
5) Pynput for KBm control back to game```
chilly nymph
#

Shame.

exotic gull
#

I have 18

upbeat path
chilly nymph
exotic gull
#

probably Β―_(ツ)_/Β―

#

Possibly Keras

#

HS

upbeat path
maiden turtle
#

yeah, this'll do nicely

chilly nymph
exotic gull
#

fair

upbeat path
chilly nymph
maiden turtle
#

I collect a list of graphics and SetMaterialDirty them

#

but it might not be necessary with the buffer cleanup you showed

chilly nymph
upbeat path
chilly nymph
#

The best part is all the work you did on your player prefs plugin, you still didn't know you could use it for webgl then called me a moron. Isn't that funny?

#

Maybe, and just maybe. You might be the issue here.

#

Things like "And that qualifies you for what exactly" isn't normal behavior when speaking to someone.

upbeat path
chilly nymph
#

Dude you are clueless.

#

Not only do you give shit advice, you need to learn how to actually interact with others.

upbeat path
chilly nymph
jolly token
#

I think whatever happened between you guys can be resolved in private πŸ™‚

chilly nymph
upbeat path
chilly nymph
#

But anyways, I'm done.

timber flame
#

What is the best/ most common formula to simulate bending cards when shuffling cards?

   float y = v.vertex.y+exp(0.8*max(v.vertex.z,0)-1); 
   const float4 vertex=float4(v.vertex.x,y,v.vertex.z,v.vertex.w);

It is kinda OK but the length of the card changes when bending

#

It is better but not accurate, :/

  float c = 0.4;
                float d = exp(c*max(v.vertex.z,0)-1); 
                float y = v.vertex.y + d; 
                const float4 vertex=float4(v.vertex.x,y,-5+((v.vertex.z+5))/(1+c*c),v.vertex.w);

Z depends on multiplier (c)

obtuse arch
#

When the motion of animation itself is parameter controlled/procedural.

Or for optimisation purpose too.Animations baked to Vertex shaders (complex process)are pretty cheap to execute compared to thousands of Animator components

timber flame
#

Unfortunately, I do not have it but you are right, it is better to install it and animate in the blender/maya

surreal vessel
#

how would you guys do some nested action that can fail?
right now i use a chain of bool methods, like TryUseItem(), which calls TryIncrementStat(). if any returns false then that propagates back up and nothing happens.
However i thought that maybe i might want some dialog to pop up or something where ill want more than true or false. I suppose try catch blocks would work with custom errors?

#

eg the user wants to drink a potion but the stat is already maxed out

#

but this is sort of nested with other mechanisms

#

yep

#

yea you could say that

#

rpg more like

#

basically

#

now its like user double clicks potion in inventory > TryUse() on the potion item > TryIncrementStat() on player stats

#

all of those are bool and if any is false nothing happens

#

of course i could make something happen but thats not the point here

#

just thinking more about architecture of this

#

the thing here is that its sometimes nested maybe liek 3 times and so checking from the top level isnt a good idea

#

i have it working but was wondering if theres a better way with something liek try catch, for examples:
instead of
if (TryUseItem()) Destroy(gameObject);
use something like

try
{
  Destroy(gameObject);
}
catch(StatsMaxException)
{
  Debug.Log("stats too high");
}
catch(OtherException)
{
  //couldnt do this with the first way
  Debug.Log("other error");
}
#

why would it?

#

i always do a check first

compact ingot
#

Because it makes code flow non obvious

surreal vessel
#

on all levels

compact ingot
surreal vessel
#

something like return codes comes to mind and exceptions seem like a way to do that (never really worked with them before though)

#

but say you want to use an item, to use it you have to be near something, and that something has to have some internal state and decide if you can use that item

#

well each class manages its own state

#

thats the point

#

but checking is nested

#

yeah but that would just be rewriting TryUseItem() into if (CanUseItem()) UseItem()

#

yeah but then you want a way to do different things depending on the error

#

for example show a dialog for one thing, or just do nothing for other errors

#

yeah i suppose

#

well right now its try to use the item, if thats not possible then do nothing but i want to eventually make something that tells the user why

#

yeah but its not always a toast or dialog

#

sometimes it might do different actions

#

well actions as in maybe just do nothing

#

dialog

#

well dialog with options

#

how come

#

maybe its a confirmation

#

and by other game mechanics that should decide themselves

#

aware of that

#

yeah

jolly token
#

If you put steps as data in spreadsheet it forces to normalize your data, shows flow, and everyone will be happy πŸ˜„

surreal vessel
#

yeah i see what you mean with that

#

strong types are why i despise using javascript

#

and yep rust is a great language and solves that issue quite well

#

so i suppose you can do what i need with async await rather than exceptions

jolly token
#

Exceptions are exceptions, regular code flow should not utilize them as goto

chilly nymph
#

Is this a process that needs to be waiting? Or can you have listeners?

maiden turtle
#

I've been thinking about how to do this, especially without the use of exceptions. Currently, I have just a stateful event based system for selecting. Using tasks looks nice on the api level, but would probably be very complicated on the inside

zenith ginkgo
#

Unitask again i see

jolly token
#

About hidden component on base prefab I ran some test cases
And yes it seems like prefab variant is just an editor concept
Even in editor the loaded variant doesn't seem to get affected when modifying parent.

#

Though it seems like writing to asset when you are not using 'DontSave' flags

brave widget
#

Hey guys, so I have a bit of a maths dilemer that I'm not sure how to properly solve

So I'm creating a Lego building system, using a grid system

As you can see from the image, I'm not exactly sure how to solve it where if the stud amount along either the x or z axis is odd (or even) then correctly place them accordingly

My origin is directly in the center of each object btw ( not changable as of yet )

So far I'm getting the closest point on the grid and setting its position to that ( also based on mouse movement as its drag )

        if (Physics.Raycast(ray, out hit)) {
          // Make sure hit isn't the same the brick being dragged

          // Get the closest grid position to the mouse position
          Vector3 closestPosition = Grid.instance.GetClosestPoint(hit.point);
          // Update the GameObject's position

          // Create an offset based on the grids tile size
          float x = closestPosition.x;
          float z = closestPosition.z;
          
          // If the Bricks studX or studZ is even then add half the tile size to the offset
          if (studsX % 2 == 0) {
            x -= Grid.instance.tileSize / 2;
          }

          if (studsZ % 2 == 0) {
            z -= Grid.instance.tileSize / 2;
          }
          
          // Round the Y value of hit.point to the nearest 0.16 multiplier
          float y = (Mathf.Round(hit.point.y / 0.048f) * 0.048f) - 0.048f;

          transform.position = new Vector3(x, y * brickHeight, z);
        }

It works fine, but as soon as you rotate it, it goes off again

Not sure how I'd perfectly get it to place like Lego

Even, Even works
Odd - Odd Works

Even - Odd doesn't work, not placed properly

How could I get it so trhat based on the orientation it fixes iteself accordingly if the x or z studs are odd or even?

#

Here's a gif of it working and how Odd - even doesn't work

#

Found a solution that works :)

#

just gotta inverse the x and z studs values based on rotation so my module (%) works on rotation

hollow stream
#

Is there a function I can use that can set the max distance a GameObject can move from NavMeshAgent?

regal olive
glass anvil
hollow stream
#

I guess that's a bad example, but the max distance is relative to the GameObject

hollow stream
#
    private Vector2 MaxDistancePath( NavMeshPath path ){

        float distance = 0;
        Vector2 previousVect = Vector2.zero;

        for ( int i = 0; i < path.corners.Length - 1; i++ ) {
            distance += ( path.corners[i] - path.corners[i + 1] ).magnitude;
            if( distance >= distanceLeft ){
                previousVect = path.corners[i];
                break;
            }
        }

        return new Vector2( previousVect.x + (distance - distanceLeft) , previousVect.y + (distance - distanceLeft) );
    }

I have the magnitude with this function to get the max distance, but now having a hard time trying to apply it

#

I want to avoid recalculating a new path if possible from the new max distance point

#

I figured maybe somewhere there was already a function that might exist, but I can't seem to find anything in the documentation

glass anvil
hollow stream
glass anvil
#

I'm looking to recalculate a new path showing point of origin to the max distance
Yes- so do that by creating a new path providing the origin and max distance

#

are you having trouble getting an origin, the max distance, creating a new path I'm not sure what the issue is

hollow stream
#

Ah, sorry... having an issue getting the Vector2 of the max distance point

glass anvil
#

try using Vector2.MoveTowards to interpolate between corners/destination

icy aspen
#

Hey guys, I was wondering if there's a way to only update the leaderboard's value from PlayFab if the new score is higher than the previous one? This is my code, as you can see now i update the leaderboard every time the player gets a new score (this code works). But I want it so that it only updates when time is higher than the previous one already stored inside playfab.

split folio
icy aspen
split folio
#

by downloading it from playfab and store the data received a static script

icy aspen
#

ok

#

thanks you

#

thank*

#

@split folio It worked!

torn basalt
#

Whos alive in here

cedar cape
#

not me, im totally dead

torn basalt
#

lol

snow flint
#

hi guys, wondering if you could provide some guidance here, im trying a new approach
var actionDataTesting = DataLoaderSystem.Instance.actionDataTest; foreach (var actionDescription in actionDataTesting) { var action = gameObject.AddComponent<BaseAction>(); action.actionName = "testig new apprach123"; _baseActions.Add(action); action.Setup(actionDescription); }

actionDescription is a bunch of data read in from json

the problem is... i really need to be creating ... MoveAction or TargetAction... id love to be able to just make Action and then fed data.. but I'm sure how to do that...
ive pretty much made everything else work.

My MoveAction type has all this logic for move actions and i dont want to put everything in Action but without reflection im not sure how to instantiate the action class, pass it data and make it a move action

i hope this makes sense

#

i mean i could just read a value from the json and create that particular type of action but wondering if there is another way..

brisk pasture
#

so to make sure i understand what you want, your issue is constructing the action because you have multiple types you want to construct based on the actionDescription?

torn basalt
#

Hey I am trying to have a set of verts that make up a face on a cube match the Z position of my VR controller. I have it raycasting out to the face and collecting the verts that make up that face. I then pull the trigger and those verts position should snap to the z position of my controller. Since both of these (controller and vert) are in local space, I converted them to world since the controller only reports back Vector3.zero and tried to assign the z of the controlle rto the z of the converted vetex position and then assign that to the vert but it snaps and reacts at a very far ooff z distance in fron of me

#

Any tips on how to match the position of 2 local space objects?

woeful kraken
#

Not sure if this is the right space but here goes: does anybody else have issues with Prefabs and nested Prefabs deserializing fields when you switch branches in a GitHub environment? We're talking silly things - a dictionary doesn't have it's info anymore. A list loses track of things. A nested Prefabs forgets a child object or two. Etc.

Any hints at what causes this?

split folio
#

Should only store executables there, nothing that might change, cause that'll reset

#

Idk if thats your issue but yeah

woeful kraken
split folio
#

No, im saying its not a place to save data

brisk pasture
#

think he is referring to like Github actions and CI stuff

split folio
#

🀷

woeful kraken
#

Okay so I'm storing Unity source code. CS scripts. Etc. We switch branches in project, and on rare occasion, after switching to a branch some devs notice their Prefabs aren't right in the editor. Others will be fine though. Sometimes switching back and forth will fix it. Sometimes not.

And you're saying this is because GitHub isn't a good place to store unity projects or C# scripts, etc?

split folio
#

No, i just understood your question a little wrong first

woeful kraken
#

Ahh

#

Well have you experienced the issue?

split folio
#

Cant say i have, never used github with unity

#

Only ever used github when i made discord bots, saved info in json files and other files
They got reset every single day

woeful kraken
#

I see

split folio
#

When we then searched on the issue, we found out github cleans up data frequently, resetting files to their original

woeful kraken
#

Not convinced this is the case for us. Some of the objects going haywire are not Prefabs we actively touched. But we do touch the scenes they are in.

#

And in our case, we do not rename the objects or scenes

#

It's just sometimes we switch branches and a prefab seems to lose track of it's fields. It's usually more complex types, like a dictionary or list.

brisk pasture
#

what type of serialization are you using?

#

if using something like git or hg you will want TEXT and visible meta files

woeful kraken
brisk pasture
#

no the format

woeful kraken
#

And forced text

#

And yes visible meta files.

brisk pasture
#

meta files need to be versioned, and the library folder must be ignored

#

i can confirm Git and Github are fine for unity projects have been using a mix of p4 and git for unity projects for a decade

#

it kinda sounds like unhandled merge conflicts

woeful kraken
#

Library folder is ignored.
Not sure on Meta versioning.

This partially describes the behavior. Sometimes we switch to FOO, then back to BAR and the issue corrects itseld

brisk pasture
#

yeah if meta's are not versioned pretty much everything breaks

#

almost all asset references will be lost or buggered up between branch switches and clones

woeful kraken
#

Meta's. Pardon

brisk pasture
#

what does your gitignore look like?

#

this is a good base to start with for one

#

than you can add anything else you need for your IDE or things are are for your project that need to be ignored

woeful kraken
#

I checked gitignore. It is not ignoring .meta files

brisk pasture
#

are changes to meta files being committed with the files they are for

woeful kraken
#

In theory, yea

#

Though I don't sit behind Every dev

brisk pasture
#

other things i could be is branch switching with uncommited changes, and how conflicts are being dealt with

woeful kraken
#

We do need to improve yaml merging yes.

brisk pasture
#

yeah assets do not merge well

#

even with the yamlmergetool

woeful kraken
#

We don't have a user friendly method of handling prefab conflicts

brisk pasture
#

that is the main downside of git for unity, is art assets, scenes and prefabs do not merge well, and Git even with lfs does not provide a good way to do checkouts compared to say perforce

woeful kraken
#

So basicall, we need to babysit meta file ida

brisk pasture
#

but with a bit of team communication that problem can be avoided

#

to me it very much sounds like meta's are not be committed when they should

#

thus some peoples systems are regenerating them with different guids

#

once a asset is made, you want it to have the same guid forever

tender flume
woeful kraken
#

I see

brisk pasture
#

if you diff branches, the 2nd line of the meta contains the guid

#

also everyone should be on the exact same unity version

#

and if you upgrade you upgrade as a team

woeful kraken
#

I am a dev. But it's my first time in the flavor of env. Usually i leveraged plastic scm and it didn't suck balls.

We are technically using BitBucket and this is my first time seeing this weird horseshit

#

Aka, I've never had to babysit meta files so hard

#

100%. Ten years vet here. Didn't have this issue in last two jobs

#

PlasticSCM took care of this for us. Mercurial never had this issue either

brisk pasture
#

been working in unity using hg or git for 10 years or longer as well, with no issues like this

woeful kraken
#

Ooh we're getting snooty. Ain't you cute

tired creek
#

Hi, I am looking for a good resource describing, ideally with code examples, how to perform operations such as splitting an edge of a polygon mesh. I'm trying to implement certain operations on my own.

brisk pasture
#

worked in inhouse engines before unity, that had a similar system to meta files too without issues back in the svn days

#

no point getting angry at the system, its learn how it works, or go back to what was used before

woeful kraken
#

Don't know what to tell you. I've worked in a few places including Facebook Reality Labs. This is the first place that has this issue.

#

Well you see I don't actually know thus the question

#

Again so snooty. Ain't you cute

brisk pasture
#

either way the current way this is going is not productive for anyone

#

but i find it weird you claim its a bug or issue with a system, that is literally one of the most used VCS systems in the world for all kinds of dev

woeful kraken
brisk pasture
#

bitbucket is just a host

woeful kraken
#

Concur. And it shouldn't be acting strangely

brisk pasture
#

Git is the system, and you actually can set it up to use the yamlmergetool contained in your unity install

woeful kraken
#

And I've shared Unity indie projects with ol' fashioned GitHub for gamejams and again never had to babysit meta files before

brisk pasture
#

find a branch where switching to it casues issues

woeful kraken
brisk pasture
#

git diff otherbranch

woeful kraken
#

I'll try that. It doesn't happen 100% of the time

#

Thank you for your help @brisk pasture

woeful kraken
#

Interesting. I've found a great article on how to read YAML files, @brisk pasture , and I'm noticing there are fields tagged as a "Library" asset when theyre actually inside the Asset folder. Any thoughts on whether this could be an issue?

undone coral
#

i don't think your project is in any serious kind of jeopardy. merging scene or prefab YAML, even with the yaml merge tool, is pretty janky

woeful kraken
undone coral
#

i don't know if that's the issue though

#

okay i think the meta files and ids and such are probably a red herring

#

hg and git only keep track of files, not folders. so that metafile mystery that you are seeing is a folder becoming empty

#

when switching branches

#

but unity adds .meta files for folders

#

so when you swithc a branch to a folder that is now newly empty

#

the directory will not be there but the metafile will

#

because someone accidentally checked in an empty directory

#

it isn't going to hurt anything

#

if someone checked in stuff without its .meta files

#

that's bad, that will mess things up

woeful kraken
#

I suppose it could be. Except that one of my culprit Prefabs is in a folder that doesn't get touched; doesn't go empty; it just seems to lose its serialized dictionary inputs.

undone coral
#

well

woeful kraken
undone coral
#

a Dictionary<?,?> isn't saved

#

so i think the dictionary is also a red herring

woeful kraken
#

Could be I don't knke

#

Know*

#

Like Ive said before I've worked two other studios before this; they had their problems; this just wasn't one of them.

jolly token
woeful kraken
#

In our gitignore I mean

undone coral
woeful kraken
undone coral
#

okay

jolly token
#

We are talking about actually serialized field right?

undone coral
#

serialization is an oft misused word. let's just stick to, does something you do in the inspector save into a file? a Dictionary type won't appear in the inspector by default

#

if you have a special fake dictionary

#

like one that uses an array of tuples, and then gets turned into a dictionary at runtime

#

i mean, maybe that's miswritten

jolly token
#

Also you are using text meta file too right?

woeful kraken
undone coral
#

show the code i mean

jolly token
#

Umm that’s still not serialized

#

If it’s a type Unity doesn’t support

undone coral
#

i mean it should be obvious that it's not in the inspector, but i think it does appear in the inspector

brisk pasture
#

dictionary out of the box does not support unity serialization

undone coral
#

because you're saying you're changing a dictionary

#

so it's some kind of custom thing

#

that may be buggy

woeful kraken
undone coral
#

it's probably a custom thing

#

and maybe it has a bug

#

but i'll trust that you're editing a dictionary in the inspector

#

it's not super important

woeful kraken
#

Could be. Let me check

#

Yeah we are editing in inspector

jolly token
#

Sounds like custom yeah

undone coral
#

it's not likely you have an issue with .gitignore

#

if your people just went and got the one off GitHub, it's fine

brisk pasture
#

yeah so that is its own logic, and custom serialization logic that could have a bug

woeful kraken
#

We have a dictionary type. Its serialized.

Then a script for prefab. In that script is a serializedField that marks a dictionary type.

And then it populayes in inspector

undone coral
#

is there a .gitattributes file in the repo?

woeful kraken
undone coral
#

and what are some of the things that are added, probably to the bottom?

#

are they weird?

jolly token
#

Do you have submodule?

wind gyro
#

Hey there, had a question about analytics. Not sure if this is the place to ask. We're working on a deck-builder of sorts, and we'd like to start tracking decks (or more specifically, cards in decks) that do well. I'm struggling a bit with how the analytics events would look, and how we could query it. Would you send an event with a json object with all the card indices? If so, how would you go about querying that with the SQL Data Explorer? Was wondering if anyone here had any experience with anything similar

undone coral
#

SQL Data Explorer?
hmm

undone coral
wind gyro
#

Ye, I figured it might be. Was looking at maybe exporting to our own database, and doing operations from there

undone coral
#

the only intellectually honest answer is you track an exact deck (a sorted list of cards associated with the date of issue of those collections)

#

there's no good way to say how similar two decks are to each other, because for strategy card games, the difference of a single card can have a big impact on win rates

#

hsreplay curates the rules for the archetypes

#

so it may say that everything in this archetype must have an X and a Y, with at most Z cards different

#

having enough copies of the exact deck in your data requires players, of which you have 0

#

so you'd have no way to test this

wind gyro
#

Ye, win rate is a difficult one to track. I noticed hearthstone and what not usually track typical meta decks, and base it on that

#

But for example tracking picked cards would already prove useful in some capacity

#

But I think for that I may have to export that data and write something myself to visualize it, or use Tableau or something

undone coral
#

picked cards in a draft format?

undone coral
#

it's very cantankerous

#

it's better to just code in the exact questions you actually want to ask

#

tracking picked cards isn't 100%, what is a specific question?

wind gyro
#

Ye, I figured. I did notice that there is no longer a raw data export for Unity, and that it is now done via Snowflake. I'm not very familiar with that. Is it easy to transfer to an SQL database of our own?

#

As for the data we're trying to collect. This is for a client, and they atm just wanna know which cards are in games that are won. I also noted that I think that data is very much based on the whole deck, but thats what I was tasked with

#

(as a headsup, I dont have a background in data analysis and am pretty new at it)

undone coral
#

is this for a conventional card game, a play to earn card game, or another kind of cryptocurrency related card game?

#

or like an educational game or something

#

or it's not multiplayer

#

just so i understand

#

i think if unity provides a snowflake integration, you can simply pay and use snowflake

#

it's a little cantakerous though for something that might have 10 players or whatever

#

it really depends on the game

wind gyro
#

It's a multiplayer game. It's not quite a card game, it's a turn-based strategy game, but with an army with units (I found the deck comparison a bit easier for my usecase)

undone coral
#

okay

wind gyro
#

Atm, its a conventional game, but I do believe they intend on adding an NFT element

undone coral
#

okay

#

so for this specific question

#

you can do something like

void OnGameEnd() {
 foreach (var tuple in 
         army.SelectMany(army => army.units
               .Select(unit => (unit, isWinner: army.playerId == Game.instance.winningPlayerId))) {
  var (unit, isWinner) = tuple;
  Event({
    action: "Unit Used In Army",
    label: unit.unitId,
    value: isWinner ? 1 : 0
  });
  Event({
    action: "Unit Used In Army",
    label: unit.rarity,
    value: isWinner ? 1 : 0
  });
  Event({
    action: "Unit Used In Army",
    label: unit.cost,
    value: isWinner ? 1 : 0
  });
  ...
 }
}
#

does this make sense?

#

this could be something like GAv4

#

you are just measuring directly a numerator of the number of wins for a unity and a denominator for the number of decks

wind gyro
#

For reporting, that makes sense. I'm not familiar with GAv4 though, thats google analytics?

undone coral
#

yes

#

reporting...

#

you won't be doing anything in SQL

#

it's too complicated for you

#

it's unnecessary

#

you can query GA data in bigquery

wind gyro
#

I'm not very familiar with GA data / bigquery, but I can do my research into that

#

So you would suggest stepping away from the Unity Analytics?

undone coral
#

the backend you use doesn't really matter

#

does the game already record events?

wind gyro
#

Some very basic ones atm

undone coral
#

well

#

it would take an expert to determine if you can answer the question about unit winrates with the data they already have

#

it will be obvious from the events in Unity Analytics that are actually recorded

#

an expert doesn't need the raw data to determine that

wind gyro
#

Hm, just to continue on that a bit @undone coral. I think I may have gotten lost a bit with what events you're sending through in that script you linked. There you send an event per unit, at the end of a game?

#

Or do you send through an array of the units?

undone coral
#

hmm

wind gyro
#

Because I can't figure out how to read an array in the unity analytics dashboard

undone coral
#

you can't

#

i think part of this is learning the limitations of conventional analytics systems

#

and knowing how to work around them

wind gyro
#

And if its 1 per unit, won't rate limit become an issue?

undone coral
#

hmm

#

no

#

so it sounds like you have a remit to collect data, and also to try to do something with pre-existing data

#

your game can't write to a SQL database, that's a nonstarter

#

i think this is all stuff you can figure out though

wind gyro
#

Hm, well, I've got some things to get started. I appreciate the help!

wind gyro
undone coral
#

that you might be able to analyze

#

and that you're also supposed to modify their unity client of the game

#

do you have access to the server backend source code?

wind gyro
#

Ah, none of the unit data yet. They've just got some analytics for matches played and what not

#

I've got access to the whole project

undone coral
#

it is probably easier to do this from the server code.

wind gyro
#

To clarify, I'm not supposed to be the one to analyze the data, I'm supposed to implement it, and make it accessible

undone coral
#

usually that means sending data to a pre-existing web service

#

do people actually play the game?

#

is there even enough data?

wind gyro
#

Imo, there isn't, but they wanna have it ready for the launch

undone coral
#

okay

#

i author a multiplayer card game

#

it is really hard

wind gyro
#

Ye, I'm picking up on that

undone coral
#

the most valuable thing you can do is tell these people to greatly reduce the scope of what they are trying to do

#

marvel snap took 4 years to develop

#

for a team of 20 people

#

almost all of whom had experience making hearthstone

#

so it's tough, what your people are asking for

#

there's nothing i can do to help you translate their questions into the particular service you want to use. you'd need to have the full picture - how to record the data, and then how you're going to use the tool to turn the data into the measurement you want

#

@wind gyro do you know how long they've been working on this game? have you been able to actually play it (does it have a bot)?

wind gyro
#

A couple of months. I have played it yes

#

I'm discussing the scope with the team now

undone coral
#

is it using an asset?

wind gyro
#

It's build from scratch

undone coral
#

it's an autochess?

#

or turnbased*

#

so it's Advance Wars?

#

i think if the units have any spell-like behavior, it's going to take them 2-4 years to make this game

#

and if it doesn't, you should expect at least 1 year

#

do you have to start the server on your local machine in order to play the game?

wind gyro
#

We've got server orchestration

undone coral
#

hmm

#

so these are two armies, but there are numbers written on the units

#

and there are like 5 unit types, and that's it?

#

or do they have text, like a card game?

undone coral
#

another perspective is, if there's no text on the units, or there are very fixed unit types

#

your analytics can be a lot simpler

#

they already have unity analytics events? do they have any opinions on how this should be done?

#

@wind gyro i'm trying to get to the bottom of what makes sense here

#

people who can build a working multiplayer game in "a couple of months" don't need someone to invent analytics for them. they'd have the experience to know to write all the analytics events at the end of the development process, not the beginning

#

they would have already seen all of this before, and have a lot of opinions on how it should be done

#

the alternative explanation is that there is a long journey ahead still, and the game appears to be in better shape than it is, and most of your questions should be architectural

#

you can certainly record to your own database from the game's backend

#

analytics services are expensive because of all the UI and standard flows they provide

#

you can certainly connect Tableau to a SQL database the backend accesses, Tableau is very expensive

#

when I last used it it was $10,000/mo

#

you would have to know a lot about that stuff

#

it really depends what this data will be used for too. for a "numbers" game you don't need analytics to do balancing

#

for a "spells on the units" game it really depends

#

if it's for blogs or whatever

#

it's different

#

you also have to do all this while this codebase is actively being worked on

#

which is why i say analytics are done at the end

#

maybe they should pay me to do it

wind gyro
#

I thank you for your info, but I do have to run now. I've taken some notes on the scope, and will discuss it during our next meeting with them

#

There's also some nuances that are hard to get across in chat, it's not quite as you describe

#

I may have been unclear in some cases

#

But I know where to go from here, thank you!

hexed meteor
#

Any tips on creating a system for enemies to Navigate/Pathfind on a moving platform?

#

Unities navmesh does not support this sadly

wintry dragon
#

What's worse in general: More vertices or more materials?
With greedy meshing, I'll have to add materials to my mesh to allow for tiling on specific areas of the mesh.

sly grove
#

each material == a draw call

hexed meteor
#

in SRP more materials is not a problem, they are batched if they share the same shader

sly grove
#

if the material supports batching

hexed meteor
#

yeah, given that

compact ingot
#

Batching just means making few out of many based on similarity. So it’s still vertices over materials

brave widget
#

Hey guys, I'm wondering what the best method is on having a detection system that allows it so as soon as 1 brick touches another it instantly goes to the top of it

I've tried colliders but to no avail as it seems a bit buggy an dnot sure how to make it go back to its original Y before hand

Atm I'm just shooting a ray when I drag and if it hits an object it goes to the correct Y posirion, but you can see how it quickly fails

#

Any ideas?

jolly token
#

I think he is using raycast currently

sly grove
brave widget
# compact ingot Use volumetric casts

I thought that too but where?

I was thinking the corners of each brick but then what if I had a

3x3 brick going to a 1x3 brick, it would only owk if i touch the corner first, what if I go in the middle

sly grove
#

you could actually also just use a pure 3D grid structure for this

#

with no physics at all

jolly token
#

It'd be best if you do it with calculation, since your game is tiled environment

brave widget
brave widget
#

ty guys super helpful

sly grove
#

yes you can basically just check if any of the blocks in your new block would touch any spots that are occupied already

#

and keep trying that as you move it upwards

compact ingot
sly grove
#

@brave widget volumetric cast == overlapbox

brave widget
#

OverlapBox?

#

ahh

#

isee

#

gotchu