#archived-code-advanced
1 messages Β· Page 133 of 1
Ah, and I forgot to actually do something with the running state changed event lol
Why expose the instance instead of only the properties?
Really good question. Should I do public static Vector2 then?
Maybe you can answer in #π»βcode-beginner or #archived-code-general
That does simplify things, doesn't it?
You can also have a look at mine if you want;
https://gist.github.com/Wolfos/44d99bd3b6a79a137e09e07f40912a70
This supports two types of gamepads as well as keyboard and mouse, with button prompts for each. However, this would break in a big way if you ever wanted to switch input systems or support splitscreen π
Don't know if this is the right channel, but I can't figure out what I need to include in the asmdef file (Assembly Definiton Asset) for my scripts folder in order to get my project to compile when I started using FilePath and MenuItem attributes.
I can see that MenuItem is under UnityEditor.CoreModule (I think)
and FilePath is the same but those UnityEditor.CoreModule is not available in the list of references
^^also the error happens only when I do a release build, in the editor everything works fine and in visual studio everything's ok as well
they're automatically referenced (unless you changed some asmdef settings), so there's nothing to reference. Your build is failing because UnityEditor doesn't exist in builds
alright I might have to go over separating my code for release/in-editor, I'm trying to make a scriptable singleton for the first time
if you have scripts using editor-only namespaces that aren't in an Editor folder or subfolder, you need scripting defines to conditionally include them, ex #if UNITY_EDITOR
ScriptableSingletons are editor-only so that's a bad sign already
aaaah I see, i have completely misunderstood the use case for scriptablesingletons then
I'll try to rework my class then and I'll be more mindful of when I'm using editor namespaced classes
thanks β€οΈ
I'm trying to set up an attribute-based property drawer. I'm trying to make a binding that takes the type of the property and sends it to a BaseField<Type> element. Currently I'm using DataBinding and SetBinding() so I'm able to use converters. Oddly enough I'm getting a "Index outside of bounds of array" error. The log shows the error was thrown by Unity's binding system, so I'm definitely doing something wrong, but I don't know what. Can someone please help me?
does anyone know a quick way to import audio files that aren't native to the project?
this is the current way i've been doing it.
i've never actually worked with file stuff and this is extremely slow 
or if there's anyway i can optimise this code
you arent using any form of parallel loading?
i dont think so. i dont usually have to do too much code optimisation
how can i set up parallel loading?
async tasks are what i would go for
i'll look into that, thank you 
i swapped the coroutine out for a task. i tried to use the background thread although im not sure if that's the correct thing to use. (i also cant run most of the code on anything other than the main thread)
the code is a little quicker, it's taking roughly 1 minute with 200~ items.
is there anyway to optimise more or is this the point where I just hide it with a loading screen?
(code so far for reference: https://paste.ofcode.org/3xv9ATazqyNJ7fdNX5HUCt)
to be honest, I'm not expecting anyone to put in more than like 20-100 items. at this point I'm just looking to learn (and just in case for the extreme scenarios)
I don't know how you're calling initialize, but this await is likely blocking the main thread making the whole async thing meaningless:
await Task.WhenAll(tasks);
I'd also recommend profiling the process to see where the main bottlenecks are.
it's called once when the game starts, on awake. also i haven't really used async before, thanks for me letting me 
i'll give it a try now
Main thing to confirm is wether your initialize method is being executed in one frame or not.
it executed in 1 frame 
I'll mention that you can rewrite the load file to be like 10 lines of code...
UnityWebRequest request = null;
if (ogg) request = ogg request;
else if (mp3) request = mp3 request;
if (request == null) log error and return;
await request and add to the list;
pseudocode because lazy, sorry π
Something something UniTask
all good, thanks for helping out, i'll implement that now 
i'll give this a search now 
Awaitable exists already in Unity as a Task replacement but UniTask is just better imo
UniTask won't help you with this... it's a slightly cheaper async task thing, with some tradeoffs (it is cool though)
I just read this: https://discussions.unity.com/t/asynchronously-loading-audioclip-from-file/796608 which may be relevant
yea i just wanted to say π
oh yeah im giving this a read now and i can definitely see some useful features here. like pulni said im not sure if it helps here unless im missing something from a quick skim (definitely saving this for other projects though π )
basically - if you're fine with streaming audio - you can set it to streaming, otherwise - sadnes
o, that sounds like it could help. i'll give it a read now 
haven't made any changes just yet (still juggling a few things one second) but here's the full script if it helps at all (or if anyone is just interested in general)
https://paste.ofcode.org/huAVsL68Ku4hnUQEhArke4
(small change, shortened the thing pulni mentioned earlier)
you missed an || extension == ogg, also I still prefer my way of writing it π
oh good point. my bad, bit tired lol
btw a small caveat of using async void or not awaiting tasks - you won't see exceptons if they happen inside these - they'll be kinda silently ignored
you could add a listener to TaskScheduler.UnobservedTaskException that print them, but that also doesn't always happen (I think)
so just keep in mind in case an async thing is not working but also has no errors π (you can always do a manual try-catch inside the async thing which will catch it, but yeah)
tried this, that made it almost instant 
o, good to know. i'll keep that in mind
everything still works too
https://paste.ofcode.org/c5uSRF9yhCu3qbSJMQTtPs
probably the final changes I'll be making for now. i gotta get going to bed 
thanks for the help everyone 
unawaited tasks are a problem but in Unity, async void methods (started on the main thread at least) will log exceptions to the console
I'll have to check to confirm. I think that's only true if the exception happens before the first async part, but could be wrong.
In any case, exceptions happening in tasks and not showing in Console in Unity has happened to me more than once, so still worth keeping in mind
this will log to the console:
async void Test()
{
await Awaitable.BackgroundThreadAsync();
throw new Exception("test");
}
Maybe they've improved this at some point - that'd be nice! I can't reproduce it now in Unity 2022 (although I feel I've had this happen at work on said Unity version π€ )
Oh well, I'll keep an eye out π Thanks for letting me know
i don't mean to nitpick but it's a common point that people use to justify their fear of async so i think it's worth clarifying π also if you turn on -warnaserror:4014, that'll cover most of the cases where you could "lose" a task!
How can i save native array, native hash map, etc.. efficient for a save-load system ?
I don't want to convert to array
unity supports the overloads of Stream.Write and BinaryWriter.Write which take a ReadOnlySpan<byte> argument which should work to write data directly without copying into managed memory
iirc Unity added some convenience methods for converting between NativeSlice and spans recently ish
bonus fact, UniTask offer .Forget() to solve this exception reporting issue for UniTask and UniTaskVoid π§
Ah, yes, I probably had it with something fire and forget where the task was "ignored" like this _ = FireAndForget();
I used to use discard but better to use Forget() if using UniTask
No idea if Awaitable is different or has an equivilent but i dont use it
hey, I quitted gamedev many years ago and slowly maturing to start solo project. Whats current industry standard language for coding server side (HTTPS/Rest + WebSocket)? I mean custom server, not looking on using any libs
Would it be Go? or C#? Not intrested in C++
I doubt there's an industry standard, and it is very likely requirement dependent. For high performance scenarios, some technologies might be ruled out, but otherwise case by case factors matter much more, such as what technologies your team is already familiar with, what technologies you can potentially hire for, what technologies there are existing infrastructure to host on, etc.
If you are building a backend that handles less than 10 RPS, I doubt it even matters what technology you choose.
This server doesn't have an area for non-Unity questions, you should ask elsewhere
What kind of server? Is it a game server or something else?
Anything real time you want UDP
Sockets in managed languages are awful btw. If you want speed, you want to interop into C++. Sorry.
Especially If you're going to do a custom job like you're talking about.
Websockets + WebRTC what all the cool kids are doing if we're talking client hosting with a relay
Rather, websockets for the lobby and client discovery while the mesh is through WebRTC so TCP/UDP
Game server for mobile game yeah, but for an idle game where you send your "hero" on some adventure and after X hours you get something in return. There will be no real real-time gameplay, maybe in future I'd implement some mechanism during the "adventure time" where you'd get mobile notification and you have to click something that will affect the rewards at the end
Good point, sorry. Asked it here because I had Unity in back of my head because I will use it
Thanks, will need to check the WebRTC since I dont know this one.
Edit: Ahh its p2p, so this is not what Im looking for
Not necessarily. Opening additional data channels is optional if you do want direct communication to other peers for things like voice chat, but otherwise it works fine for client host mesh networking.
Not entirely sure of Unity's netcode for gameobjects transport layers, but fishnet library has support for it
Hmmm, but if it would be Websockets + WebRTC then that might be it. I can start off with Websockets and then add WebRTC if I have a need for p2p
Would using REST also be acceptable? For example if a player wants to do something like send the player on an idle adventure or something? (text based)
Websockets is TCP so if you're making something turn based like checkers, sure. But otherwise I'd look into UDP if you're making some more action packed ;p
Mostly its going to be text based, but also plan to add more action side activities.. bit complicated but thats my idea π but maybe UDP... but it would be an overkill for most of the activities
UDP is, if anything, more lightweight and minimal than all the other options mentioned
Also you should make a clear and specific list of what data you need to sync, when and how often, list any security and persistence requirements for that data, required model for authority and user management, then maybe someone can recommend a tech stack
right, I will think about it and write something up later
If you want to make some thing custom, look at zeroMQ et al (framework for inventing protocols, as minimal as you like)
anything prefixed/suffixed with βwebβ will be very heavyweight and carry a lot of features you may not need but which may add convenience at the (significant) cost of performance
so I did a quick summary of main features I planned
Mobile idle game
A map where you have multiple instances - each instance have different mods, drops
You can send a player to the instance to fight for X time
Multiple players can be in single instance (as solo or team up from instance board) - slight server side interaction - eg. influence rng of loot
You can get a popup when inside an instance where you can decide what to do - boss encounter -> fight or not?
Crafting/ upgrading items - mixing up crafting materials to get certain items
Marketplace between players
Farming/ mining - possibly not an text based but action based, where you can controll your character just like other popular 2d mining/farming games
Leaderboards with profiles - I can see other players achivements and their outfits etc
Edit: I know thats not exactly what you mentioned, but might tell the idea
okay, I have theoretically finished other more important things with the NDA porting
so I have more time to understand things
what is Total Resident, Total Allocated, Allocated memory in table, and why all these 3 values differ?
because Total Resident/ how much memory of the allocated lurks in the RAM = 1.29 gb
allocated memory in table = 1.82 gb
total allocated/total memory in snapshot/how much memory I have allocated from the system = 5.10 gb
so if I understand correctly, the RAM (the Total Resident on device) is the only one needed to check regularly, right?
because its the one which must not proceed the max available RAM
Has anyone used Bresenhams Line Drawing algorithm? If so i'd like to ask a few questions.
I guess we can't do anything about the Native part
so the only way to reduce the leak is to "attack" the elements in the list?
like NetAIController, FXCollection, etc.?
45 mb is hardly anything to worry about
But fxcollection having 15k objects sounds high but I dont know what that does
that's not 45, that's 100+
if you check the top bars
6.46 gb -> 6.63
ah but the managed size max is 74mb which is still probably fine
I mean its constantly increasing
Gotcha, probably leaking managed objects somehow. Do you use anything that needs disposal?
so its way better than before
but its still leaking
oh I wrote it down badly
so I mean this is one map loading and returning to main menu
but if I do this like 30 times
the memory will still be overloaded, and crash happens
Then FXCollection and String going up by 15k+ may be the first places to look
but that's only 1 mb, isn't it
or its also increasing the Native?
ha yea that is what i said initially π
managed code should not affect native memory allocation
native includes native code, libs and other things such as NativeCollections and burst code
so I can't do anything with the Native part?
ahh its so time consuming to make screenshots each time from a fully different computer and make that screenshot somehow passed into this other machine
ok checking it
I could use also app, but I don't want to place my personal stuff everywhere
but yeah, maybe browser version would be a good idea
faster at least
@echo coral
Im presuming the ALLOC_ ones are based on these allocation types
https://docs.unity3d.com/Packages/com.unity.collections@2.5/manual/allocator-overview.html
Implying they come from jobs or other code using native collections
ok then it won't add much
I mean based on these, I believe I can't free much from this
the base memory allocation should be decreased further
Yes unless you are using them yourself or have packages using them it's hard to know.
In the editor it can sometimes notify you of leaking native collections
Can't you expand these Allocs?
This is not necessarily from jobs. It's likely the names of the allocators unity uses under the hood.
I can, but there're only memory blocks there
ALLOC_CACHEOBJECTS_THREAD: TLSF Memory Block 152
ALLOC_CACHEOBJECTS_THREAD: TLSF Memory Block 150
etc.
Ah, okay, it's under reserved
The fact that it's going up, probably means that your peak memory consumption is going up at some point. You should track that peak and investigate it.
Other than that, It seems like you have some material and material property block leaks. I'd look at code that duplicates or creates materials(possibly due to accessing material properties of the renderer) and consider if you can eliminate it. Some objects are leaking too, which could be related to the materials in some way too.
but if material leaks only 291.2 kb size difference, then it can be a lot of work without too much benefit
0.5 MB is also not much
If the objects are related as well, it's like 1mb leak in total. And it's not clear at what point exactly this happens. It could be load related or time related. But anyways it will accumulate eventually
it will, but 2 week is not enough time to solve 1 mb leak
I mean that won't really solve anything
and I will still have other tasks in this 2 weeks
If that's the only leak you have, it would definitely solve it
I can't
6.46 gb -> 6.63 gb
That's the only leak we can clearly see in that capture.
its on the screenshot
This is the reserved memory
It could be related. It's hard to tell without looking at the peak
I didn't do anything else in the past few weeks other than looking at the peak
constantly
Well then share info from a peak
there were huge textures, which were already fixed
16 pieces of 8K textures constantly loaded into memory
I just tried to avoid solving that, because solving those took like a week
manually created Materials do need to be destroyed manually too btw
and the solution is not optimal, but at least it works
@untold moth to check the current peak, there's a moment, when player returns from gameplay to the main menu, and there's a huge spike in memory, and then it stays around that
I tried to stop the game around that moment using Pix
but then I can't make Memory Profiler snapshot
if I stop the game using Pix
If you're at the stage of using pix, I'd use it's memory metrics/tools to investigate the leak.
Other that that, I'd make profiler captures in the actual game, rather than the menu, as it's more likely that something is leaking there and just adds to the reserved memory in the menu scene.
during the gameplay, the memory usage is the exact same than in the main menu
according to Pix
if I understand it correctly, of course
there's much more memory reserved, when I return to the main menu
more than in the actual game
but most of it disappear, when I start a new gameplay map again, although not everything, hence the leak
what I can see is that there're still gameplay-related stuff staying inside the main menu from the gameplay
and its still originates from AssetBundles
but I have zero idea how to fix that, because I already made a manager weeks ago, which collected the Addressables handles and releases them, when I return to main menu
how to figure out which assetbundle could be that?
(its probably not directly referenced inside the assetbundle)
okay, it seems Duplicate Asset Isolation bundle stays in memory
probably because many others depend on that if you didnt move assets after that was generated
since then I realized there's a thing called ReleaseInstance as well
not just Release
and this ReleaseInstance should be called, where InstantiateAsync was called
thats for InstantiateAsync() GameObjects
yeah
but the project contains InstantiateAsync as well π
and I called simply Release on those
so this is what I'm adding now
i probably mentioned this in the past but yea this should be corrected
Why unity cant make this be automatic I wish i knew
it didn't help much
the bundle is still loaded in memory
how else should I do this? I placed this handle collection after each Addressables.LoadAssetAsync
and InstantiateAsync
what else should be there?
can uncompressed bundles cause staying the whole bundle in memory?
even when 1 asset is loaded, the whole bundle will be loaded?
I think that may be true, there should be documentation on how the compression modes affect this
https://docs.unity3d.com/6000.1/Documentation/Manual/assetbundles-compression-format.html
also if assetbundle b is dependent on assetbundlea you can't unload assetbundlea while assetbundleb is still loaded
correct but in this instance addressables does this for us
ah fair, my sinful ass has exclusively good experience in raw assetbundles π
I do much prefer addressables over the manual way but they really should have improved their functionality too
LET THEM REFERENCE INTO THE GAME FFS
I care because any legacy or semi old system that uses Resources really fucks things up
It was also a mistake not storing the address in the asset meta file
currently I just wish those 3-4 uncompressed bundles were the reason I had some elements loaded in memory from a compressed bundle
i would love to know if a given object was sourced from assetbundles or build resource files
so badly
memory profiler
memory profiler is for runtime
it didn't solve anything
perhaps the group needs to be split into multiple bundles (via the group settings)
er no, they wish to detect this state in runtime code
okay, so I ask again, just to be sure.
When an addressable bundle is the reference source of some assets in Memory Profiler, how to make it release from memory?
Things I already did:
- created a manager which collects handles from Addressables.LoadAssetAsync and Addressables.InstantiateAsync, it releases all handles when needed. (LoadAssetAsync handles with Release, InstantiateAsync handles with ReleaseInstance((GameObject)handle.Result).
- I also call Resources.UnloadUnusedAssets and GC.Collect after releasing these handles.
- There's a LoadSceneAsync in the project, but I have checked it multiple times that it doesn't get called at all, with debugger, connected to the NDA build.
- I have setted the Uncompressed bundles to have LZ4 compression, because I have read that when an asset is loaded from an Uncompressed bundle, the whole bundle gets loaded into memory.
- I ran the "fix duplicated assets" (or it has some kind of similar name).
What else could be there?
Make sure you are releasing the correct amount of times (e.g. asset "foo" is loaded 3 times so it must be released 3 times to fully unload)
If your manager only loads once from addressables it should not be an issue
I think splitting up large groups into smaller ones OR changing the pack mode to produce more bundles per group will help
what does it mean "changing the pack mode to produce more bundles"?
I wasn't the one who created these bundles
thanks
I have setted the Uncompressed bundles to have LZ4 compression, because I have read that when an asset is loaded from an Uncompressed bundle, the whole bundle gets loaded into memory.
iirc it's only LZMA bundles that need to be fully loaded into memory, uncompressed should be read from disk
oh okay
did you Destroy the assets?
anything you still see, you can Destroy
with addressables it wont help and will make things worse
hmm but it's a bunch of random stuff that might be dynamically created and have nothing to do with the addressables
yes but right now its addressable related
this topic has been ongoing for like 2+ weeks
like in this screenshot all those instances are from cloning particle effects, which makes sense
i see...
i think the user is pooling particle effects and everything looks normal to me
you load something, you play some gameplay, you instantiate stuff into pools
the addressable has nothing to do with it
am i wrong? hmm...
@hybrid tundra so i think if your gameplay populates pools, well, those will take up memory
i don't think this is a big mystery. you are loading a scene, it has a class in it that is a pool, you keep instantiating objects in this pool. i mean you should see it in the hierarchy when you're playing in the editor
It might be exact same amount, but most of it is probably not reserved, which is exactly what you want to investigate. After it has been released and added to the reserved pool, there's no way for you to investigate what populated that memory and caused an extra system allocation in the first place.
those are get freed up, as I saw
I don't really understand what you mean
I am making my own fps engine from scratch. I have the gun model attached to the palm bone of the first person hand model. I am trying to implement ADS but I don't know how I would go about centering the gun reticle to the center of the screen. Does anyone know how to go about it?
The only idea I have is to switch to IK and just lerp the gun model to the center
What I mean is that you would get more useful info by comparing captures in the level scene, not the main menu.
Basically, you have a box to fill up with stuff. When you play the level scene, it's not enough to hold all your stuff, so you take another box and put stuff into it as well. However when you load back the main menu, you free up the boxes. You still have 2 boxes, but now you don't know what was in them, so you can't troubleshoot it. The next time you load, you have 3 boxes with stuff. But when you load the menu level you're left with 3 empty boxes again and have no clue why you needed the extra box in the first place. Makes sense?
comparing two captures made in both the level scene?
" but now you don't know what was in them"
Why wouldn't I know?
I know exactly which assets were loaded only for the gameplay
In the same level scene
and shouldn't be in the main menu
why would that be useful?
Can you start using threads?
Because that would reveal what exactly is leaking and turning into reserved memory after release.
You don't know though. I'm talking about the 1 GB of reserved memory that seems to be growing.
And, yeah, I think by now it's a good idea to create a separate thread.
Hello π
I'm trying to fix all the memory leaks I have in my game.
Most of those are coming from events not setted to null / badly unhooked.
I'm taking care of those
BUT, I also see clones of DepthOfField and ScreenSpaceAmbiantOcclusion.
I'm using HDRP, on 2022.3.62, with Cinemachine, Timeline
Do you have an idea what could create those clones / how can I clean them ?
Note: Those were detected by Memory Analyser, on a PS5 build.
omg, I have a long story to tell π€£
DepthOfField and ScreenSpaceAmbiantOcclusion what? Render targets? Buffers? Just some objects?
ScriptableObjects x)
exactly like in that post: https://discussions.unity.com/t/memory-profiler-1-1-0-exp-1-released/912957
except; I have a leak of those
(^this is not my game)
do tell x)
Could be just several settings versions. For example if you have different settings in different quality settings.
would a Volume in the scene do a Clone of its overrides ?
Possibly. You can see where it comes from in the unity memory profiler. It has a reference chain.
Memory analyzer should also show a callstack of where it's allocated from.
Hey everyone ^^
I'm currently experimenting with AR Foundation for mobile AR, and Iβm trying to accurately align the virtual and real world in specific locations, like precise rooms or outdoor spots.
The goal is to overlay both worlds properly, so that my 3D content fits naturally into the environment β whether I'm indoors or outdoors.
So far, Iβve tried:
- Photogrammetry, to get furniture positions and rough geometry
- AR Tracked Image Manager in Unity, to spawn prefabs based on markers
Right now, I represent furniture with basic cubes, using a shader that hides my virtual objects when theyβre behind those shapes (kind of like fake occlusion).
But Iβm still struggling to accurately recreate real-world volumes in Unity, and get a satisfying overlap between real and virtual. Things never feel 100% aligned.
Has anyone here tried something similar? Or found a good workflow or tool to make this easier?
The idea is to have a marker that spawns a prefab, and that prefab should properly interact with the space around it.
Thanks a lot π
Unity C# source: https://github.com/Unity-Technologies/UnityCsReference
Packages List: https://docs.unity3d.com/Manual/PackagesList.html
time for this to be flooded with beginner questions π
π
Is it ever acceptable to use a lambda for runtime functions?
'Cause it seems like an easy thing to abuse.
When two general codes love each other very much...
Lambda functions are great
I'm unsure what you mean by runtime functions though
If you're not creating a closure they're ideal
Well yes, I think this is what I meant.
Using it not as a tool for simplicity (or as a paradigm) but generating instructions based on context-dependent stuff.

inb4 begginer q's
I got in before people started posting that repeatedly
We got what we asked for, be thankful hehe
Time to mute #archived-code-general 
Lmao
It might actually turn out that no one is gonna use this channel.π
dunning kruger. those who know their stuff, dont think their code is advanced shrug. Or that those who know their stuff, rarely need help
I'll use it when i have some crazy obscure issue that I need to fix ;P
those who don't know the basics, won't know what sort of issue they have. should probably bring that up in #531949462411804679
Does CreateExternalTexture() take ownership of the nativeTex, or does it expect the plugin to manage it's lifetime externally?
whoops. didnt know that existed. thanks for letting me know
I'm having a strange issue where for some reason, my server isn't hitting any colliders when firing out raycasts while using AdditiveScenes loaded via Async
left, Server; right, Client;
the white dot is placed either at the maximum length of the ray, or where it hits something
does anybody know what might be causing this?
you can edit your message
I would check the ray once if that's the intended one or not.
if you're passing in a max distance or layerMask try to verify that aswell
All of those are verified
Because the Ray is still placing the white dot as its maximum distance
is this problem only with Additive async and no other loading?
like Additive sync, or single sync/async
This didn't start happening until I was using Additive Scenes
No collisions work on the server side either
not client as well?
Client is still able to collide and raycast normally
But the server game object for the client just acts like the walls don't exist
which unity version?
doesn't look like intended
if you're able to reproduce it in a new minimal project, you can file a bug report
new coding channel pog
Oooooh nice
Idk getcomponent probably?
Is it a redundant way to cast a type? π
Does anyone know how to get the information shown in transitions in code? i want to know what the next state will be. So, if i am in State A and I want to know the next state will be B etc.
I tried to use Animator.GetNextStateInfo but it doesnt seem to give me the Info of state B when I am in State A but only does this just before entering state B
The animator doesn't know the "next state" until it actually transitions to it. The best you can do is get all the transitions, find the right one and then get the state it transitions into.
Although, I feel like this api is limited to the Editor only.
So how would I go about getting all the transitions? I am trying to do this in c# and the documentation says that GetNextStateInfo should give me the info of the next state but it does not do so
I already explained you why it doesn't
are you trying to write an editor script?
Because AnimatorTransition seems to be in UnityEditor.Animations namespace.
No, its not an editor script.
Then you can't use that
That link you have sent me seems to have what I need.
But you can't use that at runtime lol
in the build I mean
Why do I need to repeat myself 3 times?
Yeah I know I'll try to find a workaround
There's no workaround. You just can't use it at runtime.
What are you even trying to do?
I get it, I meant I'll try something else not using that.
Just trying to create a game mode using overrides but it is tricky.
What overrides?
Using the animator override controller
Oh hey this channel is new
Thanks for the help by the way. You didn't need to repeat yourself I got what you was saying. my reply just wasn't worded correctly my bad.
NP.
I don't see how getting next state is related to override controller though..?π€
hey, having a problem with HDRISky, i have this script but it doesn't apply to the sky, any help appreciated π
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class SceneSettings : MonoBehaviour
{
HDRISky HDRISkyExposure;
[SerializeField] CubemapParameter[] cubemaps;
void Start()
{
HDRISkyExposure = GetComponent<HDRISky>();
int randomnumber = Random.Range(0, cubemaps.Length);
HDRISkyExposure.hdriSky = cubemaps[randomnumber];
}
}
Hi,
Is there any workaround to allow calling a constructor with parameters for a templated type? (In C++ the compiler would check if the parameters are correct when instntiating the template).
So far It seems you can only instantiate template types that have a default constructor.
In particular in my case all the possible template types have to inherit from a specific parent and use its same constructor parameters. But it seems like I can't add a "new" constraint with type parameters
something like this perhaps (where Cell's constructor takes FortuneSite and Polygon as parameters)
Maybe it's doable with some reflection magic?
you need to cast to BoxCollider2D or check if it is one first, then return . . .
Idk if this be belongs here but my friend really needs to fix his voxel engine and I want to help him
could somebody help figure this out
so the red line on the floor is the normal voxel grid
but if I move the chunk, about in the middle of the line and then place a cube on top then it will be set in its own rounded position
Do you happen to know which offset from the 3d position would be needed if I could fix the placed cube correctly on the grid of the chunk, which is right in the middle of the grid?
C# doesn't support constraints like that unfortunately. There's a couple workarounds:
- enforcing a parameterless
new()+ enforcing inheriting from a base class and then putting anabstract void Init(FortuneSite, Polygon)in that - Creating the instance via reflection /
Activator.CreateInstance - Requiring whoever creates the
Voronoiinstance to also give it a function/delegate that it can call to construct a new object of the required type
they arent
The first and third option still let the compiler check that your types line up, which is nice; the second one doesn't.
The first can be annoying / awkward when you also want to use the types outside of this context, because then you'd probably just want normal constructors.
The third is often nice, but depending on how your code is structured exactly it can sometimes be rather annoying too.
So built blocks are added to some form of block map?
Lets see some of the workings then
what do you mean with that?
The scripts pertaining to the creation of chunks and blocks?
he says that he only rounds up the position of any placed voxel, but he knows that he needs some kind of offset to fix it when placing at a chunk
Is it possible to add additional data to store with all Mesh assets (not gameobjects)? For example, baked SDFs or some custom LOD format.
Does anyone have any advice for using Contact Filters?
I have a top down 2d game with one room on the bottom floor, one room on the top floor, and a stair case
I'll give that a shot
Is there some way I can trigger a call to AssetDatabase.AddObjectToAsset whenever a mesh is imported (without using a ScriptedImporter)?
How long has this channel existed? I could've sworn it wasn't here yesterday
Oh wow it literally did get added yesterday
Anyways
I have an idea for a "better ground check" with capsule colliders and I want to get my fellow professionals' feedback
In my opinion this channel should be renamed to general-code #2
@silk trench Just throw the idea out and then ask for feedback, you are more likely to get answers or people willing to do it
Yeah sorry I'm typing it out
Basically, instead of like a Physics.CheckSphere at the bottom of the player or a ray that gets casted down, the player will have a simple OnCollisionEnter that gets the points of which the collision happened (a Vector3) and if it's above some threshold, then we're grounded
private void Update()
{
if (IsGrounded && Input.GetKey(KeyCode.Jump))
{
ourRigidbody.AddForce(0.0f, this.jumpForce, 0.0f);
IsGrounded = false;
}
}
private void OnCollisionEnter(Collision other)
{
float bottomOfPlayer = this.transform.position.y - 1.0f;
float threshold = 0.125f
foreach (ContactPoint contact in other.contacts)
{
if (contact.point.y < bottomOfPlayer + threshold)
IsGrounded = true;
}
}```
That's most likely more performant than a raycast since it relies on callbacks instead of checking every frame
And you don't have to check if the player's velocity is less than zero or anything because it uses the actual collider on the player
What do y'all think?
We canβt say if you donβt show us how you determine if a player has jumped
+itβs all nice and dandy but youβd have to make sure that your side collisions donβt set you to groundedβ¦ which will be tricky to do
Apologies for that, I've added a simple example for jumping just to get the idea
And that's actually pretty easy, you just set your threshold to Mathf.Lerp(0.0f, 0.5f, ourSlopeHeight / 90);
Because the curved part of the collider is only 0.5 units tall, so you just normalize the slope height using the max height in the Lerp
I mean, you can also just stop the check for grounded if isGrounded becomes true
Checking 1 bool even every frame isnβt bad
wym?
Are you referring to character controllers?
if (!isGrounded)
// check
I refer to βmore performant coz it relies on callbacksβ
That's just one benefit though
Like in the character controller I'm making, you can hold space to bunny hop, but if I use Physics.CheckSphere to check if my player is grounded, all of the tutorials I've seen have the center of the sphere at the bottom of the player
Which allows for the player to be considered grounded when they're really not
So this fixes that in a sense
My only concern are all the edge cases youβll have to cover
And then trying to add a new obstacle, platform, whatever, may be so tricky to do
But I dont know your game
Could you list an example?
I just dont really see the point of reinventing the wheel if you dont have to
Being different just for the sake of being different is not better
No that's not why I'm using this
Well, for example, letβs say youβll want to add wall climbing to your game
Like in Celeste
Suddenly your method becomes invalid
you want to consider your player βgroundedβ when stuck to the wall too
So then increase the threshold?
Letβs say you have an obstacle that doesnβt allow your player to jump, idk - a sticky puddle.
Increase to what?
How are you gonna handle side collisions
Your wall is at 90* and your box is at 90*. You can climb your wall, you canβt climb your box
You could probably just increase it to be right at the curve at the top of the player collider
Iβm not saying your method is badβ¦ but is it good? Case by case basis, basically
And that's easy, just make the puddle on a certain layer or give it a tag, then check against it at the call
Well, yeah, I get where you're coming from, this isn't going to work for every case
But I'm wondering for just like a 3D game using a capsule collider, what would be a problem (if any) using this method?
But dw, thatβs everything in programming. Idk if you work alone or with designers but if the latter, you donβt wanna create potential rabbit holes for them to explore
They have a weird 6th sense to find them and abuse them and then complain if things are breaking because they dont use them the way they were intended to π
Lol very true
@silk trench donno if it was mentioned yet, but you'll also need to use OnExit to determine when the collider leaves the ground.
That's used when the player jumps
But I am now just realizing
that that only works for when the player jumps
What if the ground is uneven?
Yeah it just clicked
That's simple though, you add a collider variable to the class, and if we become grounded, then set the collider to the collision's collider
and if OnExit is called, we check to see if it was our collider variable
if so, we're not grounded
There's also the case of ground changing angle. If you want to adjust speed for the slope, you'll need some way to determine the new hit normal.
I was thinking about that and I'm not too sure
other than using a ray of course
Well I could just stop worrying about every little bit of performance and use a ray on top of it
And I don't see a way aside from OnCollisionStay. Which is probably not a lot better than just raycasting everyframe. Needs testing, but the performance difference is probably negligible.
What's the need for OnCollisionStay?
To get collision info every frame.
Yes
Yeah
Hey, want better performance? Drop Unity and start using C++ or at least Unreal
Youβre welcome
I'm not really using this method because of the performance though, that's just something that I thought would be a nice side product
IL2CPP?
? Are you trying to tell me Unity games are as performant as any other engine using C++ natively?
No of course not lol
But I'm definitely not going to deal with C++'s runtime errors just to get a bit of performance
^^^ lmao
(Fight me)
OKAY LITERALLY FIGHT ME RIGHT NOW 1V1 BEDWARS HYPIXEL
YOU WONT
I'll represent the C# programmers and you, the C++ programmers
Insta win for me, gg ez
actually if you TRULY did know c++, then this would be left shift bitshift operators
therefore c++ is being moved into c# and c# is doing whatever the hell bitshift ops do
I totally forgot
It⦠shifts bits
Ah, right. I'm so silly...
And this is old way of programming not really used anymore unless you write some very custom low level libs lol
Comes up at interview
Ew
And I sometimes see it in my codebase
Never had a programming job (or a job) but that's definitely something I don't wanna do
Funfact, pretty much all collision layers iβve seen in my life are bitshift int π€·
Huh
Unity included
So then Game Engine development is out of the picture for me?
Goodbyeeeee EA job interview
Nah, as long as you dont deal with physics libs lol
I'm using bit shifting frequently to define LayerMasks in code
But i dont even worry about them
Yeah I was thinking about that
I don't understand how you could store virtually a list of ints into a single int
And thatβs in all physics libs Iβve ever seen in my life lol
Which is what I assume it's doing? Don't quote me on that though
In the memory an int is just 32 0s or 1s
in other words bits
bit shifting just toggles one of them on
you can have 32 bits toggled on/off
32 bools
You cannot store ints in an int, it's basically storing a list of bools in an int.
Though, you can use those 32 bits to store other data like shorts, or something compressed
They don't
Yeah they dont lol
I guess I'm not fully understanding how layer masks work in the first place
Oh dude you've got everything
If you want the same thing but more general (not layer-related) I also have that https://help.vertx.xyz/?page=info/bitmasks
https://github.com/vertxxyz/help.vertx.xyz/commits/main?after=e30132bfcdce588359609595805ab7d265c027e2+34&branch=main
First commit was 19th of feb. Though I've had versions of this site before that point that were authored using Unity instead of just pure c#
Huh that's pretty neat
you've no Idea how much I've been repeating this to myself for these months I had to work with Unity
I went the activator path and at first it didn't work. Turns out CreateInstance doesn't check for valid constructors with implicit conversions of the parameters, so conversions must be explicitly done when calling it.
Thanks a lot for the input though!
I kinda think if you're dealing with performance issues with C# and switching to C++ to solve them you're probably doing something wrong.
Unity providing HPC# with the job system and burst compiler now makes performance easier to achieve in many hot paths
That said, I'm really looking forward to free performance boosts elsewhere as Unity upgrades their .net version, their ancient version of mono, and boehm gc
I just have styling and safety issues. Const correctness, inter-class friendship, and the elephant of templates
the day a language has both C++ levels of const correctness and templates, and on top of it compile time reflection, that day I'll be a happy man
I definitely look forward to every improvement made to C# generics, and there's powerful things Unity doesn't have access to yet that enables you to template and create all sorts of things with little boiler plate, like Source Generators. C#'s also been improving on other things, adding more readonly, parameter modifiers, records, etc. The language only gets better over the years so for me C# gets closer to a dream language as time goes on; but it's partly because I've always liked the level of specificity and abstraction it tends to work with. People who like C++'s level seem to like rust and go, java to kotlin, people who like JS and its ilk might be happier with python. You become attracted by what's in your niche and previous experience imo
Hey
I'm try to Spawn some gameObjects using Coroutines using If statement
The condition for If statement is true after few moments the game starts
You can't post codes that big, it gets auto deleted @digital verge
Or is it someone else doing it?
you can post it externally, see #854851968446365696
The Coroutines is not starting
Can anyone help me
Do you actually start it? And assuming you do, it will check the condition once when you do and exit out of it, as it doesn't loop
Im sorry I dont want to be mean but how is this advanced code ?
Yes I did
My friend told me to ask it here
This is more for #π»βcode-beginner to be honest. Lots more people there too
Okk
I'll ask there
Thanks
Is it possible to render text (e.g. from TextMeshPro) directly into a Texture2D, without having a RenderTexture + hidden camera?
I wouldn't think so, because TMP creates a mesh, and is rendered using shaders.
hm. Maybe I could read the mesh and project it onto the texture myself?
The mesh is not tight to the characters, it relies on a shader with a distance field input texture.
Why not just use TMP directly instead of the texture?
trying to make a complicated interface on a flat surface in VR (user interfaces using laser coming from controller), and there's a lot of stuff I want to do that is not easy to imagine with TMP
isn't that what world space canvas is for?
UI does work with the far interaction pointers
you talking about the XR interaction toolkit stuff?
no world space canvas is a unity stuff
afaik world space canvas doesn't work with VR unless you use this: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@1.0/manual/index.html
far interaction pointer is well whatever sdk you're using. I assume ovr or mrtk
*world space canvas UI components
It does work with MRTK if you have it in your project. Even if not you can add your own logic from EventSystem to detect clicks, hover
Hi, i have a question about networking.
I have added RSA encryption from client-to-server , but im not sure if you should add it both ways. The Server-to-client communication is not encrypted. Should i add it in both sides?
yes if you're doing client to server then a server to client is also recommended.
ok thanks
Use UGUI
TMP has UI elements.
Also... TMP is flat by default... I don't see why that would be an issue?
well, one example is I want to do scrolling text. This means text that is cut off from the top or bottom (or sides) partially renders
I haven't found the right knobs to push to get TMP to do that
it's not hard
Or you can use SpriteMask if you're not using GUI https://docs.unity3d.com/Manual/class-SpriteMask.html
If you want the text to scroll you just need to move the text object up and down
hm. I'll try that, thanks
is there a way to force-add code to a build? i've got a package with some code in it that is used in builds, but doesn't seem to work unless i have an extra script referencing the package code inside the main project
just tried applying that attribute to all top level structs and classes in the package, still no luck.
im using a modified version of a package that adds DualSense controller support to the input system ("modified" because my fork supports IL2CPP builds). i can probably just keep a tiny script in the main project and not attach it to any objects for now π€· thanks though!
https://github.com/ryanslikesocool/UniSense
I'm curious when saving would people here prefer doing reflection, attibritues or just an ISave interface with a function like SaveYourself (or maybe some combo...)
It feels like there's enough pro/con to each that I still don't know what I'd pefer
This is like making a "save game" function I mean
Interfaces are really the best for this
I tend to fall to that since I can control the serialize and deserialize but then spend the remaining time in anxiety mode that I missed something and the test coverage has a gap
@remote oar Just checking, you're doing a public-key setup and not a pre-shared-key, right?
Both only have public key of the other side
If you know what I mean
Yup, perfect. Just checking
Private key is only used for decrypting
I'm doing something similar in my login system. C# apparently makes it stupid easy.
Yeah I'm having some issues as well regarding the buffer size as rsa can only encrypt 256 bytes max which is unfortunate
My packets can be longer
Trying to combine them now somehiw
Split them up
Oh, I actually missed that. That's good to know.
Yeah keep it in mind
Normally rsa is only for small data to be sent
But once you have big data, it will say bad length
So you'll have to split the packets up and combine them somehow
And encrypt each packet
At least that's how I want to do it
Yeah, in my game I'm not too worried beyond encrypting passwords before sending to server, and hashing them on the server side. So a 256 character limit isn't the end of the world. But yeah, the packet splitting seems like a reasonable solution.
I see
Maybe you could consider it in the future to prevent man in the middle attacks or preventing players sending packets (which can lead to hacking)
Yeah I'm not opposed to the idea.
BTW if you're using a 128 byte rsa key you can only use 128 bytes
I'm using 256 so it's best to generate a larger one
I actually don't know what my key length is, I'm using the RSACryptoServiceProvider defaults at the moment.
Sec
Sorry 2048 bit key I meant
I've used the accepted answers code:
https://stackoverflow.com/questions/17128038/c-sharp-rsa-encryption-decryption-with-transmission
Change the second parameter to true when you're encrypting and decrypting with this example
Hrm. Okay, so I missed that I can specify key size in the constructor, I'll patch that. And I don't really understand the importance of the last comment, the fOAEP bool I'm not sure about.
Yeah me neither but when it was false the encryption and decryption did not work for me
For some reason
Oh, it's working for me
I also base64 the byte data before sending it, I don't know if that matters.
byte[] data = Encoding.UTF8.GetBytes(password);
byte[] cipherText = session.Provider.Encrypt(data, false);
string encryptedPwd = Convert.ToBase64String(cipherText);
Not sure tbh
Maybe its also because you're only sending strings
I'm sending slot of different data types
Alot*
Could be a factor
Yeah aslong as it works for u it's fine I guess π
Hi there
I need some help with an architectural design decision
Is this channel right for something like this?
I think so
depends on the context.
if you want an architectural design help for printing hello world, maybe not.
Provided you mean software architecture
okay
so my question is the following:
I am building a shop for my mobile game, in this shop are some packages you can buy via InAppPurchase and some you can buy with InGameCurrency. I want to build it modular, with scriptable objects defining the different packages you can buy. So far so good doesnt sound that complicated. But I dont get my head around, how to impleted that you can ether define a package to be purchasble with InAppPurchase or to be buyable for currency in a clean way. Should i even put these two together or are these seperate systems? It somehow makes sence in my mind to put them together, because they share the same properties except the way you buy them. But maybe i am wrong
If someone has time here, i would also hop into a call to discuss about it π
Use the same SO type so that you can easily change which currency they're purchased with.
Just have a checkbox or enum field to change it
SO is essentially config, so unless you are going to have completely different code paths handling them you'll probably benefit from using the same class.
i.e. if you have a top hat in one and a baseball cap in the other, you're going to be checking for those in the hat selection screen. Separating them would mean extra code in the hat selection screen, and any other such screen.
ok thanks π
I dont realy like checkboxes or enums for changing how code handles SO, but i dont have i better idea.
Checkboxes and enums are the bread and butter of SOs
Better change that attitude if you want to get the most out of them
Yes shure they are
Will you ever have packages that can be bought with either in game current or IAP? "Costs 10 gems or $2.99"? You could include two cost fields in the SO for each type of cost, with some kind of "not valid" value for each (maybe -1)
No i dont think i will
in the last week or two
i am totally with you, what i meant was that i dont like to have a switch like an enum or bool in an scirptable object that tells the code to use/not use parts of the SO, like it would be in this case. The IAP Package needs informations like price and so on and the packages buyable by currency need the information which currency and what amount of currency. and this Bugs me because it feels a bit messy
but maybe i have the wrong attitude here to
It's actually only been 3 days ... it does feel like it's been a few weeks though.
Yeah, I understand what you mean, and I'm saying embrace it.
However you can use SO inheritance, but I don't think it's a good fit for this problem
Nice. Guess it's been a long 3 days
If only scriptable objects could have components
With serialised reference theypractically do
Someone just has to make a generalized package for it and put it on GitHub
You can have scriptable objects with plug-ins. Obviously not unity βcomponent β but of your own design.
Does anyone know if its possible to run a game via the console?
So in other words, i have a game that doesn't have support for dedicated servers yet and only has the possibility to host games as both a client and a server. So i was thinking if its possible to just run the game in a console window and instead of using user interface inputs, you write in the console what input you want to do? For example to host a server normally i need to press on a host server button and then adjust the settings i want for the server. Would it be possible to someone run this in a console window and call the host button click function and then changing the settings from the console and hosting a server this way instead of having to use the gui in the game to do so? Or am i just saying nonsense right now π
You can run a Unity build "headless" using the -batchmode command line argument. As for passing input, you can parse your own custom arguments by accessing them through Environment.GetCommandLineArgs()
Sweet thanks π
hello
I'm looking at the docs for SerializeReference, but I don't understand its purpose. Could someone translate to Idiot for me please?
i.e. what's a use case?
Does it just let you reference things that don't derive from UnityEngine.Object?
it serializes your field as a ref type rather than value type
hahaha, helpful
Ah, thanks
I looked into using them to handle serializing polymorphic stuff better, but ended up just going with odin. IIRC the main uses are that it can serialize nulls (which normally unity serializes as a default) and interfaces, so you could have List<IAttackable> with various attackables and unity would serialize that as a reference, which wouldn't work with normal serialzation.
Ah, ok. Thanks for the use case
I was hoping to write an edutainment kind of game. Do any of you know if there is a way to have a in app/game runtime c# compiler
Hey guys, can someone tell me why this throws a transform out of bounds error at line 28
Think there's an asset that'll do it using Roselyn
that's because you refuse to debug it
how do I debug it ?
Go to beginner code and follow the pin for setting up debugging. alternately just Debug.Log(i)
i is larger than the number of children so you need to find out why
maybe it's because it persists between loops? I forget
okay so I did the debugging
and nothing happened
I still got the error and and I'm not a little bit wiser
thanks for the help though!
what do you think is happening on line 28?
get child of index i of the gameobject the script is attached to
you remove a child on every loop
and set its parent to the childRotator of index i
...and what are the values of i and when?
That is perfect. Thanks for the tip.
oh you are moving the children around, yeah that's breaking it
@long ivy oohhh... hang on I think I get it now
that's right
duh I'm a dumbass
thank you!
I moved it over to physics
hey all, anyone got like quick and dirty way to make a save file with nested objects?
You can use System.Runtime.Serialization like so:
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(stream, myObject);
stream.Close();
- Also there is Message Pack https://msgpack.org/index.html, if you want the resulting files to be smaller and serialization to be faster.
- Other than that... if your objects can be mapped to JSON, just use Newtonsoft.JSON
- Or keep your game state in a SQLite database and use the data-file as your save-file
@compact ingot im just serializing poco classes, do I need to tag with [serializable]
I'll move to a db later
when the game is nearer completion
i just need a persistent state first
its good practice... depends on the serialization method whether or not it is required
quickest/easiest way to save objects with primitive types, arrays, dictionaries and such is Newtonsoft.JSON
This is like, the opposite of advanced code. This is barely even beginner
I answered you in #π»βcode-beginner
!warn 219192399103131649 You've been told already to not cross-post.
Dallen#5711 has been warned.
Then maybe you should read it and stop wasting everyone's time
make a vector3
question answered.
If only you'd thought of using the world's biggest repository of information rather than spamming your beginner question everywhere
I did.
@scenic cedar #π»βcode-beginner
But since I didn't literally write your code for you you haven't accepted it
Piss off
Keep it civil, please.
That's not going to work on me. I don't need to prove myself to some kid who can't google how to make a vector
@scenic cedar Last warning. Continue in #π»βcode-beginner
@scenic cedar Cleanup your bio as well, or you will be removed from the server.
It's actually a drawing of me I got done by a professional animator I met at a convention, but still, keep shooting off and not solving your problem. You've also chosen to post this in #archived-code-advanced where all the helpful people reside, and started shitposting, preventing any of us from wanting to help you.
Have fun googling, and remember to post in #π»βcode-beginner when you have no idea what you're asking about
There is, and there is
It's a lie
@scenic cedar There's no NSFW content on the server. Read #πβcode-of-conduct
!ban 219192399103131649 Ignoring warnings.
Dallen#5711 was banned
And there was much rejoicing
missed it
@winged mirage Don't crosspost, you have this in #archived-code-general.
k
Hey guys, I have an FOV mesh for a 2D game to simulate a fog of war; does anyone know the best method to smooth out the shape of the mesh when moving around? Due to the fact it sends rays at intervals, and the walls are square, it sometimes creates little diagonal sections that go through the walls
you might be interested in this: https://ncase.me/sight-and-light/
JsonUtility
Why can't I make an API call in my Unity game server when running in a docker container?
From the container to the outside or from the outside to the container?
queue your calls as delegates and process them in main thread update
container to the outside
no, I'm using Async Await
And what are you failing to connect to?
error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED
this is the error I get..(the API calls are happening via AWS SDK)
is this a TLS verison mismatch?
async await should be fine too
you can bypass it if you don't want to see this
how to bypass it?
the problem is, that's the exception being thrown
so my API call to AWS fails (btw, this works just fine in editor or on an ec2 instance, only container is the issue)
- create a new class
AcceptCertificateinheriting from CertificateHandler - override ValidateCertificate boolean method and return true. it also takes in some parameters don't forget to implement them just for function templates to match
- uwr.certificate = new AcceptCertificate();
uwr.certificate = new AcceptCertificate(); I run this right when my game starts so I can start making my API calls?
That's not a great idea, you'll accept any ssl/tls certificate
yeah, thought so
yes that's a point too^
but the error message is straight forward. there's nothing much you can do in code
hmmm
wait so how are people actually using the AWS SDK if this is such a prevalent issue? what?
you have to request ssl/tlsl for aws. I don't use aws but I know lots of people who do
I'll probably do that later, i found the link: https://aws.amazon.com/certificate-manager/
But just a question (Just to get this working for now)
UnityWebrequest doesn't have a property called certificate. So I can't set it
it exists for instance
https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html
you need to re create a new certificate everytime and dispose it when done
But how does this work? I'm not doing UnityWebRequest.get..
I'm calling the AWS SDK's methods
can you modify the sdk?
if you have the source. if not then maybe use your own method?
again the correct solution is to fix your ssl/tls
also, just a conceptual question
Why does this issue not exist on my editor/ec2 instance (This is my server build)
But only does when I deploy my build into a docker container?
no idea. if you're interested into digging more just go through the certificate data. that gets validated.
but again since you don't have access to sdk it's a closed box and I can't really say what's happening underneath
Look at the certificate chain
So I was wondering, I am making this top-down 2D shooter against zombies type game, and I have these guns that I want the player to be able to pick up, and drop whenever they want, I also have UI to sync with that.
I already implemented this twice both working but what worries me is the way I organized it.
Earlier I used to have one script that did everything on the gun, but now I've separated it into the scripts the gun holds, one for when the gun is on the ground and one for when it's in the player's hands (they both enable and disable each other when needed).
I don't know if either of those are the most optimum way of implementing it and I'm spending a lot of time worrying about that so I wanted to know what you guys think about it
I would spawn a prefab when you drop the gun with the appropriate data and scripts related to picking it up, and have a simple PlayerWeapon component on the player that gets fed data when you pick the prefab up.
Assuming itβs one of those games where youβre constantly cycling through guns because of ammo and whatnot
That sounds like a pretty good idea, I think i'll implement that thank you
you have to install the certs for ubuntu
because the certs don't exist inside an ubuntu container
not "your" certs the root certs
they don't exist
apt install -y ca-certificates on ubuntu
i don't think a unity binary will run on alpine at all, but if it does, apk add ca-certificates && update-ca-certificates
you will never have a viable long-running unity binary in a container, if you are planning to run an application this way
it will eventually stop responding due to an exception or a memory leak
does anyone know what the implementation of the render loop is? in pseudocode
render all the active cameras
did the time to render exceed the budget allowed by target framerate?
if so, skip rendering for some time
otherwise, wait
use scripts in the scene to control what happens visually in the scene and interact with physics triggers. the logic of when a gun has to fire or how many bullets you have should live separate from the monobehaviour, it can live in a giant class with all your other player functionality
so your gun script might look like
shoot a bullet ( size, speed )
look at ( world space position )
drop ()
pickup ()
your game logic script, which it will be apparent covers many concerns besides guns, will look like
whenever the player clicks left mouse button,
query the currently equipped weapon
decrement its ammo
gun.shoot a bullet ( the bullet size, the bullet's speed)
if the player has run out of ammo, drop it
whenever the player runs into a pick-up
is it a gun? equip it automatically (gun.pickup) and fill its ammo
...
the place where those events are handled doesn't matter, you can call it whatever you want and put it anywhere that makes sense to you.
you can do it cumbersome and try to do it in an Update loop or using c# events
has anyone of you worked with UnityAtoms before? I mean, I like the micro-component modular approach, but doesn't that end up being counterproductive on performance and legibility?
UniRx is better
programming visually, like authoring a state machine in the editor, is a mistake
does that make sense?
Hi there, is this the appropriate channel to ask about some problem regarding custom undo actions for an editor? Not sure if that should go into #βοΈβeditor-extensions
It would go into #βοΈβeditor-extensions
Thank you :)
I'm changing between windowed and fullscreen by setting Screen.FullScreenMode to exclusive then doing a couple of wait for end of frames and then setting the res along with the screenmode. If I set my windowed game to certain resolutions (720 for example) and then go into fullscreen the monitor does not resize, the game window jumps over to my other monitor and all hell breaks loose. Does anybody know a good way to fix this? I'm on 2019.4.19f
I found a few people with similar issues and they set the fullscreenmode first and then set the res directly or did what I am doing with the coroutine, it still really doesn't like certain resolutions though and once its in limbo its hard to get it back working on the original monitor
hi everyone, has anybody tried to add nft to their games?
would it be worth it?
Are NTFs those weird crypto related things?
Good question. How many gamers are also crypto-fans ?
For now all games trying to implement them are scams
are you experiencing this issues on windows directx or macOS?
it isn't worth it no
Is there a way to either AddComponent faster or Activate Gameobject faster? Maybe even using Jobs etc.
Windows
Hello,
I'm working on a game that has minigames and I'm trying to figure out how to store persistence data for each level.
I already am using scriptable object to store information about each minigame like(Tutorial texts and so on) but would it be a bad idea to store persistence data in it too when game loads
for something this simple use playerprefs and serialize to json
I have different gun types, so would I have to handle all of them in one PlayerWeapon script, isn't that a bad idea or is it fine
also there are many properties to my guns (around 15) so should I be copying from a holding script that has to be able to hold all this data ?
maybe do... less of it?
135 GameObjects being activated each frame?
Can that be cut down?
Well I wanna be able to shoot through 50 zombies with full bodie parts.
I am trying to cut that down which worked rn while I dropped the number from thousands, its now rocking over 300fps casting each frame on around 700 "fake" zombies for testing.
so what are you adding ?
I wonder if Instantiating Fake Colliders through Jobs would be faster than Re enabling colliders
component wise
well I tried two types, AddComponent<CapsuleCollider> and now GameObject.SetActive(), currently SetActive is looking worse as it has to disable/enable all components on the object each time
now I am lost, gotta check in actual project, it was first thing I tried but for some reason it was still updating the Physics.SyncColliderTransform and Physics.SyncTransform which took tooooo much time and was hell of a spike at each fixedUpdate
In this project it does not seem to do the same thing, thats why, maybe animator updates it dunno gonna check now
anyone here have any decent setup for Integration testing with unity?
decent as in not misusing the Unit tests Framework for integration tests
you should have one script that does all the rendering for guns, and something else that deals with the gameplay business logic of guns
some stuff like shooting bullets, enemies do too - so make a BulletShooter script for that sort of thing
think about separating the visual / scene-interacting stuff into small pieces, and the logical stuff into big pieces
Usually you use inheritance
For my gun system, I thought I had this brilliant idea.
Basically I have a gun class that does everything a gun does, and I wanted an array of those stored in my weapons manager.
Then I have this gameObject with a weapon script that loads the desired weapon when asked for it.
Only problem is you can't create an array of monobehavior because you can't create them using the new keyword.
So I hope there is some kind of alternative method to achieve basically the same thing since i'm new to some of these concepts
Haven't tested yet, but https://docs.unity3d.com/Packages/com.unity.automated-testing@0.6/manual/index.html
Granted that does use Unity Test Framework, but not sure what the issue with that is. I don't think integration testing should fundamentally be that different from unit testing.
is this the channel to ask a performance related question?
if it's related to an advanced programming topic.
this is the script that I'm using for making my player object float up and down
https://paste.ofcode.org/6gCvaQhztaznd7dHPuM292
This is the script I'm using for moving my player
https://paste.ofcode.org/DP3MSTUawPmSp4uYMhVZ6Q
basically,what I wanna do is make the player float while moving . But what happens here is that, the player doesnt float up and down when I move it. When any of the keys WASD is pressed up, the player snaps back to the original position where it was before.What do I do?
@winged mirage just combine the float vector and the move vector and then call move on the cc
advanced code btw
What, why? Memory leak for what? PlayFab suggests using Linux containers to host my game server builds, they've probably thought of this
Hey guys. I have a code gen during build time, I generate assemblies for specific targets as a pre build step. So for now the only working solution to get that in the build is to generate that stuff right in the project Assets folder, or subfolders, which I don't want, cause it produces pretty noisy output, don't want to pollute the project folder. So I'm trying to make this work when generating these say in Temp folder.
The thing is, I don't see a public API which would allow to tell the build toolchain what managed dlls it should reference and include in the build. Is there a way to do so?
I'm trying to hack it some way through reflection adding it to this dictionary UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.Instance.PrecompiledAssemblyProvider.m_EditorPrecompiledAssemblies but looks like its not enough.
Maybe anyone have any clue where to look or what I am missing?
I wonder if it just takes everything references in library/scriptassemblies
Last time when I tried to put the dll to that folder it wasn't picked up by the toolchain. Looks like it cache it somewhere during the build and just don't reload on the fly after prebuild step
Hi, does anybody know what is required to handle abilities going off on the same frame?
Let's say for example one character hits another with an ability that does damage based on the target's current HP, but on the same frame the target uses a self-heal. I would assume that the game would randomly choose the order, so it could do the damage before the heal or after the heal, which if done in a multiplayer P2P environment could desync things.
I think it would be best if any abilities that happen on the same frame act as if other abilities hadn't gone off to prevent inconsistencies.
So these are native DLLs?
nope, managed
But are you building with IL2CPP?
Yep, I actually need this for il2cpp, to compensate lack of the runtime reflection, I just pregenerate stuff during the build step
There's this build event you can hook into
https://docs.unity3d.com/ScriptReference/Il2Cpp.Il2CppBuildPipelineData.html
It happens before IL2CPP starts and it gives you the folder of assemblies it will convert
Sorry, this is the event
https://docs.unity3d.com/ScriptReference/Build.IIl2CppProcessor.OnBeforeConvertRun.html
It's an interface you implement in any editor script
Oh nice, thank you. I guess that's what I was looking for
I'll try that, thank you very much
But it's not documented if it allows for adding new assemblies. But if it's giving you a folder path, I would assume it's going to read all the files in that folder.
Yep, that's what I think. I hope it calls that callback before reading the assemblies, so I can just sneaky copy my stuff there
P2P complicates this. Is there one client that has authority or?
Only thing sent is input, each machine simulates the game individually.
Using Photon so there's a relay server.
Best thing I can think of right now is getting the stats at beginning of frame, then waiting until end of frame to execute the ability.
Aren't you always going to get desync issues if the clients are all simulating the game individually?
Even just one client getting a message a little later than the others could have major consequence.
Or is this not a realtime game?
No, so inputs are only sent once every 6 seconds.
I'm doing it this way so I don't have to deal with rollback and stuff.
Also makes the game have a different dynamic.
Was going to do it realtime but didn't want the game to be about APM while still being about quick thinking.
So when you talk about things happening in the "same frame", you're talking about within these 6 seconds?
Not exactly, so inputs are sent, then the actions happen over the next 5 seconds, just before the next "turn" starts.
So the actions are realtime, but the inputs aren't.
If that makes sense.
It sounds like you have to make sure all the clients agree on the exact order of the inputs, which is easier to do if you have one masterclient calling the shots, which Photon has.
Well the inputs are literally just saying what ability you are setting up, which can happen on the next turn or several turns later. So syncing the inputs are not the problem for me.
That works perfectly fine.
I'm just trying to futureproof things so I don't have inconsistent abilities.
The way the game works is 90% done, just a matter of getting the ability casting working and then creating content.
So right now I can have a unit damage another and both get damaged correctly on the clients. No desync.
Maybe the word "inputs" is confusing me. Can these be considered higher-level "actions" each client is making, as opposed to lower-level hardware input?
So actual input (as in navigating menus) isn't replicated, my definition of input here is just the abilities that are being used, the targets involved and how many turns it will take for the ability to trigger. Sorry if I made it confusing.
This info is sent every 6 seconds.
And the next turn won't start until your opponent's input is received.
So there's no worry that there's any desync regarding what abilities are supposed to go off on what turn, but the worry is for abilities that go off on the same turn?
The worry is for abilities that go off on the same frame, because the order that they happen in may be out of my control. I think that getting the stats at the beginning of the turn, then waiting until the end of the frame may be the solution though.
If you have one ability go off 2 seconds into the turn, then another 3 seconds in, that's fine. But if I have 2 abilities go off on 2 seconds and the order affects the outcome of the other, that's the potential issue I see.
So it doesn't matter exactly when each client chooses an ability? Say you choose an ability with a delay of 2 seconds, you could choose that ability anywhere within the 6 seconds and it will always go off at the same time in the next turn?
Yep, the time you select the ability doesn't matter, only that you selected it by the end of the turn timer.
How exact can these delays be? Are they always integers or can they be any fraction?
Well, the turn delays are integers, the actions that actually happen on the turns are made up of AbilityEffects that do different things based on actual time, so that would use floats.
It sounds like you can resolve any possible desync issues if all the clients agree 100% on the abilities and their delays at the start of each turn. I don't know how you're implementing the delays, but you could use Script Execution Order to define an explicit order the abilities update their timers.
What what that order should be is more of a game design question
I don't want there to be an order though, that's the thing. I want abilities to go off based on what the unit was like at the beginning of the frame, regardless of what abilities go off that same frame. So that's why I'm thinking WaitForEndOfFrame is my friend here.
I didn't think about that until after I posted the question haha
I get the unit info when the ability executes, then after all abilities have the correct info, they do their thing independent of each other.
That way, an ability that depends on a target's health, for example, won't be affected by a heal that happens the same frame.
That's my theory anyway.
This is obviously a fringe case, but it's important.
But won't you have to combine them somehow? Like a heal and damage happening at the same time, the order will matter. For example, if you heal at max health, your health won't change and then you take damage. Versus taking damage first and then healing.
That's what I want, yes.
But you said you didn't want an order
Sorry, let me elaborate.
So the damage happens based on the full HP. The heal also happens based on the full HP, regardless of the other ability. The order doesn't matter because they're both doing their thing based on the unit's health at the START of the turn frame. So no matter if the computer decides to do the heal first then the damage first, or the other way around, the outcome will be the same.
No healing is done because the HP was full, and the damage done is based on the HP being full.
Even if the heal happens second.
Did I explain that right?
I understand. As a player, I'd be kinda annoyed that my heal wouldn't work in that case, but assuming it's rare that abilities go off at the same time and it's all being played back in realtime, I probably wouldn't notice.
Like, isn't part of the game anticipating what your opponent is going to do, so it's valid to setup a heal even if you're at full health?
You wouldn't really notice, the ability would go off the same frame, so the floating heal number would just show a 0 and the damage number would show a red damage number at the same time
Yes it is.
But I guess you could also say that understanding ability timings and interactions is another higher level aspect of the game.
I don't expect my game to be completely unflawed, but I think this is the best way of handling it.
Does anybody know a fix for exclusive fullscreen mode not working at certain resolutions and jumping to the other monitor in a dual monitor setup? I've tried setting the mode and then the res one after another, the modes is set in the player settings, I've tried coroutines with waits inbetween, nothing seems to work but only at certain resolutions. I have a 2k monitor and its fine with everything until a few options before 720p at which point it freaks and starts showing on both screens with no input and will minimize each time you try to interact with it
I don't want to get into having abilities having different priority levels for same-frame stuff because that's just a headache to learn as a player and would feel inconsistent.
At least the player should know that if two abilities happen at the same time, they happen based on if no other abilities have been used that turn. It's not perfect, but it's consistent and easy to understand.
Are the players choosing the exact ability delay, like with a UI slider?
No, the delay is static.
Different abilities have different delays.
Some are telegraphed to the opponent, some are hidden.
It's basically a twist on Pokemon Triple Battles.
I'm pretty happy with how it's turning out.
Thank you for discussing this with me, it's really helped me evaluate what I'm trying to do.
Hi guys,
I'm working on a multiplayer project in Unity using Photon and Agora.
The issue I'm facing is if I disconnect and reconnect my bluetooth headsets while playing, the overall game volume gets reduced.
I've tried to check if audiosource volumes are getting affected upon disconnect/reconnect but that doesn't seem to be the issue.
The phone volume also remains the same.
Any help would greatly appreciated. Thanks
I would personally just pass the data through, like ammo count, fire rare, sprite, etc. Make it generic and modular.
Im using asmdefs from unity and installed a nuget packet called "System.Runtime.CompilerServices.Unsafe" from rider...
However when i import it in my code and unity refreshes, unity tells me its unknown ( the package and its classes im using ). Any idea how i make this work ?
Any help welcome
did you reference the new assembly in your code's asmdef?
is there anyway to expose the PxController::setUpDirection(). function
to rotate the character controller
what is PxController?
Oh - PhysX CC?
Only way to expose it would be to modify the core Unity C++ source code I think, which means paying them for source access.
If you had source access you might find that Unity does that automatically if you rotate the Transform, but unknown without seeing the code
what happens if you rotate the transform? Doesn't it rotate?
or does it never tilt?
I forget how it works
Ok yeah I don't think you can tilt it
unfortunately
Asking here because it could be somewhat advanced :
Do you think action games like witcher, dark souls, etc uses melee colliders attached to weapons/claws/arms/any hurting part or just "area of damage" in front of the player/monsters ?
And if they use the first method, what about fast animations that can "miss" the target if it happens to be positioned between 2 frames of the animation ? Do you think they interpolate the collider to cover the whole swing area ?
Depends on the game and on how recent it is
It hasn't been that long until it was possible to do that
But yes, more recent games do do that
I just ran into the problem where I missed my target in my project, so I'm wondering if I should interpolate my colliders too. I really don't know the impact on performance of creating "virtual" colliders.
I know that Mortal Kombat 9 had attached to limbs during the animations. Because of this, certain characters that had drastically different costumes (such as Human Cyrax and Robot Cyrax) actually had different frame data. I also know that Zelda: Ocarina of Time had similar due to a speedrun tech called "Infinite Sword Glitch" that keeps your sword "active" while you're not swinging it, letting you damage enemies by rolling into them or grabbing a ledge near them that makes them contact your sword's model.
I'd say attaching hitboxes to animations is more common in professional games than doing an area-based hitbox
Depends on what game that is, a lot of games shifted to ray based collision detection
The witcher, mordhau, m&b i think
What I do is I change the size or enable / disable more colliders if I need to cover more space between frames.
Similar to how the Smash Bros games do it, here's one example of what I mean: http://meleeframedata.com/falco
Lingering hitboxes feel great on swords as they swing, like expanding the collider to cover the entire sword when it smears (if it's a 2d animation) kind of feels right.
Hmm I don't even know how to do that for melee attacks, I need to do research on that then
So you have a list of colliders attached to the character and you activate the one you need depending on the animation ?
Something like that, a sword slash could be a circle on frame 1 to 2, then a circle + a capsule on 3 to 6 and etc
Ok, this seems pretty long to setup no ?
You can always have them activated as capsules then, stretch if needed in the animation. That is easier to set up since you don't have to swap back and forth enabling / disabling them.
Look at how Marth's hitboxes were done for Super Smash Bros. Melee as an example: http://meleeframedata.com/marth
Precisely at his forward smash and aerial attacks. If you click the gif you can check frame by frame
Yeah but I don't even know how to automate that.
Hey folks, got a little question about memory allocations and resource loading.
If I call "Resources.load" on a resource that has already been loaded, am I going to incur additional allocations?
To give you my specific example, I am attempting to load a SpriteAtlas from my resources folder. The purpose of this load is simply to read some data from the atlas (E.g Num of sprites) for another process, and not to assign the atlas to any sprites etc. It is almost guaranteed that at the point where I call Resources.Load, the atlas will be in use by gameobjects in my scene. So when I call Load at this point, will I be creating an entirely new instance of the Atlas, or will Resources be passing me a pointer to the existing instance being used by my gameobjects? (I'm hoping the latter)
If anyone knows, I'd apprecaite the info π
I'm using several linecast (3 to be exact, blade tip, blade start, and between the two) that each scan from last weapon position to current weapon position for my prototype.
I was thinking about something like that, but with a capsulecast or spherecast (to avoid having to do multiple raycasts)
But your version is probably better for complex weapons like a whip
Well I could use multiple capsules too
Hi, i have an object which is being aligned to terrain every frame by following, where hit.normal is the local terrain normal
Transform object = ...;
object.rotation = Quaternion.LookRotation(object.forward, hit.normal);
now i am trying to rotate the aligned object around its local up over time. I tried using
object.Rotate(Vector3.up, Time.deltaTime * 90f, Space.Self);
but it's not working correctly. Do you have any ideas on how to fix this? π
maybe instead of Vector.up use object.up?
Already tried that, not working either :/
Hmm maybe object.rotation * Vector3.up ?
im having an issue with accelerometer input
is there anyone who could help? i am trying to make it so that when the user walks, the capsule (which represents my player), moves in space just like the user
the issue is that whenever i stop my phone (after moving it), the capsule just keeps going
i cant use friction though, because it will slow down my capsule when it walks too
i know im asking for much, but if anyone could get in a call with me that would really be helpful
i have an idea
Is your preview object the children of something ? Try localrotation * Vector3.up maybe ?
the way to stop something from moving is either directly set its velocity to zero or apply a braking force ( a force opposite the current direction of motion ). Those would be my suggestions. Friction is an example of a braking force that is more or less built-in, but you can apply your own braking force in FixedUpdate. For example when there is no phone accelerometer change happening, you can apply a braking force.
I'm getting error cs0029 in this operation:
_isUpPressed = true;
that variable is of type BoolReference, defined as follows:
` public class BoolReference
{
public bool _constantValue = false;
public BoolVariable _variable;
public BoolReference()
{}
public BoolReference(bool value)
{_constantValue = value;}
public bool Value
{
get
{return _variable == null ? _constantValue : _variable._value;}
set
{
if (_variable == null)
{_constantValue = value;}
else
{_variable._value = value;}
}
}
public static implicit operator bool(BoolReference reference)
{return reference.Value;}
}`
And BoolVariable is as simple as this:
public class BoolVariable : ScriptableObject {public bool _value = false;}
so, how can I overload the assignment operator for implicit conversion, in that case? Any hints?
you need an implicit operator from bool to BoolReference
you only have the other way around
hi guys, i've made my 2d tile map procedurally using meshes. adding collision in a 3d sense was no problem but i want to make it so my 2d sprite character can't stand on certain tiles. whats the best way?
in the sprite editor you can add a custom collision shape for each sprite
im just using microsoft paint at the moment xD
oh are you not using Unity's Tilemap?
no im procedurally creating meshes by assigning vertexes into quads
thats why i posted in the advanced one, couldnt get any answers from the 2d chat
then you'll have to figure out some way on your own of generating 2D colliders
yea ok ill keep hunting then, thought i'd ask here
maybe generate a PolygonCollider2D dynamically
You should be able to generate a PolygonCollider2D from a list of points
hmmm thats a shout, ill keep that in mind on my google hunt
thank thank
hey guys, i've encountered a problem with my player's movement, i have a script that when i press space, the player dashes in the direction of my joystick (a coroutine gets called and it linearly interpolates between the destination and the current position by Time.deltaTime), here's my code:
public class PlayerMovement : MonoBehaviour
{
[SerializeField] float movementSpeed;
[SerializeField] float dashSpeed;
[SerializeField] float dashDistance;
[SerializeField] float dashCooldown;
Timer timer;
Rigidbody2D rb;
void Awake()
{
rb = GetComponent<Rigidbody2D>();
}
// Supposed to be called in update but for the sake of debugging I put it here
// Dashes diagonally
void Start() => StartCoroutine(Dash(new Vector2(1, 1)));
IEnumerator Dash(Vector2 direction)
{
for (float t = 0; t < 1; t += Time.deltaTime * dashSpeed)
{
rb.position += Vector2.Lerp(rb.position, rb.position + direction * dashDistance, t);
yield return new WaitForEndOfFrame();
}
}
}```
now the bug happens when i set dashSpeed to anything higher than about 2.5. if i set it below that the player will dash diagonally with no issues, but if i set it to something like 3 the player will only move a little bit and then stop abruptly. not sure why this is happening, if i print t during each iteration of the for loop i get 0, and then 0.3 in the console. never goes above that.
@solar parcel you're abusing Lerp
could it be that t goes over 1?
Yeah it's likely that t >= 1 in the first few frames, hence the max value being reached for the lerp and the sudden stop
Try putting an f after the 1 in t < 1, maybe it's reading 1 as an int?
hmm, what if i try doing t += 1 / Time.deltaTime * dashSpeed ?
@solar parcel
try:
IEnumerator Dash(Vector2 direction) {
Vector2 startPos = rb.position;
Vector2 endPos = rb.position + direction * dashDistance;
for (float t = 0; t < 1; t += Time.deltaTime * dashSpeed) {
rb.position = Vector2.Lerp(startPos, endPos, t);
yield return null;
}
rb.position = endPos;
}
er, one sec
I missed the dashSpeed
Speaking generally, which one is better to use: Using your custom solution or ENet
trying it
also a bit incorrect, since you yield and wait for the end of the frame, and enumerator will continue in the next frame and then add deltaTime (from new frame) to t; but I guess frames are similar so... not a big problem