#archived-code-advanced
1 messages Β· Page 11 of 1
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?
Does anyone here have that one concept that they can't seem to memorize no matter how many times they have to implement it?
I just look into my previous implementation π
It feels so dirty tho lol
It does evolve every time I implement lol
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;
}
I have been nursing an audio framework for some time now. It started out as one of my "hard to remembers". Now its a full thing
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.
anyone know procedural world generation
Pretty vague.
yes i would like to know how to use it with sum like the backrooms
thank u
Since decimal is integer representation, Is decimal calculation deterministic across platform?
my bet would be it's not guaranteed, due to Mono, but I may be straight up wrong here
well, at least it used to, appearently it's been fixed since https://stackoverflow.com/questions/39345100/are-net-decimal-type-computations-deterministic
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.
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
I wish I could too π
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.
What does the profiler show you?
I havent profiled tbh, So thats a mystery till I get my hands dirty.
Calling it every frame should cause the animation to restart every frame. It shouldn't cause performance issues.
Well thats the twist, it doesnt restart. It continues to animate
Incase i have called Animation.Play(βblendtreeStateβ) twice in an Update() it will restart
But if it is written only once, The animation doesnt restart on the next frame (next update cycle call)
Which is what intrigues me.
Might want to add some debugs in your code to see if it even gets called in this case. Animator.Play bypasses any possible transitions setup you have, so it should just play.
I have tested it, thats y i was confused
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.
runtime? or ...?
so you want to automatize it somehow?
those objects are 3d and you want to get sprites out of them
yep. But in a custom environment with lighting. I don't want to take the prefab preview image that unity provides
yes you have all the apis to achieve that
i use something for that let me check
Generate Icons for PrefabsΒ is a simple unity 5 editor extension to make icons painless for hundreds of 3D prefabs.To understand the global principle, feel free to look at theΒ presentation video.You can grab this Unity3D...
make a scene, place a camera in it, call EditorSceneManager apis to load scenes, call Render on the camera, save it with texture.EncodeToPNG
here you have it all done already, what i did is to take this and modify it according my preferences
baking the front layer into the texture itself is a bad idea
awesome, will take a look! thx
just saying
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
ugh sorry im not familiar with that kinda stuff
then leave front layer empty
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
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
wouldnt be easier to ignore the user's culture and use always our calendar?
(internally)
no idea, not familiar with this issue
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
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
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
So, no idea to fix that logical issue?
Are you pressing jump quickly post jumping from wall ? and at that moment the jump cancels the second jump motion ? Is this the case ?
Nop only 1 jump input, and after the walljumping phase (when "wallJumping" is back to false), the deceleration phase starts, towards the wall (and always towards the wall)
|
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)
@lost urchin Don't crosspost.
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?
You can post again sure, after a bit though. You can't jump around while your previous questions are still visible in other channels.
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.
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?
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?
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. π€·ββοΈ
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.
Why not use assetBundle browser ? unless you want to explicitly do it via code, using bundleBrowser them it makes workflow easier.
Although I suggest using CompatibilityBuildPipeline instead of BuildPipeline since its deprecated and has been replaced with ScriptableBuildPipeline instead
I tried googling assetBundle browser but it looked like it was deprecated?
Maybe I didn't look hard enough
Code you pasted above is deprecated too, THats y I suggested using CompatibilityBuildPipeline
Ig this is an AssemblyDefinitionReference Issue. are there Any asmdef File ? IfSo Are they properly referenced ?
Also why not use Addressables ?
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?
Addressable Assets's backend is AssetBundle
I do not believe there are any asmdef files being used. I'm actually not entirely sure what that is.
Addressable is just organized way of packing/loading asset bundles
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 ?
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.
Why not Resources.Load ?
Are sprites generated At Runtime ?
I think not but just asking for clarity
Are Sprites on server ? or in the build ?
deployed with build *
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
What exactly you mean by Saving them ?
At first I thought you were downloading from web and saving the buffer on disk, But I think you mean it in some other way since sprites are already referenced to scriptable and are deployed with build
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.
Oh I see, Ig you were thrown at wrong track my friend
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
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
Can you clarify what you mean by deploying assets from the web?
Nothing is being hosted ideally
Have you played Asphalt or any such mobile game ?
Yeah, that's the racing game right? I've played a bunch of mobile games.
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 ?
Is this what you would be seeing when using assetBundles?
For That Addressables are used (Im gonna refer to them as Addressable now for sake of simplicity as assetBundle is dep)
Yes exactly, This is the usecase for addressables. The LiveOps
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
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!
No problemo
Incase decelaration is dependent on directionChange, The states are coupled. Why not tie decelaration to a fixed vertical point ?
What do you mean a fixed vertical point?
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.
I have no idea how to implement this in my code to be honest haha, and it sounds like a mathematical nightmare with the messy logic I have
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
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 .
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.
System.File.WriteAllBytes
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
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
Do you know how i can store more images in a file or is it better to split them in one file each image?
What's the URP equivalent of "OnPreCull" ?
I don't want to use an asset, I want to learn making it myself, but I'll try to find that youtuber, thanks π
I didnt know this, very interesting
either separate files, or I'd just zip them if you need to send them in one go
Thanks for the reply @undone coral π
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.
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)
Is it study purpose?
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.
https://docs.unity3d.com/ScriptReference/Camera-worldToCameraMatrix.html
It says Z axis is flipped
I'm working on the development of a game engine that is roughly based in Unity, and I like Unity's API haha
Got that as a separate property
And this would be my plan for actually making the transformations
Ignore the comments, I was trying some stuff prior
Oh, cool, I'll take a look into this as well
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)
Using pre installed docker image may be better for your mental health
game-ci seems very neat
game-ci with github actions has been worked well for my project
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
@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
Well I can't tell for sure since I don't have the source data nor model
it is hard to remote-coding through discord π
Yeah for this issue anyone you find to get help would be, I think
Alright, I cleaned it up a bit, I had some resources outside of the project, you want me to send it to you?
If you want, I'd check when I have some spare time
--
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.
I think you'd best just make a small testcase to see what happens with a (hidden, dont think that matters) component to a prefab.
I dont really understand your context
What do you mean query components for instances?
You are right on making test case π
For example, if your script needs to call GetComponentsInChildren on Awake, it will be called every time you Instantiate.
I want to cache the result of GetComponentsInChildren as SerializeField, so it only called once for a prefab, while it will still have reference to components when Instantiate.
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.
That's the whole point. It convert to references of components in the instances.
It's for DI plugin, so it is gotta be somewhat generic. Serializing direct reference is not working here
I dont think i understand, but i wish you the best of luck with it!
Thank you π
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.
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
planes with textures of images
it feels like a strange projection, you probably need to distort the meshes, or a custom shader
kinda looks a bit like spherical projection
I don't know if cameras support custom projection
I might be wrong
ty for the tip I wil try it
but these don't look euclidean to me
It is a weird shape and front faced is easier to do these shapes have a lot of other directions
sorry?
I mean that it is a challenge to get this shape π
but ty for the help
you're welcome
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
I have
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 ?
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

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
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.
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 π
Mainly 3d
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
Is there a way to cancel async functions the same way we do coroutines?
But I saw somewhere it was for .NET 4 and on, and I thought unity wasn't there yet
.NET 4 literally doesnβt exist.
https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=net-6.0#remarks
You can see which version supports it.
recent Unity is .NET standard 2.1 compatible btw
wdym it doesnt exist
There are things way over it
But they skipped .NET 4
Just like how windows 9 doesn't exist π
this is where I read it
Probably meant Framework 4.x
On the accepted answer
That's .NET framework 4
Their versioning is confusing to be fair lol
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 ?
You can store the vertex you modify (dirty) and then update it, you don't need to iterate through every index with a condition.
sorry I'm not sure I understood what you meant
How do I modify and update only the specific vertex? π
With your own manager.
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?
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 π
You'd be able to do with this API
https://docs.unity3d.com/ScriptReference/Mesh.SetVertexBufferData.html
ah, that's what I was looking for! Thanks a bunch !
I might come back with more questions π
Piped to the void yes
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
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 :>
Catheis thing then yes
how can i switch the default layer with script?
anyone know how to make ready up thingy for multiplayer
with RPCs
whats that
and just have the server keep track of which players are ready
You should go follow the tutorials for whatever networking framework you are working with. They will be covered
ok ill look
How can i change layer for Gameobject childs too?
You need to do it by recursively looping transformβs children
or be cute and use GetComponentInChildren<Transform>()
yes, but i need to to do that only for the gameobjects in list
so?
Do it for only the ones in the list
in any case
doing all this stuff in Update is kind of horrible
ok, but how?
with this
Students should be handling that logic.
You also shouldn't be iterating and finding them.
right
this is #π»βcode-beginner stuff btw
Only a student should know it's targets not an upper manager.
Cancelation token.
if (cancellationTokenSource.IsCancellationRequested)
{
return default;
}```
I should be putting all UI's that do heavy operations on separate canvases, correct?
You'd think Unity would have done that by now.
They never do things for you π’
how would they know which UI elements are going to change and which ones are not going to?
Render on canvases helper? Not hard.
They made the whole engine in the first place π
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?
Try using AndroidJavaClass.
You will be able to find examples and usages on unity manual
Anyone know if there's any support to auto listen for speech using webgl? Or would I just roll my own?
Also is there support for JWT or would I need to roll my own too?
Whats lep?
help*
This is not how you get help. You need one, coherent, post explaining your problem and what you've tried. In the right channel.
Please read #854851968446365696
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
Yeah thats neither one post, nor coherent, nor what you tried, nor in the right channel.
where should i post it
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
I fear thats the best/only way
afaik some ways of making rt you can pass in -1 to get the screen size
Hm but i cant find it atm
but the textures can never be resized?
Indeed, you have to make new ones
welp, that's a bummer
what about it?
you could use it to zoom in/out
Please no
so you put ultra quality right away
or bad
then it wont get
Is there any actual difference between doing
using System;
namespace Something
{
[Serializable]
class A
{
}
}```
and
```cs
namespace Something
{
using System;
[Serializable]
class A
{
}
}```
?
if works then no
imo it's better to just render to a part of that texture then
yes
Don't using directives have to be first?
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
}
ahhhh, I see!
But if I have 1 namespace per file, then it doesn't matter, yes?
yes
you're welcome
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
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
dont crosspost - and learn how to share code #854851968446365696 -> posting code.
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
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
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?
One more question: Would there be a way to know if the property had setter but stripped out?
I can agree on that. But uis are agnostic to engines.
But getter only properties would have that too
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 *
Hearthstone is Unity
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.
by saying incorrect things π
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.
IMO premature optimization can result in some hassle π I think thatβs what doc trying to say
This isn't PO
I don't make games.
You donβt really have to optimize something until you profile it
The profiler is not a good use case for a published product. It can give you an idea.
You donβt have to use profiler, I meant profile in general
The animation issue I was having was in fact solved by seperating the canvases.
Yes I believe we all do that.
The approach was to seperate the canvases to reduce the loss of frames.
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.
It's not a perfect solution but optimizing frame rates is never a bad thing.
The thing is I canβt also do this because Iβd have to preserve userβs assembly π
It sounds horrible already lol
@deft tangle Don't crosspost
I would like to re-pose this question
You would store the go POS then the vert local POS.
This just gives the bounding box though, not necessarily the coords of the vertex of say, the mesh in a mesh collider
Right?
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[]
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.)
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.
why wouldn't you just store the position/rotation/scale and center/size/offset settings of the collider?
the vertices in a mesh collider generally come from the mesh data itself (with potentially some optimizations) and then it's a convex hull if convex is checked
there are no vertices for sphere/capsule colliders
those overlap calculations are done purely with geometry
probably the same for boxes
aight
So just BB + Pos + Rot + Scale should give a pretty good estimation for most objects
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
I'm assuming this is 2D?
Doubt it since mesh colliders were mentioned
Depending on what exactly you need I would personally just use the mesh data.
BB is throwing me off.
How is it consumed?
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
Can you construct the object as a primitive on TF?
If you can, you can just pass it ID and POS, rot.
but a fun one
Hey, I have a semester!
The game is Human: Fall Flat if you're curious
Hey, I got the game knowledge
Oh 1000%
And, that qualifies you for what exactly?
Not officially, but the community has modding tools that I'm familiar with
(I mean, it's just BepInEx but still)
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
writing effective ML training scenarios has nothing to do with game knowledge and a lot to do with knowing how software works
I'll agree with that
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?
You both are acting like he needs to pay for his crimes.
Reenforcment learning specifically
You haven't even asked his knowledge...
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
Just grab the mesh data mate.
Use that, 99% of the time that's handling the colliders
Imma be real, this is 100% a "fuck it, it sounds fun" project
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.
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
"You don't know what you're doing. Scrap the project"
what is your problem? @undone coral is being open and honest here
dnSpy's worked well enough for viewing source so far
This is coming from you? "And that qualifies you for what exactly"
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.
Fair question, gameplay experience has no value in ML learning programming
You have to be a dick?
I question his experience in this task. as far as I see it you are the one being a dick
Ain't you the loser who didn't know about player prefs?
Β―_(γ)_/Β―
Yeah right, I know nothing about Player Prefs
https://assetstore.unity.com/packages/tools/utilities/player-prefs-plus-124163
https://assetstore.unity.com/packages/tools/utilities/player-prefs-lite-222004#description
Crazy, all that time writing a plugin. But didn't know you could use player prefs on webgl.
You sure you know what you're doing?
Oh, I'm sure, and I've been doing it a lot longer than you
Shouldn't you have known that webgl uses player prefs then?
Like that's your wheelhouse right?
But I do know, show when me where I said I didn't
Aight, well Imma get back to the project
When you said the only way to serialize data in webgl was to write a plugin.
quote me, show me my post and the context
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
Now you're playing stupid? Come on Steve you're better than this:
you specifically asked about a js plugin, I told you the truth. no mention of Player Prefs there
I asked in a Unity discord about webgl...
There's no mention of player prefs because you didn't know you could use player prefs in webgl.
this was your question
"What's the process with Webgl and serialization."
which I answered. It's not my fault if you asked the wrong question
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```
Well then I guess you're too stupid to put 2 and 2 together on a unity discord?
Shame.
I have 18
I love the way you only quote half of the question and then expect me to have answered only that half
The second part was a follow up IF the first question didn't have an answer. But you do you mate.
And if you really are a SE with 10 years experience you would know better
yeah, this'll do nicely
Crazy how you made a plugin with player prefs but still couldn't read between the lines and offer it as a solution.
fair
Do not blame me for your short commings
Okay player prefs man.
I collect a list of graphics and SetMaterialDirty them
but it might not be necessary with the buffer cleanup you showed
Maybe you need to learn how to interact with real people.
Nah, not if 'real' people are like you, I'd rather give it a miss
Well then stop giving shit advice to people when you don't really know what you're talking about?
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.
wtf is your problem? Did you try to implement interop in a browser? Did it work?
wtf is my problem?
Dude you are clueless.
Not only do you give shit advice, you need to learn how to actually interact with others.
Oh, I see, I hurt your feelings, boo hoo
No, I'm calling you stupid and not informed even in plugins that you write.
I think whatever happened between you guys can be resolved in private π
I would suggest Steve learns to interact with people better if he wants to have conversations in public then?
And yet, you are the one throwing insults
Do you know how this works?
But anyways, I'm done.
Just disengage. Both of you.
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)
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
Unfortunately, I do not have it but you are right, it is better to install it and animate in the blender/maya
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
Because it makes code flow non obvious
on all levels
Checking should be unnecessary in a good architecture
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
If you put steps as data in spreadsheet it forces to normalize your data, shows flow, and everyone will be happy π
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
Exceptions are exceptions, regular code flow should not utilize them as goto
Is this a process that needs to be waiting? Or can you have listeners?
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
Unitask again i see
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
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
Is there a function I can use that can set the max distance a GameObject can move from NavMeshAgent?
I donβt know what to say because I have no clue how to fix this
But very cool π
Looks like you want initial distance to target / 2.. if agent is close to that distance stop the agent
I guess that's a bad example, but the max distance is relative to the GameObject
One thing I had in mind was to simply just stop the Agent once he reaches max distance, but I'd like to clear identify to the player the point it would stop before the GameObject reaches its max distance
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
well if you have a path calculated to find max distance and don't want to recalculate - cache this max distance separately so it's not overwritten using agent.HasPath to ensure you only write the max on your initial destination execution.. is that what you mean?
No, so the path calculated is what's in the screen shot (white line), going to the mouse
I'm looking to recalculate a new path showing point of origin to the max distance
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
Ah, sorry... having an issue getting the Vector2 of the max distance point
try using Vector2.MoveTowards to interpolate between corners/destination
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.
you download the players data when they join right and keep track of it?
then you can just compare new vs old and update if the new one is higher with a simple if statement
yeah but how do i access the old one?
by downloading it from playfab and store the data received a static script
Whos alive in here
not me, im totally dead
lol
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..
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?
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?
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?
Github wipes data stored on their server like once or twice a day
Should only store executables there, nothing that might change, cause that'll reset
Idk if thats your issue but yeah
Are you saying GitHub is not a place for storing source code?
No, im saying its not a place to save data
think he is referring to like Github actions and CI stuff
π€·
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?
No, i just understood your question a little wrong first
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
I see
When we then searched on the issue, we found out github cleans up data frequently, resetting files to their original
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.
what type of serialization are you using?
if using something like git or hg you will want TEXT and visible meta files
SerializeField
no the format
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
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
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
How would I confirm if the metals are versions?
Meta's. Pardon
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
I checked gitignore. It is not ignoring .meta files
are changes to meta files being committed with the files they are for
other things i could be is branch switching with uncommited changes, and how conflicts are being dealt with
We do need to improve yaml merging yes.
We don't have a user friendly method of handling prefab conflicts
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
So basicall, we need to babysit meta file ida
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
Anyone knows how to prevent Unity from showing "Everything" in an enum flag type? https://twitter.com/RatKingsLair/status/1564588831562776576
I see
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
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
been working in unity using hg or git for 10 years or longer as well, with no issues like this
Ooh we're getting snooty. Ain't you cute
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.
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
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
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
So it's technically BitBucket, which I haven't really used before. They don't have a proper Yaml merge tool. I don't KNOW of this causes the problems. I just know when the problems arise - when switching branches
bitbucket is just a host
Concur. And it shouldn't be acting strangely
Git is the system, and you actually can set it up to use the yamlmergetool contained in your unity install
And I've shared Unity indie projects with ol' fashioned GitHub for gamejams and again never had to babysit meta files before
find a branch where switching to it casues issues
I can try to hunt down the guid next time there's a conflict. For science. The project lead that's been here says he's had he issue here or there but can never see what's causing it.
git diff otherbranch
I'll try that. It doesn't happen 100% of the time
Thank you for your help @brisk pasture
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?
are you guys using conventional unity serialization, or Odin, or something else? do you implement your own handlers or other complex stuff like editors?
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
Not allowed to use Odin due to licensing structure and our institution.
Should be standard serializer.
We are trying to use the new UI Toolkit but not sure this is the mischief maker
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
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.
well
So this is the part I wonder about
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.
This shouldnβt be happen unless you are version controlling Library folder or something
Library file is ignored
In our gitignore I mean
you're using git right not hg?
At this studio, yes. BitBucket with GitHub.
I havenused Hg before and it didn't give me this issue
okay
We are talking about actually serialized field right?
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
Also you are using text meta file too right?
Yes it's a dictionary marked with serialized field, and serialized generic type
can you show me
show the code i mean
i mean it should be obvious that it's not in the inspector, but i think it does appear in the inspector
dictionary out of the box does not support unity serialization
because you're saying you're changing a dictionary
so it's some kind of custom thing
that may be buggy
Sadly know. I'm on my cell and discord is banned from work magine
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
Sounds like custom yeah
it's not likely you have an issue with .gitignore
if your people just went and got the one off GitHub, it's fine
yeah so that is its own logic, and custom serialization logic that could have a bug
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
is there a .gitattributes file in the repo?
suffice it to say it's buggy
Yes
okay, is a .prefab, .unity, .meta or .asset file declared in it?
and what are some of the things that are added, probably to the bottom?
are they weird?
Do you have submodule?
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
this is pretty hard
SQL Data Explorer?
hmm
it's probably too premature for this
Ye, I figured it might be. Was looking at maybe exporting to our own database, and doing operations from there
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
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
picked cards in a draft format?
But I think for that I may have to export that data and write something myself to visualize it, or use Tableau or something
in the long run, every video game eventually stores traces and analyzes them post-hoc
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?
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)
okay
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
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)
okay
Atm, its a conventional game, but I do believe they intend on adding an NFT element
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
For reporting, that makes sense. I'm not familiar with GAv4 though, thats google analytics?
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
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?
unity analytics works the same way
the backend you use doesn't really matter
does the game already record events?
Some very basic ones atm
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
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?
hmm
Because I can't figure out how to read an array in the unity analytics dashboard
you can't
i think part of this is learning the limitations of conventional analytics systems
and knowing how to work around them
And if its 1 per unit, won't rate limit become an issue?
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
Hm, well, I've got some things to get started. I appreciate the help!
I'm not sure what you mean by this though?
that you have some pre-existing data they're already recording
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?
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
it is probably easier to do this from the server code.
To clarify, I'm not supposed to be the one to analyze the data, I'm supposed to implement it, and make it accessible
usually that means sending data to a pre-existing web service
do people actually play the game?
is there even enough data?
Imo, there isn't, but they wanna have it ready for the launch
Ye, I'm picking up on that
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)?
is it using an asset?
It's build from scratch
oh yeah because it's not a card game i'm sorry
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?
We've got server orchestration
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?
consider that you might not be sure what is and is not in there
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
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!
Any tips on creating a system for enemies to Navigate/Pathfind on a moving platform?
Unities navmesh does not support this sadly
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.
more materials
each material == a draw call
in SRP more materials is not a problem, they are batched if they share the same shader
if the material supports batching
yeah, given that
Batching just means making few out of many based on similarity. So itβs still vertices over materials
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?
Use volumetric casts
I think he is using raycast currently
I'd be doing Physics.OverlapBox to detect if I'm colliding with any other blocks. Then iteratively testing spots highter and hogher until finding a free zone
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
you could actually also just use a pure 3D grid structure for this
with no physics at all
cool will try that :)
It'd be best if you do it with calculation, since your game is tiled environment
Use the volumetric casts
true and tthen just hasve a system that occurs grid spots, so like this brick is on grids ....
never heard of it will research
ty guys super helpful
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
What praetor suggested
@brave widget volumetric cast == overlapbox