#archived-code-advanced

1 messages · Page 52 of 1

undone coral
#

i make a multiplayer technology, it is really well suited for use cases like this

glossy harness
#

but i decided to settle on Netcode for fame objects

undone coral
#

but it doesn't make sense without all the other pieces coming together, especially polish

glossy harness
#

yeah I agree, most our games are going to be simple physics based one button games

#

think racing games and simple top down shooters

undone coral
#

in this framework, you stream all the players from a single unity process. they all have different cameras, screen resolutions, inputs, or whatever. but you engineer a local multiplayer game, and the simplicity of that, including plain physics and something you can easily test in editor, and then you get poof, a multiplayer game

undone coral
#

from a project that uses this

#

i'm not saying this makes sense for you, but this is to provide some background on the advice i can give

glossy harness
undone coral
#

yes, a colleague and i. mediamonks, the studio that made that little clicker oreo game, was 1 guy and made a bug free instant matchmaking multiplayer game in 5 weeks

glossy harness
#

I was originally between writing my own UDP game server, and protocol with ProtoBuf

undone coral
#

here's one with a car. it's not multiplayer, but you'll get the idea

#

this is only possible because there's no networking. i mean it is networked, it is you receiving a video, and you send back inputs, and so two people can be in physically remote locations and it Works. but from the point of view of what you author, it's a single unity process, with two players in it, and it uses bog standard unity features to make it all work. so setup is 1 script

#

if you want more players, you literally duplicate them.

glossy harness
#

interesting, whats the latency on something like that

#

(assuming the server is close to the clients)

undone coral
#

i guess you should try to drive the car there and see if it matters

#

but no, i wouldn't make an fps on this platform. the latency is XXms, and after a million people have visited these experiences, it still didn't seem to matter, as based on an original test on 1,000 players. you will probably experience 40ms in the US.

glossy harness
#

yeah, at least on mobile the latency is way too high for our needs

undone coral
#

the million people came from FB and instagram - these are used to make branded minigames that roll inside social media

undone coral
#

i think people in the know, who have actually tested this stuff, like the unity parsec folks i met just yesterday at GDC, all agree that this is an overrated concern

glossy harness
#

Well if you can bundle local latency prediction with this that would be amazing

#

but you mentioned its just a video stream essentially

undone coral
#

what i'm trying to say is for a real audience, there was no statistically different level of engagement between 40ms and 180ms

glossy harness
#

kinda how those game streaming softwares work right

undone coral
#

which is about the range of experiences

#

it is a valid concern, it is just one that has been investigated and turns out not to matter as much as it seems

undone coral
glossy harness
#

the games we are trying to build are going to be inherently competitive

glossy harness
undone coral
#

i am not saying this is right for you

glossy harness
#

yeah probably

undone coral
#

i am giving you my background knowledge, that i have thought about this a lot

#

that is a more realistic estimate*

glossy harness
#

Appreciate the insight

undone coral
#

usually when people hear that they tune out everything else i have to say

glossy harness
#

well we dont have have a year

#

but we can cut “some” corners

undone coral
#

indeed lol

#

you are not going to have a working realtime multiplayer game that is robust like a CIE games racing game is

#

in a year

#

that's just reality

glossy harness
#

our racing game is super simple

undone coral
#

i can ping people on this chat too, whom i say these sorts of predictions to, in case you doubt my assessment

#

everything sounds simple in principle.

glossy harness
#

I don’t doubt,

#

But im not discouraged

undone coral
#

one of the worst places to be is to do this sort of psychological warfare

#

you've hit the things on the bingo card

#

to psych yourself into doing this sure

#

and yes, a lot of games still get made if it takes 2 years instead of 1y

#

that's fine

#

that is the journey ahead

glossy harness
#

Makes sense, but we do what we gotta do, even if it takes 10+ hours a day 😵‍💫

undone coral
#

there's a reason there are few realtime multiplayer competitive games generally. and the ones you play are made with multi-million dollar budgets. and here's the thing, if robust doesn't matter, make a simpler game

#

that's what i'm trying to get at

#

since you said there are two objectives

#

pick one.

glossy harness
undone coral
#

a crypto game does not need to be competitive, or even good

glossy harness
#

wellllll

#

thats kinda what we want to do different

undone coral
#

i am really familiar with the shape and size of goals that are achievable in short time frames

glossy harness
#

we are trying to establish a skill based real money gaming platform

undone coral
#

it's pretty much my supreme superpower

#

so you can tell me a concept, and i can nail for you how long it will take you to make

glossy harness
#

id love to speak about this in Dm’s maybe at a later time

undone coral
#

righ tnow i'm hearing "thing that has to work in browser" and "be multiplayer" which is already 3 months minimum

#

lol

glossy harness
#

I can do a short pitch or something, if you’re interested

undone coral
#

for 1 game, for at least 2 people, and more realistically 4

#

okay

glossy harness
#

but not rn, as I’m currently not home / texting from my phone on the train lol

undone coral
#

yes feel free to message there. that's fine lol

glossy harness
#

yeah I sent u a friend req

#

Ill dm u within an hour or two

#

but appreciate all the insight

undone coral
#

my parting message: when staring at 1y, and the focus is sort of on something that isn't going to be really responsive / knowable, like the success of a crypto skill based gaming platform... it's better to just spend that year doing something original and failing, but spending every day trying something new

#

as opposed to say, delivering something small and very robust and polished, but which has no new ideas and is not fun and has no audience, or its audience is there for a different reason

#

if you're going to do psychological warfare on yourself, do it for something hard in the sense of requiring both your intelligence and serendipity, instead of just say, serendipity alone (whether or not a cryptocurrency platform sticks), or taking a bunch of adderall.

stray pine
#

Hi, is it possible to create a dizzy/drunk camera effect through manipulating the projection matrix?

#

^ i did try to create one but the only result i could get is by stretching m00,m01,m10,m11 which doesn't really look good lol, i was wondering if i did something wrong or there is a way to apply some kind of effect to the camera like dizziness

compact ingot
#

distorting the camera matrix will probably just cause nausea in your audience, a low intensity screen shake (rotation + position) is tolerable

stray pine
# compact ingot distorting the camera matrix will probably just cause nausea in your audience, a...

well the effect i was going for is nausea, the closest thing to being dizzy, but i felt like there was a better way, and directly editing the projection matrix might cause problems for me? i don't really know much about it, i just play around with some values to get what i want.

as for post effects, i can't do them as i'm trying to target lower to middle end devices so i'm trying to limit them as much as possible.

stray pine
compact ingot
stray pine
compact ingot
#

anyway, you can take it or leave it

stray pine
#

and besides that, i was just wondering if i could apply some kind of effects to the camera without using post processing, through coding or another way

hardy sentinel
compact ingot
hardy sentinel
#

you can use the post-processing stack or whatever it's called on top of your screen-shaking shader (which can be applied to your whole screen)

stray pine
hardy sentinel
#

shaders don't change camera outputs, they just do operations based on input 😛 So at best they can output a texture

compact ingot
#

but the possibilities with those are very limited

hardy sentinel
#

if, however, you input the camera's output texture to the shader, have it operate on it, then read that texture and render it on screen, you pretty much have post-processing

stray pine
hardy sentinel
#

and the material can use whatever shader u want -- even one that was made via Shader Graph

vale spindle
#

i'm interested in coding navigation graphs or nav meshes / volumes. not saying i'm going to do it, just want to see how it works in script. but all i can find is explanations of how it works in engine.

errant plinth
#

Try googling with pathfinding navmesh algorithm

lone fog
#

Hi everyone !
So this question might be basic knowledge haha I have no idea how to go about this.
So, context : I am finishing to develop a game for clients, that have bought Naninovel, an asset store engine to make visual novels. They want to make a mobile visual novel game, you can choose the story to play in the app part of the game then the Naninovel engine runs the visual novel scripts.
So, in order to save some things, like unlockable items unlocked, one artwork being given to the player, etc, I have made custom commands for the visual novel engine, which can be used in scripts. In those commands, I make Rest API calls to save the game, the items owned, etc.
The problem is that making those API calls during the visual novel script execution just freezes the whole program (even my editor is frozen - when enabling the profiler window, everything freezes and the profiler records like 2-3 frames of big CPU usage, which take ~10 000ms to complete.
I tried many things, first I tried to make a class that would receive events when each command is executed. Then the events execute the functions and make api calls. So that it shouldn't block the rest of the code to happen, since the event is fired and not awaited for (right ? I use Invoke, so maybe that actually awaits for the event to be finished ?)
Then I tried to call the functions in coroutines. This doesn't work either.
Then I tried to call the functions inside a delegate in a task, like so : Task.Run(delegate { MyFunction(); }); which doesn't seem to not block the rest of the code...
So main question : how to start a function without waiting for its execution ? Make async functions and not await them for example ?

mortal gust
midnight violet
undone coral
#

you should use unitywebrequest

undone coral
#

so it sounds like it's a lot of bugs

lone fog
#

Ok so I'm not using either UnityWebRequest either http client, I am using a SDK generated with swagger's codegen. So yeah the requests aren't made in a unity friendly way maybe..
The 10 000ms time to execute is the "Scripts" on the CPU usage on the profiler (it's my first time using the profiler so I'm not sure how to see what takes this long). I attached a screenshot, but I see that there is script work at the start of my player loop and right at the end, maybe it's just the freezing of the editor & profiler that makes the frame take 10 000ms to be finished ? not sure at all

undone coral
#

are you aware that openapi generator has a unity web request based generator as of 3 weeks ago?

#

we already know what your problem is

#

second question - have you been relying on chatgpt to help you program at all?

lone fog
#

I did not know 😮 that would be really convenient lol

lone fog
undone coral
#

no

#

i'm not suggesting that you should

lone fog
#

I am no expert in C# programming though, I have more experience in web dev

undone coral
#

okay well

#

you have to use unitywebrequest

#

there's nothing to do to get around this

#

you can use the master openapi generator branch, build it, and run it

#

or you can just post against the URLs because it doesn't really matter

#

it won't fill in 100% of the blanks for you to use the generator but it iwll not have this issue

lone fog
#

Okay thanks. At least it will ensure a better performance. This particular request that I made when I took this profiler screenshot holds quite a lot of data, so it might also play a role in the freezing of the program I guess

undone coral
#

you will need to build the generator, which means understanding how to install java 8, and how to disable doclint errors in maven; then you will need to actually invoke it; then you will have to add the newtonsoft json package; then you will have to use unitask to actually invoke the async methods without bugs

undone coral
#

it's freezing because you are making blocking requests on the same thread that is used to run the game*

#

the complexity of fixing what you already have will exceed the time spent doing it right

teal bone
#

the RenderPipeline class has a few callback methods you can listen to, but it's difficult finding information as to what the different calls actually are. What exactly is happening under the hood at BeginCameraRendering, BeginContextRendering and BeginFrameRendering?

#

the only one I can roughly estimate is that RenderPipeline.BeginCameraRendering probably renders the view frustum, with the stencil buffer/depth buffer related stuff? but I don't really know

undone coral
#

request that I made when I took this profiler screenshot holds quite a lot of data
this is concerning

#

are you saying youare posting image data?

#

define quite a lot of data

undone coral
#

it's also in your project folders if you are using Rider

lone fog
undone coral
#

why is it 6MB large

#

it sounds like you have at least three problems at the same time

#

it sounds like this hasn't ever been working 👀

lone fog
#

it's the data from the Naninovel engine, so I can't really change it. I wanted to keep the saves in the API so if the user changes mobile phone, they would keep their saves

lone fog
undone coral
#
  1. based on the profiler screenshot, which literally has all the useful data cut off, if that 10s bar is indeed an API call, you are observing a timeout or an internal server error or similar.
  2. you aren't using unitywebrequest
  3. you have a flawed approach to saving, serialization or similar
#

6MB is fine. even posting 6MB is fine. on a phone it could easily time out though, it could take a while to upload 6MB (10s+)

#

does it use Ink?

#

nanininonovaovvel?

#

anyway this is code advanced

#

i don't know how much progress you've made so far

lone fog
#

Sorry about the screenshot of the profiler without useful data, I don't know what I should look at 😭

#

Ink ?

undone coral
#

hmm

#

all of this is tractable

#

dont' stress

#

web development and unity development have a lot in common. unitywebrequest is xmlhttprequest / fetch. you'll observe that it's impossible to use fetch to make a blocking request in yavascript, because a browser's user code (ie the page) and a unity scene work the same way

#

but 10s is very long.

#

it means there are other issues

#

like surely you've observed calling this api without such a long time right?

#

and it wouldn't take 10s to upload 6MB

#

it wouldn't even take 10s to serialize and upload 6MB

#

it sounds like there is something in the naninovel save process that might be glitched. but it's hard to tell if that's accounted for in the 10s. you have to learn how to use the profiler to see that

#

also, when you declare this an external function, it's automatically nuanced

#

because the visual novel scripting engine doesn't have "async" as a notion, so you have to write your external function definition correctly

#

it doesn't have async, promises, etc.

lone fog
#

Yeah, usually the api calls don't take this long.
So yeah from there, I think I should generate the SDK to call the api with UnityWebRequest,
also learn how use the profiler lol
Yeah there should be problems elsewhere too. I think that I will try to optimize the code to maybe fetch all I need from the api before starting the novel engine.

undone coral
#

basically you should have something of the form

// most of these narrative engines have you load some assets
// or restore from a save file or whatever and give you a story instance
// then the UI calls `Continue` or similar on this instance
// a lot of things need access to this instance.
var story = new Story(m_NaniNovelAsset);
story.LoadFromSave(...);
...

// when you call async methods in general, including the browser
// you might have to gracefully deal with them getting cancelled
// by all sorts of circumstances
// if you allow users to switch scenes, you probably do not want to
// cancel when the object that happens to have this code gets destroyed
// you will need to cancel when application quitting is requested
// you may have to deal with the app being backgrounded, and will...
var cts = this.CancellationTokenOnDestroy();
// ...have to explicitly deal with resuming if the post file is large
// iOS and android both have APIs for these sorts of background file
// transfers and you can find a unity api for it. usually either the
// backend api is authored to support the background transfer APIs
// (which are just ordinary http conventions) but OpenAPI will not be
// aware of them. if the backend is not, then usually the way the backend
// works is the device posts to a service that does support background
// transfer APIs, like amazon S3, and then an event is fired on AWS and a call
// from s3 to your backend is made. you can't just wait for it to upload, then call
// because the whole point of background transfer is it's allowed by 
// ios and android to do background file transfers - it's not going to let you
// schedule another call to run afterwards, your application has already
// quit by then.
story.BindExternalFunction("save", _ => {
 // Forget() is a way to ignore the result of calling
 // an async method.
 // this will not block. the game will still be running when save is called
 // and by game i mean the story engine. so people can still do stuff
 // while saving is going on.
 Save(story, cancellationToken: cts.Token).Forget();
});


...
async UniTask Save(Story story, CancellationToken cancellationToken=default) {
 // so since people can still do stuff while this is being run
 // we need a snapshot of the story at the time it is called.
 // copy the story, which ought to be fast
 // we have to copy the story on the main thread (or serialize it)
 // because it isn't thread-safe. that means we DO want to block execution,
 // and the pause will last as long as it takes to copy a C# object using
 // whatever naninovel gives you
 // if it doesn't have a way to copy the story, you will have to serialize
 // directly to json on the main thread, which is very slow, and this will
 // preclude using OpenAPI, since it expects objects (it expects to do the
 // serialization for you)
 var copy = story.Copy();
 // unitask provides easy ways to switch from main thread to background thread
 // to prevent work like seiralization from blocking your code
 await UniTask.SwitchToThreadPool();
 var api = new DefaultApi();
 // this internally calls JsonConvert, which could be really slow
 // but we've moved to the thread pool explicitly for this purpose
 try {
  var saveResult = await api.SaveApiPostAsync(copy, cancellationToken);
  Assertions.AreEqual(saveResult. ..., ...);
 } catch (Exception ex) {
  await UniTask.SwitchToMainThread();
  Debug.LogError(ex);
  // handle the saving errors
 }
} 
#

a lot of the missing implementation is error handling, but it ought to be truly this succinct once you do everything right

#

and i have a feeling it is not

#

it's so much stuff

#

to learn

#

so don't stress

#

you should use UniTask

#

you have to deal with cancellation... what if the user closes the app before saving is finished?

#

if it's going to be a 10MB+ file, you are in a hard place on mobile

#

the approach will change

lone fog
#

Ok thank you so much ! I will try all of that right now ! (It surely isn't that simple right now)
Yeah it's a lot to learn lol and the game is supposed to be published quite soon. I am the only dev so it is indeed stressful lol
Thanks for your time, what you told me helps me a lot 🙏

undone coral
#

anyway i hope you didn't ask for a pathetically small amount of money to do this task

#

because it's a lot

#

you'll get it done

#

lol

lone fog
#

yeah they are running out of budget

#

lol

#

I'm not asking too much :/

teal bone
#

I've been programming for years at this point and yall are still so far beyond me it's like you're speaking latin. Crazy.

lone fog
#

But yeah really you are a saint @undone coral , now I know where to start lol 🙏 🙏 🙏

teal bone
#

I guess multiplayer is handled with web requests just like a regular web server?

#

I've not done any server stuff yet so

kindred remnant
undone coral
#

i'm going to add a few more comments

teal bone
#

every few months or so I feel like I make significant gains in understanding, but it always feels like other programmers talk about stuff I still can't fathom

lone fog
#

yeah same but at the same time there is so much to learn

lone fog
undone coral
kindred remnant
undone coral
#

@lone fog i think if you want save games to work you have to carefully read those comments

#

i mean honestly it's going to take you 2 weeks of solid focused work to just make saving the game work correctly

#

this hasn't been working, so you haven't been testing on device

#

so you haven't discovered all the challenges there yet

#

if i were you, i'd ask your people for more time

#

and it's going to be catastrophic

#

because people will be playing the game, then they'll get a text message, and they'll reply to it

#

and the upload is going to get cancelled because the app gets backgrounded

#

and these are going to be end users on android phones, which have all sorts of weird behavior

#

because it's visual novels

#

so even the snippet isn't complete

#

if it's 6MB you will probably need background transfer for end users in asia

#

if that's the audience

#

another way to do it is you background transfer the save files directly to s3, and the client polls s3 when it is launched for the firs ttime

#

to see if there are newer saves

#

if you don't have any advanced functionality related to the save files themselves, you don't need to interact with a separate backend

#

but if you use S3, you will have to learn STS (federated tokens ie authorization for client devices)

#

so like, complexity is unavoidable

#

google won't let you upload an APK to google play that has an AWS access token in it

#

in fact they'll let you upload it, and as soon as like 10 people download it, then you are booted out

#

you were basically asked to do a $250k task for whatever, $5.

#

i can't imagine how you are even dealing with auth...

#

knowing as little as i do about the state of the porting right now, your biggest priority is to have a game that actually works first

lone fog
# undone coral this hasn't been working, so you haven't been testing on device

Actually we discovered the bug while testing a build ! And I have built the game without any save or custom command in the novel scripts, which works really fine, so the problem comes from there for sure.
But yeah it's good advice ! I will talk with them on Monday since we have a meeting. In the meanwhile I will generate the SDK ith unityweb request, but yeah for now the app is in french only so we don't have to worry about asia for now.
But yeah you are right, complexity is there all the way, and I already knew that the save system was one big piece of work, but combined with the novel engine and all of that it really is a lot.
About pricing, I ask them for 150€/8h, and I know that they already don't have enough money to pay for all of the hours I already put in.. so yeah it's not the best position I'm in right now

undone coral
kindred remnant
lone fog
#

But yeah the priority is to have the game working and I think that the saves are the only thing left for the game to work in itself, all the rest is "around" the game - in app purchases, etc

#

yeah really shocking

lone fog
#

That just makes me think about how to keep variables like api keys safe ? I would have put them in an environment variable but I don't know how this works for unity games

sly grove
#

not on your client

lone fog
undone coral
#

clash royale creates you an account that is authenticated by your app+device identity. if you want to "log in" to that account from somewhere else, supercell* enables* a phone number based authentication to the same account, and from a different device, login via a texted phone number code instead

#

the "account" works the same as a username and password account. from a technology point of view, authentication (username + password, a unique device id, or a secret code texted to your phone number) is separate from authorization (the permission to do something based upon facts about you, like your user id)

undone coral
lone fog
#

btw, I just finished updating the code to adapt to unitywebrequest with the generated sdk and it now "only" takes 3000ms to do the request which is already 3x less

undone coral
#

one of the simplest ones is

  1. the user is authenticated.
  2. now, the user would like to use an s3 api directly from his device, for important reasons.
    2.1 the user requests that the server issue a piece of data that can be used to authorize limited s3 access. this piece of data is usually called a token, but a token is just a piece of text for authentication and usually a specific purpose (specific authorization to do specific things)
    2.2. the server looks at the user id making the request. then, it goes to amazon and asks for a "token" (STS is the simplest of such an approach) which grants the holder of the token the ability to write to an s3 bucket path containing the user's id. so to summarize, a token might look like
    (let's say the user's ID looks like XYZ)
{
  proof this token is real. created by amazon.
  an id used by amazon to look up the permissions granted
  to the holder of this token. this looks like...
    -> an amazon IAM policy document that looks like...
       -> grant the bearer of the STS token
          the ability to write at most 100MB to s3 keys of the form
          s3://naninovel-production/users/XYZ/*
}

2.3 the server returns this token to the user
3. the user calls s3 apis directly with the token.

#

@lone fog does this make sense?

#

if your users already create user accounts via something oidc compatible like Cognito, PlayFab, Google, etc.

#

you can instead express to amazon

call an amazon API ONCE with the following request:
 give users who have really logged into google
 that have permissions from me
   (logged into google for the purposes of accessing my game)
 an amazon IAM role ->
  -> this role says that whatever the userId is according to google
     has the ability to write at most 100MB to s3 keys of the form
     s3://naninovel-proudction/users/{userId}/*  
#

there is some arcane stuff involved, but it does Just Work

#

then you can use a token you get from google against an AWS api (almost)

#

you exchange a token from logging in with google to get a token from Amazon, then use that token. it's the same diff

#

they're like a chain of permissions all strung together

lone fog
#

yes actually it makes sense ! Like this is something that I do to access for example the Twitch Api or the Riot Api - but yeah I didn't think that it was working the same way for users of an app.
Like for example, Twitch api, like we do have to request an a token & bearer to make api requests. I guess that their website uses their api, for like when a streamer goes live, it's written to the api. So like the request that's made to update the streamer status "automatically" requests a token & bearer to the server in order to identify that this request was made by someone logged in ?

#

not sure if i make sense

undone coral
#

it does

#

it may just be surprising that token does not differentiate between a token used to authenticate an ordinary user versus a token used to authenticate an application for development purposes

#

a token is just a magic string

lone fog
#

ok I understand very well, i had no idea it worked this way lol

undone coral
#

they don't authenticate/authorize a specific kind of person/thing alone

#

so your AWS credentials are tokens for an application to prove it's really the application to AWS

#

that is how they are actually used

#

you could in theory create an AWS IAM user corresponding to each individual real user of your game

#

and then grant permissions to those IAM users. but then you have to reinvent a lot of username/password management and stuff like that

#

that's why all this other stuff exists

#

you might also not want to even have usernames and passwords. clash royale doesn't

#

that's also why your deviceID + a random string is NOT a token

#

it's a credential, like a password, used to prove to someone who you are (authentication)

#

a lot of this stuff gets really academic

#

it's tough because for mobile games, you really do some weird stuff

#

and you don't want to write all this code for accounts, it's very bug prone

#

it has a lot of gotchas

lone fog
#

yeah haha so yeah thank you, I will implement something like jwt token auth on the api (I am actually creating the api too using api platform so it will be easy to do I think). Might look at that as soon as possible though

#

But yeah that's really insightful, thanks ! 🙏

undone coral
#

however, something has to give you a JWT in the first place

#

and that's a UX question

#

@lone fog like do you want people to use a username and password?

#

it's very cumbersome for a video game

lone fog
undone coral
#

so something has to issue a JWT for a "guest account"

#

those can't be made from thin air

#

and google play and apple login give you tokens, but only apple's is a JWT (only apple is OIDC compliant) out of the box. yoiu have to choose carefully which login flow you use to get OIDC compatibility from google

#

so pretty much no matter what, you use a vendor or some other tool to present a single facade for login

#

and hardly any of those support guest accounts as you're imagining - a device-specific credential, like a random number generated by the app on first launch and then stored to private app storage

#

so i am really, really emphasizing just how complex this is

#

and how you need way more time to achieve all of this

#

it's not like on the web where you have firebase and it does everything for you already

#

and as long as you don't go out of their ecosystem, you are fine

#

there is even firebase for unity, and maybe that's what you ought to be using

#

then there is the tricky reality that 100% of people who use apple devices also have google accounts

lone fog
#

ok thanks again, you really are of great help ! It's giving me a lot to think about lol

undone coral
#

well

runic elk
#

Next wave doesnt spawn after all enemies are dead, any ideas?

undone coral
#

in the real world for contracting, people deliver things that don't work all the time

#

and nobody notices or cares

#

because there's no audience

#

i'm not advocating for that

#

but it's just to say that, usually, what happens in a darwinian way is, you ignore all these nuances and as long as it says there's a login with apple button, if your boss happens to have an android phone, they're not going to tap on it

#

like it doesn't have to be secure

#

no one is going to write into someone else's save

#

so you don't really need all this complexity

#

unfortunately if you ask for a google or apple account you get a lot of the complexity for no yield

#

you have to use AWS credentials on your server because googl eown't let you publish an APK that contains them

#

not because anyone cares about security

#

if your people cared about this stuff they would pay 10x more

#

and it's true, it won't matter

#

i mean "don't care" and happening to be right about not caring is okay

lone fog
#

yeah currently I have a system that "works" but is not secure - the only thing that makes the thing not secure is the api key in the code (which is a random generated sting - not an aws credential, so should be safe for google at least lol), from which you can make any request, including delete requests. But I don't think that the game will have a big audience from the start - it's the first game from my bosses & they don't have that much of a following on socials so I don't think that it will be problematic for now - however we never know.. anyways now that I know more about all of this, I have a lot to talk about with my bosses lol

sly grove
#

It's why you generally log in to online games.

worthy sedge
#

So I'm trying to access a csv file through Unity. I've migrated the csv file (edited via msExcel) to my persistantdatapath directory and tried opening it through there. However, I run into a Sharing Violation error with it. Any tips?

undone coral
#

have you been able to open files at all?

#

it's unusual to use the word "migrated"

worthy sedge
#

Yeah I can still open the file just fine, and by migrate I mean copy/paste

#

And I'll try a specific directory for now and see how well that goes

#

Found the issue. Silly me I still had the file open elsewhere

sly grove
worthy sedge
#

Will do UnityChanThumbsUp

timber flame
#

HPA*
I have some questions about hierarchical path planning in 3d voxel based worlds.
First, how does the algorithm determine to place a node in edges? for each common segment one node in center or two nodes in the beginning and at the end of that segment?
For example, in short segments it adds just one node but for longer segments, two nodes are added.
Second, are these nodes connected to each other pairwise? I mean if they are 10 nodes, for each pair, we should add an edge?
In the picture below, there are three nodes and three edges in the top right cluster.
Third, how are weights of these edges calculated inside a cluster? using a path finding algorithm like A* for each edge?
Source Target
Node1 --> Node2
Node1 --> Node3
Node2 --> Node3
and finally, there is no additional node in a cluster? for example a node in center of each cluster

autumn locust
#

refactored my main system and now im so paranoid that i broke something, that im doing unit and system tests for everything

noble jay
#

Hi, i've added newtonsoft json but for some reason I can't use it.

noble jay
#

it's oaky now, I just had to re-import.

dusty wigeon
# timber flame HPA* I have some questions about hierarchical path planning in 3d voxel based wo...
craggy sierra
#

@dusty wigeon uh thats a lot of links

placid violet
#

is there any way to force a unity game to use the globally installed Mono instead of the local one?

timber flame
#

For example, I see some edges do not exist between nodes in the graph while there are paths between them

tiny pewter
#

i believe the algorithm is running all pair shortest path for the nodes in the same "segment" and these nodes have to connect to other segments on graph.

#

and maintaining a graph of the node pairs that connect two different segments
then for all nodes belong to the segment source located at, run a* until reaching the segment target at

#

but i am not sure how to divide a super large graph into small segment and connect them

#

maybe you need a array of adjacent list like this

vale spindle
#

i want to create complex ai that can handle 3d verticality. for example a unit with a jetpack that can fly/jump around platforms. i have a movement script which i'm trying to apply to unity's navmesh (i'm not using agents). it can walk on slopes and stairs, but i dont know how to do verticality or jumping. navmesh link analogue would not work because it's too simple or at least there would have to be different links for different units. i'm considering making a script for my own navmesh generation and then some kind of a* modification. what should i do?

sand grail
#

so if i want to check every node that next to my current node, in all ways possible in a 3 dimensional array , including the checks if moving in the specific direction breaks the matrix since it goes more than the max or min of it's dimension, makes an aprox of 27 node checks, and a node check having 1-2 checks

#

how do i make it auto for the check instead of importing them manually

#

without backtracking

#

since it's finding all the possible ways you can move from your current node in a graph

#

by moving only 1 node

rocky zephyr
#

I'm creating custom assets to export/save multilayer chunks of Tilemap areas. In the custom asset I'm archiving ordinary Unity tiles in a small class with the tile reference and a list of the positions. This all works perfectly. Prior to putting this on the asset store I'm trying to do some small optimizations. As one might expect, for some areas on a Tilemap the same tile may be repeated hundreds of times at consecutive positions. To reduce the size of this custom asset, I was considering using a simple Run-length encoding scheme (ie, here's a position, the next N positions have the same X coordinate) to make the asset files smaller. To get to the question: would this be a waste of time since Unity compresses when you make a build and .asset files, being text in this case, would be compressed anyway. Can anyone clarify?

dusty wigeon
# timber flame Obviously, I have read most of these links. They are vague without detail

Depending on which HPA* you are following

Next, we identify entrances between each pair of adjacent clusters. An entrance is defined as an obstacle-free area of maximal size that exists along the border between two clusters (Figure 12a). Each entrance has associated with it a transition point which reflects the fact that an agent can traverse from one cluster to the other. To this end we select from each entrance a pair of adjacent tiles, one from each cluster, which maximise clearance
The topological abstraction covers the maze with a set of disjunct rectangular
areas called clusters. The bold lines in Figure 1 (b) show the abstract clusters
used for topological abstraction. In this example, the 40 × 40 grid is grouped into
16 clusters of size 10 × 10. Note that no domain knowledge is used to do this
abstraction (other than, perhaps, tuning the size of the clusters).
For each border line between two adjacent clusters, we identify a (possibly
empty) set of entrances connecting them. An entrance is a maximal obstacle-free
segment along the common border of two adjacent clusters c1 and c2, formally
defined as below. Consider the two adjacent lines of tiles l1 and l2, one in each
cluster, that determine the border edge between c1 and c2. For a tile t ∈ l1 ∪ l2,
we define symm(t) as being the symmetrical tile of t with respect to the border
between c1 and c2. Note that t and symm(t) are adjacent and never belong to the
same cluster. An entrance e is a set of tiles that respects the following conditions:
• The border limitation condition: e ⊂ l1 ∪ l2. This condition states that
an entrance is defined along and cannot exceed the border between two
adjacent clusters.
• The symmetry condition: ∀t ∈ l1 ∪ l2 : t ∈ e ⇔ symm(t) ∈ e.
• The obstacle free condition: an entrance contains no obstacle tiles.
• The maximality condition: an entrance is extended in both directions as
long as the previous conditions remain true.
dusty wigeon
# vale spindle i want to create complex ai that can handle 3d verticality. for example a unit w...

Personally, my experience with Flying AI is that one of the following solution (In order of what I would use):

  1. You do not use any PathFinding (Go towards the target, same if there is wall)
  2. You use Navmesh Connection Link
  3. You use short-sighted movement. (If there is wall in front and a wall on top but no wall at the bottom then go down. - etc.)
  4. You use a normal agent with a high height
  5. You find an Asset that does the 3D pathfinding
  6. You make your own 3D pathfinding

Personally, I have use the solution (3.) in real production to add jumping and it works just fine. It is true, that sometimes the AI act a bit erratic and fail to reach the target, but in general, the behaviour is more than correct. To make it works, you need to adjust the sensibility of the height of each step such as each platform is linked. You use the height of the jump as the sensibility parameters. (It won't cross hole, but will be able to jump on top of "walls") That being said, it might not be applicable for your usage and you might be better by using other method.

I highly encourage to not make your own 3D pathfinding algorithm, even more if you are not an experimented programmer. It is an expensive task and you have a lot to do so you would be better off with trying to come up with a solution that works partially and focus on what actually matters: everything else.

dusty wigeon
# sand grail so if i want to check every node that next to my current node, in all ways possi...

Not sure what is the actual stated problem here. Are you working with a constraint satisfactions problem ? If so, it is an extensive domain with a lot of given solution. (Hill-climbing, Genetic Algorithm, Backtracking) Backtracking being one of the most easy to understand and work with from my experience.

If this is a pathfinding issue, you might need to elaborate more.

I do not understand what you mean by check instead of importing them manually

dusty wigeon
# rocky zephyr I'm creating custom assets to export/save multilayer chunks of Tilemap areas. In...

I'll be considering that you are talking about runtime size because otherwise, you should not worry about it.

I'm not 100% sure what you want nor how tilemap works, but you should first monitor the actual size that you are talking. Personally, I feel like there is no way your save of positions is more than a dozen of KO. That would be 10'000 positions. This is not even near of something that would matter in most platform.

If the size is astronomical for some reason (10MO - 10'000'000), be sure that Unity is doing some sort of compression whenever you ship your asset (The resource folder acts as an AssetBundle which are always compressed). If you really have an issue with memory, consider supporting the usage of AssetBundle/Addressable.

Searching on the internet, you can find multiple piece of information scatter.

Note:
Internally, the Resources folder basically is an AssetBundle, it's just one that is generated automatically for you during the build process - but in a very inflexible way (no incremental build, no control over compression, no variant support, no ability to split into multiple bundles, files are required to be in a particular place in your project, etc). https://forum.unity.com/threads/end-of-the-resources-folder.363800/#:~:text=Internally%2C the Resources,your project%2C etc

https://docs.unity3d.com/Manual/AssetBundles-Cache.html
https://blog.unity.com/technology/asset-bundles-vs-resources-a-memory-showdown
https://learn.unity.com/tutorial/assets-resources-and-assetbundles#
https://docs.unity3d.com/Manual/ReducingFilesize.html

sand grail
#

and ye it's for pathfinding

#

in a 3D space

#

but the other parts work perfectly, i just need to check all the nodes that are near the current node i know it's parth of the path

#

horizontally, vertically and diagonally

#

and also up and down

dusty wigeon
#

So you just want 3 nested for.

for x
  for y
    for z
sand grail
#

ye

#

for x-1, x+1 and x

#

i could try it but it's slow

#

to get me all possible solutions

#

and also backtracking is slow too

#

i saw you recommened more algos, which of those is the quickest?

livid totem
#

Hey guys, so i have poroblem when build my game in webgl. It wont call my API requsts, but in unity editor mode it works perfectly.
Any ideas on what could be? Can it be something in Player Settings when try to build game?

rocky zephyr
# dusty wigeon I'll be considering that you are talking about runtime size because otherwise, y...

Thanks for the reply. For sure I'm talking about runtime. I'm not using the Resources folder, but I have to assume that they compress all asset files -but I can't find that explicitly stated anywhere in their own docs (doesn't mean that it isn't there somewhere, I couldn't find an explicit reference. Lots of blog articles and such about compressing big assets like images (which is obviously pretty important).

dusty wigeon
# sand grail i saw you recommened more algos, which of those is the quickest?

None of them is the quickest, each have their own quirks. What do you mean by slow ? Because if the problem is only to find all the possible neighbourhood of a given node, this is as fast as you can do. I believe your issue is located in an other part of your algorithm. Normally, when you do pathfinding, one of the most import metrics is the number of expanded nodes.

autumn locust
#

so best performance upgrade is to reduce your node amount, like simferoce said

rustic scroll
#

Hey folks if someone is able to help me to solve an issue i'd really grateful.
i've mapped a ProBuilder plane verticles into a 2d array manually.
But it seems the verticle indexes always changes due to how Unity importer changes. I can solve that.

However i was thinking if there was any smart way of mapping a plane's verticle indexes to a 2d array, would any1 know ?

dusty wigeon
# autumn locust so best performance upgrade is to reduce your node amount, like simferoce said

Just to a nuance here, what I meant by number of expanded nodes is not to reduce the actual nodes, but to reduce the visited node. This can be done by using correct heuristic for the given problem or by solving for nearest optimal path instead of the optimal path. An other option could be to pre-compute all the available path which then result in a O(1) pathfinding algorithm. (Floyd–Warshall) This is only applicable in a static environment with a limited amount of nodes.

autumn locust
#

also floyd warshall is very expensive in setup

#

like o(n^3) iirc

dusty wigeon
solar mist
#

I am getting these two errors when running the game which does not say much:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.GameObjectInspector.OnDisable () (at <d92715ccd3ac42dbaeb8a2239166e2e8>:0)

And

ArgumentNullException: Value cannot be null.
Parameter name: componentOrGameObject
UnityEditor.GameObjectInspector.OnEnable () (at <d92715ccd3ac42dbaeb8a2239166e2e8>:0)

That is all it says, when I click on the error in the console it just shows a (Game Object Inspector) empty in the inspector.

Any help would be much appreciated. Thanks

dusty wigeon
#

Most likely you change the script type from one to an other. (ScriptableObject, MonoBehaviour, Plain C# Object, StateMachineBehaviour, etc.)

solar mist
#

@dusty wigeon thanks! i appreciate the help!

rare patrol
#

Hi, I'm looking for some advice. I'd love to know if anyone has a theory behind how to achieve a camera scoring system similar to Pokemon Snap.

The main issue I'm running into is how to identify the animals being taken in the pictures and how to score them appropriately. Mainly because, if for example, I use raycasting then if an animal is behind a patch of grass which typically won't have a collider, then the camera will still score highly as it wont hit the grass.

My main working theory is that I use a shader and a 2nd camera whereby in the 2nd camera I render all animal gameobjects with a unique colour that corresponds to their species, and then I do some weird math that I havent figured out yet to work out how many of the animals there are, how centered they are etc. One of the issues I'm running into with that is I can't seem to find a solid way to render their normal materials to one camera, and render this new colour to the 2nd camera. Even using a custom render pass it doesn't seem to be working.

Any advice/theories/anything at all to potentially optimise this or provide alternate theories would be amazing 🙂

rare patrol
dusty wigeon
#

Just to be sure, in option (1.) you would be using RenderTexture

#

In (2.) also.

rare patrol
#

Ah okay! I didnt think of that! So I'd create a RenderTexture based on the "photo" then cycle through all objects on the Animal Layer captured and amend it with the correct colors?

#

Is that what you meant?

dusty wigeon
#

You would:

  1. Use a second set of Renderer on a different layer (Scoring Layer) with unlit materials that would be render by a second camera with a RenderTexture.
    OR
  2. Use command buffers to ReRender all animals with a new material on a new RenderTexture.
#

From which you will be able to sample the texture and see how much of the animals is visible.

rare patrol
#

Thank you! Just come off of a 13 hour shift and its been playing on my mind all day - I know now where to direct myself! 😁 Really appreciate your time!

hardy nymph
#

When I convert a component to JSON form, the reference to another asset / file is usually in this format {"fileID":46,"guid":"0000000000000000f000000000000000","type":0}

#

For-example. This ^ can be reference to a .png in a texture

#

I want to get the fileID guid and type using the asset's path in Unity, how can I do it ?

dusty wigeon
#

Probably, most of your question can be answer with a good understanding of the way things are serialise.

hardy nymph
dusty wigeon
versed coyote
#

I'd like to run a script via -executeMethod <ClassName.MethodName> or -executeMethod <NamespaceName.ClassName.MethodName> in my command line argument to build a server.

I therefore created a static method to Build my server via UnityEditor API.
However it failed with this message:

Assets/CustomBuilder.cs(20,41): error CS0103: The name 'BuildTarget' does not exist in the current context

This is my method:

using System;
using System.IO;
using UnityEditor;
using UnityEngine;

public class CustomBuilder
{
    public static string defaultPath = @"Distribution" + Path.DirectorySeparatorChar + "MacOS" + Path.DirectorySeparatorChar +
                                       "Server" + Path.DirectorySeparatorChar + "bangerang_server";

    public static void BuildServer()
    {
        Debug.Log("Building Bangerang Server...");
        try

        {
            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
            buildPlayerOptions.scenes = new[] { "DemoMap" };
            buildPlayerOptions.locationPathName = defaultPath;
            buildPlayerOptions.target = BuildTarget.StandaloneLinux64;
            EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneLinux64);
            EditorUserBuildSettings.standaloneBuildSubtarget = StandaloneBuildSubtarget.Server;
            buildPlayerOptions.subtarget = (int)StandaloneBuildSubtarget.Server;
            buildPlayerOptions.options = BuildOptions.CompressWithLz4HC;
            BuildPipeline.BuildPlayer(buildPlayerOptions);
        }
        catch (Exception e)
        {
            Debug.Log(e.StackTrace);
        }
        finally
        {
            Debug.Log("Build Complete");
        }
    }
}

When checking UnityEditor.BuildTarget I can see in the comment on top:

// Assembly: UnityEditor.CoreModule

I therefore created a assembly definition but could not add UnityEditor.CoreModule since I can't locate it to add it.

hardy nymph
dusty wigeon
hardy nymph
#

I have an asset's path as an input and I need the {"fileID":46,"guid":"0000000000000000f000000000000000","type":0} part as an output.

hardy nymph
#

I have an interface / website. I will make a file browser so user can select a file and the website does the remaining job of editing the JSON, then sending to the unity.

#

But when the user selects an asset, we will only have the path of that asset.

dusty wigeon
#

Are you familiar with Custom Inspector ?

#

And Editor Tool in general

hardy nymph
#

I'm not familiar with that. My main goal is to make a website which is basically a duplicate of Unity Editor. We will be able to do everything in the website which will update unity in real time. So website and the Unity Editor are connect via socket connection.

#

The file browser will get all the asset files, The user will select the asset file they want to set as for-example 'm_shader' and the website will edit the JSON on the web end setting the new fileid guid and type, on the Unity end the json will be received and will update the component.

#

seems like I can get guid from file's .meta file

dusty wigeon
#

The serialization process will do the rest. You do not need to directly manipulate the information.

hardy nymph
dusty wigeon
versed coyote
hardy nymph
#

Is LocalFileIdentifier the fileid ?

versed coyote
dusty wigeon
dusty wigeon
# versed coyote I read about that. Is this some kind of convention to have the script in a folde...

At the moment, I am fairly sure you cannot even build same if you do not use your script. The issue is that your script is trying to build itself, but because UnityEditor is not define in a build, it fails. To fix the issue, you need to remove the BuildScript from the script that are being build. You do that by using Assembly Definition. In the case of editor script, Unity treats every script inside a Folder name Editor as in the editor assembly and won't build it for a runtime build.

https://docs.unity3d.com/Manual/SpecialFolders.html

#

Editor scripts add functionality to Unity during development, but aren’t available in builds at runtime. Scripts in an Editor folder run as Editor scripts, not runtime scripts.

versed coyote
rare patrol
undone coral
#

it's not clear what your goal is though gameplay wise

#

you can certainly use method 1, if you want to duplicate your entire scene, essentially, for a second camera

#

that doesn't really make sense to me

#

com.unity.perception already does this correctly and robustly

#

if your goal is to eventually count pixels, this is going to be hard to do yourself

#

if you goal is to know whether or not a certain minimum amount of animal is visible on screen, it will be harder to do yourself

#

com.unity.perception can also tell you how many pixels of a particular animal (if that's your label, in its vocabulary) are visible

#

you can render the images on demand too, instead of continuously, which is probably what you want

rare patrol
# undone coral it's not clear what your goal is though gameplay wise

Hey, thanks for the response!
Gameplay goal is think - Pokemon Snap. Take a photo, photo is scored eventually based on various rules etc. How I do that, I'm fully open to suggestions. The main one I've had from various people is coloring the animals with unique colors then read from the output screenshot.

To be honest, rendering twice doesnt make sense to me either but I couldnt think of any other way. I've not heard of com.unity.perception

undone coral
#

and it will just work with your existing renderers

#

it's not that rendering twice does or does not make sense

#

it's that if you have a separate render hierarchy

#

it is extremely cumbersome

#

i don't know how pokemon snap works

#

The main one I've had from various people is coloring the animals with unique colors then read from the output screenshot.
this is kind of what com.unity.perception does, but correctly

#

guess you'll look at the package

#

you're going to throw your arms up though because it'll have a lot of jargon

#

so it's tough. you are trying to do something that is deceptively hard

#

the shortcut you are taking has a lot of bugs

#

you haven't gotten to them yet

rare patrol
#

Oh haha!

So the basic gameplay loop is: Take a photo of a Pokemon, it saves that photo, then you present that photo to the professor who scores it based on various rules like how centered the Pokemon is, how much it takes up of the screen etc.

I'll take a look at the package

undone coral
#

and in order to do it you'll have to reinvent a lot of com.unity.perception

#

but you're going to look at the package and not know what the fuck it is talking about so it's stressful

#

don't be discouraged 🙂

rare patrol
#

You are really selling this to me here... 😉

soft shoal
#

Hi guys, I'm looking for help about app startup time optimization.

The project targets on Mobile and Nintendo (NX). There is no problem on Mobile (takes about 20 sec to startup), but in NX (its hardware is very low level compared with current mobile devices), it'll take probably more than 1 min to startup.

For now, before I really investigate the detail, I would like to gain some background knowledges to help me get start, such as, what factors can increase startup time in unity? how they affect the time?

I tried google it but didn't find proper resources. Does anyone have any idea? Is there any helpful links?🤨

dusty wigeon
# rare patrol Oh haha! So the basic gameplay loop is: Take a photo of a Pokemon, it saves tha...

To be honest, I am not sure that in your case you can use com.unity.perception. It is use for the generation of synthetic data for the purpose of supervised training of AI. In spite of that, you may be able to find useful tool inside the package. @undone coral could point towards some of them as I do not know much about the package myself, but most of the workflow and tool will be made with the idea of generating lots and lots of data for the purpose of labelling them.

If you really are interested in not having to duplicate the scene, I suggest you look instead into CommandBuffer. CommandBuffer basically enable the drawing of the camera without passing by the MeshRenderer. By doing them, you would be able redraw every meshes with the given material of your choice without the need of duplicating the meshes/your scene. My own approach will be to create an "Engine" that enables the redrawing of any MeshRenderer by the usage of components such as ScorableRenderer which would take a specified colour that could be use to identify the actual object in the resulting output.

That being said, I would not be surprise if the actual rules of the game is a lot simpler. As little experience as I have, I am always surprise by how simple rules can makes things work. What would be important is to actual define what is your target audience and what are they expecting. I'm suspecting that you may be over engineering your product.

Side Note:
The rating in Pokemon Snap is define by: the proximity of the Pokemon to the center of the screen, the size of the Pokemon on the screen and the "pose" of the Pokemon. None of those rules require what you currently do and can be done by simply transforming the MeshRenderer bounds into ScreenSpace coordinate.
Perception package is describe as: The Perception package provides a toolkit for generating large-scale synthetic datasets for computer vision training and validation.

dusty wigeon
# soft shoal Hi guys, I'm looking for help about app startup time optimization. The project ...

I am almost certain that the actual issue is the intensive usage of the resource folder instead of AssetBundle/Addressable. I'm currently developing on NX (Switch) for a project of considerable size and I have no issue with startup time while using AssetBundle.

https://learn.unity.com/tutorial/assets-resources-and-assetbundles#5c7f8528edbc2a002053b5a7:~:text=Improper use of Resources folders will increase application startup time and the length of builds

soft shoal
soft shoal
# soft shoal Hi guys, I'm looking for help about app startup time optimization. The project ...

PS: more background info about our project:
It's a AAA game mobile version, the project size is large, specific data (build size, memory occupied when startup...) I don't remember for now.
Resource management: Addressable.
Input: New Input System.
Gameplay: DOTS.
...
So it's very possible that the reason is too many DLL or plugins need to be loaded when start the game (memory related problem).

dusty wigeon
# soft shoal Thx for reply, but actually can't be resource folder, we are using addressable. ...

If the resource folder is not the issue, I would still look into to be sure that there is no unexpected asset loaded by emptying as much as possible the folder and double checking the actual size of it.

  • If you are not using a light scene as your startup scene you may want to do so and startup the asynchronous loading of the first scene of your project.
  • If you are using "always" included shader you might want to get rid of them
  • Remove unused libraries and package as they could be included in the build without being actually use.
dusty wigeon
#

Could it happens that you have reference that point to heavy asset in the first scene ?

dusty wigeon
soft shoal
rapid osprey
#

It is more than just startup time though

soft shoal
dusty wigeon
# soft shoal It that MB?

O means octet while B means byte. An Octet is always 8 bits while a Byte is define as the smallest number of bits that can be access by the system which is generally 8 bits.

dusty wigeon
rapid osprey
soft shoal
# dusty wigeon If the resource folder is not the issue, I would still look into to be sure that...

Emmm, most possible factor can be the third.
In our project, startup scene is pretty simple.
Shader I didn't check, it's one direction I can check, but I guess it can be major problem if it's a problem in our project.
Lib, most likely it is the reason, that's what I need to check. Since the project targets on both mobile and NX, I'm not sure there are Libs only used for mobile also loaded in NX.

dusty wigeon
rapid osprey
#

I agree. Unfortunately I don't have more insight on why it is that way.

violet valve
#

I don't see a need.

#

Gone are the days of hardware counting up to 128 "voices" or w/e as it's not a hardware problem anymore.

dusty wigeon
#

Yes, it is. Not because of the audio like @violet valve was pointing out, but because of the instantiation of the audio source. Like VFX, SFX happens a lot during a traditional game and a lot of them have short live. (Firing Sound, Step Sound, etc.) Not pooling them add an extreme amount of stress to the game and will most likely one of the first source of FPS drop you will experience.

dusty wigeon
regal lava
#

Mem is cheap. I'd pool as much as you can if you're just reinstantiating everything anyway.

#

If you ever played path of exile, that game has a horrible history of the audio tanking your fps which I find pretty funny

dusty wigeon
#

I am not sure I am following.

Pooling means to reuse the current object. So instead of destroying it whenever you finish, you deactivate it. You then reuse it down the line without reinstantiating an other one.

#

Your system, at least the part where you set the values, would be valuable.

#

The cost come from the allocation of the memory, not the change of the settings.

soft shoal
wooden cedar
#

A pool style audio system could also be helpful in multiplayer, as it makes for a nice central place to trigger audio for everyone.

#

Otherwise you usually individually sync random audio sources on a case by case basis. It could fit a use case

violet valve
wooden cedar
#

It's definitely something I'd benchmark to validate, especially on mobile. But I'd encouraging making sure it's benefitial to the project.

ancient talon
#

Audio system are hardly synced in multiplayer unless it's preloaded and fired when ready.

#

You'd use remote procedural call to invoke event listeners such as "OnGameOver" or "Player { name = "Steve" } Killed". Then you'd invoke when you can invoke.

#

Instead of syncing sound behind a wall that was caused by other player, why not just spawn an "AI" that mimic the multiplayer movement in the game? Why replicate the object that affects the scene, than the one that started all?

#

What good does it serve to have a pool of audio? Holding Audio in memory is expensive and heavy on resources.

#

What 10 multiplayer titles have this feature?

#

I'm asking for the source or cites of the 10 games you mention has audio synced across the multiplayer mode.

wooden cedar
#

Now that the user blocks in place, I can see that this went back and forth more than is reasonable. If you want projects, you can look at our website - enough are listed there.

haughty raft
#

Using Unity2020.3lts
Pun2

I have a class with 5 lists
Lists are ints

When using editor to make a client, open a room, and start game, everything is working as intended
My lists get populated with all data when new clients join.

When using a build to host the room and game, and connecting a client through the editor.
Clients joining do not populate lists.

Is this something of a similar nature to async operations?
Where editor does not do some work at runtime?

I have not tested with two devices as builds yet
Going to do that today when I find time.

sly grove
# haughty raft Using Unity2020.3lts Pun2 I have a class with 5 lists Lists are ints When u...

when you see a difference in behavior between a build and the editor, 99% of the time it's one of the following:

  • Script execution order issues (Your code assumes Start on script A runs before Start on script B for example. In reality this order is not guaranteed and can change between platforms)
  • Framerate dependent code (Your code behaves differently at different framerates)
#

I suspect the former in your case. You should start doing some debugging, especially around your list-populating-code. Question your assumptions

haughty raft
#

Interesting point,
I do debug rather a lot to keep things neat yes.
This isn't something I thought of,
Scripts having different start times based on platform...
Thanks.
It is indeed on a start function.
Calls an enumerator forcing a 2.5 sec delay to allow multiplayer code to initiate fully before populating a list.
I'll increase the time, check that, then I'll try adding some logs to see what happens when exactly.

Have you ever experienced a list getting populated with triple entries?
In my case there is only one time code executes to add to it, but I'm getting three entries
Two blank zeroed entries one correct
The order is odd top
0 correct 0
On top of the original
If more client join they also add three more to the list
3 clients = 9 entries
It's not a massive problem as I'm only ever using the max value of a list as data but I forsee some issues if I end up with say
65 people joining in and put over an hour without ever fully ending the room.
Perhaps.. I can't exactly test that alone I suppose.
Well.. actually I could it would take an hour haha
Anyway
To the question at hand
Overpopulated lists coming from one single call to populate per client?

#

It's not even a issue really this bit I just have an ocd with my work

sly grove
haughty raft
#

That DOES happen
For a single frame
I get one warning about event listener when clients join
Wow your super knowledgable

#

It's to do with my corputines allowing multplayer code to fully run before destroying parts for other clients

#

I managed to get it down to a single frame basically, wow so it happens that fast
You've been super helpful this morning
I can probably get that sorted yes

worthy lodge
dusty wigeon
west scarab
#

Any recommendations on methods to calculate the boundary lines for a set of axis aligned rectangles on an integer grid? I looked at sweep line algorithms but I'm confused on how to extract the boundary line. I'll eventually also need all grid positions that are "filled" by the boundary lines. Not sure if I should just flood fill or if something else is smarter...

west scarab
#

Give me a sec, I'll draw an example

west scarab
#

(And by area I don't mean the surface area, but the grid positions)

sly grove
west scarab
#

The pink area?

sly grove
#

Yes

#

And just throw them all in a HashSet

west scarab
#

The pink area is probably less of a concern since I just need it to fill tiles on a tilemap. I supposed I could just call TileMap.SetTiles(Bounds) for each rectangle.

#

The purple area I need to build an outline collision mesh. The easy method would be to just iterate and check if neighbouring tiles are set, but I'm wondering if there's a faster way

sly grove
#

Does the mesh need to have that hole in the center

west scarab
#

Yes 😬

#

I'll probably just use a single collider for each grid coordinate, so I only really need the coordinates

worthy lodge
dusty wigeon
# worthy lodge It is for a gameplay mechanic where you pull away a mesh and then it breaks in 2...

There is 2 situation:

  1. The triangle is separate by a line passing by one of the corner.
  2. The triangle is separate by a line passing by no corner.

In situation 1, the result is 2 triangles.
In situation 2, the result is 1 triangle and 1 quadrilateral. Subdivide the quadrilateral in triangle by creating a new line from one corner to an other of the quadrilateral.

Exactly how the user SunBeamCoffee answered from your Forum post.

worthy lodge
#

In situation 2 you can also make it 3 tris, right?
Don't see why you would need to make 4 out of it

dusty wigeon
#

The reason why you should use 4 triangles is because you want to reduce the amount of stretching and tearing that arise from having thin rectangle/triangle that results from a slice. It is to keep everything stable and not have extreme which could cause issue of floating precision.

To get to 4 triangles, instead of dividing from one corner to an other, you draw two line to the middle of the opposite cut from each intersection point of your cut.

worthy lodge
#

Ah fair enough

dusty wigeon
#

Those issue are more frequent when you do a lot of recursive subdivision. It should be much of an issue for your use case.

#

That being said, you might want to look into more performant approach for mesh division if this is frequent operation, because it can be quite expensive to operate.

#

One of the most important issue would be the manipulation of the memory that needs to be synchronise with the CPU and GPU.

worthy lodge
#

But then still, I understand it in theory, but just cannot wrap my head around how to code it. All things I try result in messed up triangles

And it's not a frequent calculation, it happens once every few minutes

dusty wigeon
worthy lodge
#

For now I just need something which works good enough, it's alright if it breaks sometimes. That can be fixed/optimised later

worthy lodge
dusty wigeon
worthy lodge
#

I actually have followed that in the past

#

I understand the theory of mesh generation, and mesh slicing, but cannot get the cutting a triangle in 3 (or 4) parts working properly.
Already looked at some open source projects and tutorials. I might rewrite everything again, but I feel like I'm just missing some simple steps to get it to show up properly

dusty wigeon
# worthy lodge I understand the theory of mesh generation, and mesh slicing, but cannot get the...

Try small, maybe create a new project instead of working on the current project you have. Use simple meshes with limited amount of vertices. Only do the division of the mesh and remove everything else. Create a scene where you keep track of all the previous step that you succeed to make.

Try a single triangle.
Try two triangle.
Try a cube.
Try a sphere.
...

This is standard procedure in programming. It will happen for a lot of the work/bug you gonna work on.

#

Nobody is gonna solve your issue for you.

abstract folio
#

anyone else having debugger trouble lately? this identifier IS defined- why is it telling me it's not? Am I just overlooking something stupid?

dusty wigeon
abstract folio
abstract folio
abstract folio
#

no help- will try deleteing libraray folder and letting it rebuild

fair plank
#

I have a text input field, that the player can write in. How would I allow them to resize the field you can write in during runtime? Here's an example of what I want to achieve.

abstract folio
#

create 4 draggable objects. Add script to them that will note the change in position when dragged, and adjust the RectTransform of you TextInput by that delta. @fair plank

#

@dusty wigeon any other ideas? full system reboot and even deleting library folder didn't help.

dusty wigeon
#

No, it may cause issue. The resource path is not the same as the system folder path.

dusty wigeon
midnight violet
quartz stratus
# fair plank I have a text input field, that the player can write in. How would I allow them ...

I had to build these kinds of wysiwyg tools in unity at my last job. This was an early prototype I can share, if you want to see one possible implementation of this for reference to get started. There's a live build you can play around with as well. We made this more nuanced over time but this might help get you started. https://github.com/galenmolk/studiosaurus

GitHub

A prototype object editor tool built in Unity. Right click in the blue area to get started. - GitHub - galenmolk/studiosaurus: A prototype object editor tool built in Unity. Right click in the blue...

quartz stratus
worthy lodge
midnight violet
worthy lodge
midnight violet
#

Is this the base cube you trying to cut?

worthy lodge
#

Hmmm going back to the drawing board, the code only calls 3 times weirdly enough.
Not sure how or why...

worthy lodge
regal olive
worthy lodge
indigo spoke
#

Can anyone with Unity Timeline experience give me a hand here? I'm getting a weird bug where two animations are being added instead of being blended as expected. https://forum.unity.com/threads/character-offset-issue-when-timeline-gameobject-is-not-selected-100-reproducible.1417596/

#

The issue only occurs until we select the Timeline Gameobject in the hierarchy so this seems to be a Unity bug

#

But I'm wondering if I'm doing something wrong anyhow. Any help would be greatly appreciated

radiant laurel
#

I want to make a custom editor for a specific kind of gameObject, using a node graph.
I need to then serialize the node graph data, but I also need to create the gameObject components, depending on the graph data.
What would be the best way to do this?
I thought about having a component that references the node graph data, that then creates the gameobject, but remaking the gameobject from the node graph data everytime I instantiate it seems unnecesary

radiant laurel
#

you start by, definint what you actually want

#

because "making creatures intelligent" in a game making context is wildly unespecific

long fox
#

i guess, yeah

#

im having issues describing what im even looking for, i guess my brain sorta defaults to simple intelligence, which yes, is wildly unspecific

fair plank
plucky laurel
undone coral
dusty wigeon
radiant laurel
midnight violet
radiant laurel
#

Shadergraph, vfx graph

midnight violet
# radiant laurel Shadergraph, vfx graph

Those graphs are just visual versions of shaders or other systems, still you do not add data on top in the graph itself, you just create inputs and outputs which are still inside the shader code.

radiant laurel
#

They still contain info that the shader or the VFX don't

#

(node position, node grouping, comments)

sand grail
#

How do i get the world as a matrix?

midnight violet
radiant laurel
#

Ok I think you just said all I needed to know

#

Didn't know of the existence of .meta files

midnight violet
sour mango
#

Please, no answers based on assumptions. I need answers from those who really have experience with both methods. Try to understand! Thank you!

I hope someone can give me the proper answers! Thanks in advance!

It’s about the comparison of a completely handwritten built-in character with pseudo physics, or a character controller that uses unity physics without kinematics!

In comparison:

Does the character controller with unity physics take more performance, especially when you plan to upscale actions and use it for mobile too?

With Unity physics these days, is it possible for me to encounter physical glitches, especially when two character controllers clash with their velocity? This brings up the main question, can I fully control unity physics without getting any glitches at all?

Or is a built-in pseudo physics written character controller still better, because of the full control, that allows a low overhead regarding performance and avoids uncontrollable glitches, despite it being more work at all, because every case has to be considered.

midnight violet
# sour mango **Please, no answers based on assumptions. I need answers from those who really ...

You want a guarantee no one can provide. First, you want to avoid ANY glitches? Its a game engine, on a computer, everything can glitch, low memory, bad performance in general and so on. Bugs happen on every version, so no guarantee here. You want us to compare a pseudo physics hand written code (which we dont know, cause you did not write it yet) to compare against unitys physics system. How should we go with that? If you are doing a better job than Unity with their physics engine, sure, go ahead and write it yourself cause its going to be better.

austere jewel
radiant laurel
#

Breaking internet etiquette in more ways than one

sour mango
sour mango
sour mango
pure dock
midnight violet
sour mango
midnight violet
#

And also in physics

untold moth
pure dock
sour mango
#

thank you and adios everyone!

untold moth
#

If you have any specific questions and willing to listen to what people have to say, then feel free to ask.

regal olive
#

is there any way to load code in runtime in iOS? Seems like Assembly.Load doesnt work because iOS builds are with il2cpp scripting backend (correct me if Im wrong, im not sure if its because of this). How can I have a game in iOS, and load code in runtime? In Windows I have asset bundles of code and when I need it I do Assembly.Load, but I cant do that in iOS.

scenic forge
#

iOS App Store forbids dynamic code, all your code must be statically bundled in the app directly.

regal olive
#

sry for my little knowledge, but what does that mean? I need to have all the code from the beginning?

scenic forge
#

Basically yes

#

Are you trying to live patch your game?

regal olive
#

I am creating a game which has downloadable content (dlc`s). This dlc´s can be downloaded and activated at runtime in Windows, but I cant do it in iOS.

scenic forge
#

You just have to have all the code (including what the DLC needs) in the app already

#

Other assets of the DLC can be loaded at runtime, not code.

regal olive
#

Ok thanks. The problem is that the idea is to let people create the DLC`s and add them to the dlc catalog (im using a page called mod.io). I should have said mods instead of dlcs 😅 . So for every person that wants to create a mod, he needs to provide me the code to add it to the main game?

scenic forge
#

If you want your app on the App Store yes

#

Or you can try to cheat Apple's review, but I wouldn't suggest it.

#

IIRC the relevant part of App Store guideline is that, your app cannot alter its behavior so that it's significantly different from what's been reviewed by Apple.

#

What's "significant" is basically up to them, monopoly is great 😄

regal olive
#

Ok, thanks ahah. But even if Apple would let me do that how can I add code in runtime in iOS? Because Assembly.Load doesnt work

scenic forge
#

Maybe someone else can answer.

#

Btw if you are trying to cheat pass Apple's review, just so you know that depending on how you try to load dynamic code, Apple has static analysis tools that detect these things, so it's an auto rejection.

regal olive
#

Nah I dont want to cheat it, just tell them the idea and maybe they let me do it I dont know haha. Thank you for all the help!

sand grail
#

How do i get every node of it

#

Like 3,4,1 and do something with that world pos

#

To spawn an enemy there

#

Or somthing

untold moth
#

Why can you not use these numbers as a position directly?

midnight violet
# sand grail Well the world is a 3d matrix

The 3D Matrix can be 1,2,3 but can also be 0.00001 and from there up... so the question is not really logical to answer, what are you trying to do with it? The world matrix is just set by transform.position = Vector3

dusty wigeon
# sour mango **Please, no answers based on assumptions. I need answers from those who really ...

So, I am not the most knowledgeable on this topic but I know my fair share.

First of all, the issue with the Unity Character Controller is that it is a general purpose controller, meaning that it can do a lot of things, but might struggle with more complicated scenario. One example of things that it might struggle to do is:

  • Adding alternate means of movement such as: Climbing, Sliding, Flying, Swimming, Wall hoping, etc.
  • Reducing the amount of check base on the actual gameplay of the game such as: Step Detection, Slop Detection, Side Collision Detection, etc.
  • Usage of physics such as the Rigidbody. The Unity Character Controller does not support the usage of physics on the character itself.

For the Gliches part of your question. Glitches are not always, and most likely will not come from the Character Controller itself, but on the interaction between it and the rest of the world. A bug occurs whenever there is an unexpected behavior. So, by definition, it is guarantee that the Unity Character Controller will cause glitches because they cannot plan in function of what behavior you are expecting from your personnel project.

However, is doing your own Character Controller will prevent glitches ? No. There is no way to guarantee that something will prevent all glitches (Except using Formal Specification - https://en.wikipedia.org/wiki/Formal_specification, which still requires you to define all the specification (interaction) to insure that there is no glitches)

To make this decision, you need to evaluate what you want, and what you can do. Question like:

  • What are the movement my character has ? Are they supported by the Unity Character Controller ?
  • Does the Unity Character Controller do more than what I require ? How much does it cost in performance to do those things that I do not need ?
  • Do I have the resources and knowledge to make a Character ?
  • What is the desired quality ? (Prototype, School Project, AAA Project)
#

I'm sorry I was not able to be more descriptive, what you are asking could be an entire chapter of a Book, and I have little to no words/time to use. I had to delete some sentences to make it fit.

spiral plank
#

!code

thorn flintBOT
#
Posting code

📃 Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

sand grail
#

well good sir many didn't understand my question so i will draw it

zealous tide
#

Hey guys is there any tutorial for CICD pipeline for unity?

#

I wrote a yaml file for building my project for WebGL however, it seems like the editor removes the Build folder after building the project.

compact ingot
# zealous tide Hey guys is there any tutorial for CICD pipeline for unity?
Unity Learn

Development operations (DevOps) is a key group of tools and workflows that you can use to help you create and manage your game or other real-time experience throughout its lifecycle. You can complete this course as a guided learning experience or just explore the specific content that you need to support your DevOps journey.

zealous tide
compact ingot
#

thats admittedly not much, but maybe a start

compact ingot
#

it is generally advised to do whatever gets you to iterate and deliver faster and reliably

sand grail
#

@midnight violet here! i drew it all for you good sir

#

hopefully my question is clear as day now

compact ingot
sand grail
#

take the position of an object?

#

and yes

#

i would need to convert some specific world parts into nodes

compact ingot
#

if the grid origin is not at world 0,0,0 you would just add the offset to the world origin to the transform position before casting it to an Vector3Int

sand grail
#

ye

#

but how do i get anything from the world?

#

is there a function as shown in example

#

like world.x

#

or anything like that

compact ingot
sand grail
#

ye

#

i ned the world as a whole

compact ingot
#

what does that mean?

sand grail
#

let's say

#

that world is a world[][][]

#

as in a matrix

#

i would need world[x][y][z]

#

i am really getting confused, am i explaining it wrong ?

compact ingot
#

coordinate (0, 5, 0) in world space is just new Vector3(0, 5, 0)

#

world origin is always at 0,0,0

sand grail
#

ye logic

compact ingot
#

so there is no need to have an object describe world space

sand grail
#

that's what i said

#

alr

#

AH

sand grail
#

im dumb af

#

my bad

compact ingot
#

world is defined by convetion in unity

sand grail
#

what i wanted

#

was always in my code

compact ingot
#

it has 3 orthonormal axes, expressed in float

sand grail
#

ye i gotcha

#

thx

mellow plinth
#

Which is the correct way to increase the speed of a PlayableGraph? I found both solutions in internet, but I'm not sure:

int count = graph.GetRootPlayableCount();
for (int i = 0; i < count; i++)
{
    graph.GetRootPlayable(i).SetSpeed(value);
}

Or:

int count = graph.GetOutputCount();
for (int i = 0; i < count; i++)
{
    graph.GetOutput(i).GetSourcePlayable().SetSpeed(value);
}
dusty wigeon
mellow plinth
#

Which one is to increase the speed of the whole graph?

dusty wigeon
#

I should say, the speed of the whole sub-graph.

mellow plinth
#

I simply want to take a PlayableGraph and change its entire speed.

#

But I hardly understand how it works 🤣

#

So how could I do that?

mellow plinth
dusty wigeon
midnight violet
#

yeah, you just use the manual update and do your thing on speed

#

than evaluate manually to update the graphs state

#

Director Preprocess Frame? Hm, gotta look that up

mellow plinth
#

i.e: .Evaluate() uses a different workflow than letting Unity taking care of it

midnight violet
#

the Manual Update Option is already asynchronous, isnt it?

mellow plinth
#

It runs in the same moment you call it

midnight violet
#

"This can be useful for graphs that are completely disconnected from the rest of the game. For example, localized bullet time."

mellow plinth
midnight violet
#

I am not firm with the playablegraphs that much, could you make it async with using Tasks?

mellow plinth
#

Neither am I hehe.
I don't see how Task could be included there.
The idea would be to tell Unity to run it next to its own internals playable graphs, but using a different speed.

midnight violet
#

So from what I see, the evaluate is a problem cause you throw it out of the Jobs queue therefore as your forum post says, it will add overhead for every evaluate you are calling, correct?

dusty wigeon
# mellow plinth That would run the graph synchroniously, rather updating it in the Director Prep...

`There's a clever user who figured out that you can put multiple animators in one PlayableGraph, connect an AnimatorControllerPlayable to each Animator, and then manually update the PlayableGraph.

Doing this will execute the Animators as a batch, which will take advantage of all threads. It requires a bit more work than just dealing with the Animators directly, but it might address your use case.`

mellow plinth
dusty wigeon
#

Then, what is the issue ?

#

manually update the PlayableGraph

mellow plinth
#

However, running the PlayableGraph with .Evaluate is less optimal than letting it be run in the Director loop

#

As the graph is run synchronously (with multithreading, but synchronously)

dusty wigeon
#

Why would you chain your animator ? Can you not make them in parallel ?

mellow plinth
midnight violet
#

Does not look like there is much option for you than evaluate manually if you want to decouple your speed from one playablegraph to another.

dusty wigeon
mellow plinth
dusty wigeon
#

So you do not want to increase the speed, but decrease the number of update.

mellow plinth
midnight violet
#

Sounds like a LOD system for animations

mellow plinth
#

Kind of

#

My system has:

  • Normal.
  • Player is not looking.
  • Player is in another "world" (the game has 2 worlds than run at the same time).
#

And yes... we must run animations even if the player is not in the same world due stuff...

#

At the moment, I use .Evaluate(timeSinceLastUpdate)

midnight violet
#

you need to run animations even when the player is not there?

mellow plinth
#

So if I could update enemies that are in the other world each 4 or 5 frames, I would save resources

midnight violet
#

Oh they "worlds" run at the same time, got it

dusty wigeon
mellow plinth
#

So we you leave a world, and return in 3 seconds. The world must have progressed 3 seconds.

#

But since the player is not looking directly, we can afford a bit of precision sacrifice and update each a few frames

midnight violet
#

I am wondering, are the playablegraphs are updating correectly when you disable them and enable again later?

#

because they still evaluate with the current time values?

mellow plinth
dusty wigeon
#

It seems to me that your "Worlds" might have to much element that are dynamic and updated for low-end console and should look into more aggressive way to cut out. If they are not even invisible.

midnight violet
#

Time.time will always be the same, so you could just disable and enable and the time.time evaluation should still work correct

mellow plinth
midnight violet
#

but that would just be a float to update

mellow plinth
midnight violet
#

I think Simferoce might be right, if you are running into issues with Evaluate, you might have to cut things or decouple animations and states. Does not sound like something easy to refactor 😄

mellow plinth
#

Luckily, at the moment we are not suffering performance problems, but I was preparing the game for the future as currently we are playing with smalls "Worlds" but then we plan to make them bigger, with more stuff 👀

dusty wigeon
#

I am still not sure why you cannot make your animator in parallel inside the PlayableGraph.

mellow plinth
#

I want both

#

Also, some parts of the Animator an in Parallel, and other not

#

And .Evaluate has less Parallel parts than the director

dusty wigeon
mellow plinth
dusty wigeon
#

Parallel means to do thing at the same times.

mellow plinth
#

Like Parallel.ForEach(1, 10, e => {}), this is in parallel, but the code can't continue until it's run.

dusty wigeon
#

Yeah, the animator is the same

#

It cannot continue on the next frame if the last frame is not done.

#

But all animator are update at the same time

mellow plinth
#

The Unity Director does that, in part

#

Also, the Unity director run more stuff in parallel than .Evaluate

#

and run stuff in multiple player loops, so it can run asynchronously in part (schedule in a loop, complete in another)

dusty wigeon
#

Which is exactly what would happen if you update all of your Animator in 1 playable graph.

dusty wigeon
mellow plinth
dusty wigeon
#

And then, you have

mellow plinth
dusty wigeon
#

No ? If you have 1 Graph with all the animator, you have 1 batch.

mellow plinth
#

For Animators, for example, the following trick works better, I guess because it still uses the default graph

mellow plinth
dusty wigeon
#

Bro, how much performance do you need...

mellow plinth
#

I don't want to reinvent the wheel for so marginal gain, but if there was a way to run them in the director with a custom speed I wanted to know. Hence the question 🙂

dusty wigeon
#

You gonna have other issue than animation performance.

dusty wigeon
#

The real solution would be to completely deactivate the animator and do every other update whenever it is required.

mellow plinth
#

I know, if I use .Evaluate(float) I must just feed it with the time since last call.
But if I want to run it in the director, I can disable the graph when not used, and then enable it only in the frames I want to update. And in order to update the delta correctly between this and the last update using the delta between this and last frame (which is not the same), I must be able to feed a custom speed mulitplier.

mellow plinth
dusty wigeon
#

No

#

This is where you are wrong.

mellow plinth
#

Explain me then, I don't understand

dusty wigeon
#

You do not evaluate between both.

#

You just restart from the new position.

#

Let's you have an NPC that is pathing to a location. Whenever the NPC is close to be visible, you activate the Animator.

#

If the NPC is not close to be visible, you do not update it visual.

#

You still "move" the NPC same if its visual is not there.

#

An alternative would be to teleport the NPC to the his location whenever is being visible. The location being estimate in function of the time he as been invisible.

mellow plinth
#

You are talking about doing this outside the playergraph and animator, right?

dusty wigeon
#

Yes

#

I know you have issue with event and maybe other things. But this is what you should fix.

mellow plinth
#

I see

elder pagoda
#

guys, I have the need to do an object pooling system, and I need it to be able to pool multiple kinds of object but need to limit the total amount of objects exist

#

based on docs I guess I can use UnityEngine.Pool.DictionaryPool

#

but the doc on this is very limited and I'm confused on how to use it

#

I'm not even sure it does what I think it does

#

anyone have an example on how to use this?

elder pagoda
dusty wigeon
#

This an alternative more easy to understnad

hoary merlin
#

Could someone please assist here, I'm trying to center this text inside the red area.

GUILayout.BeginArea(new Rect(0, 0, 785, 75), GetBackground(785, 75));
GUI.skin.label.fontSize = 25;
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
GUILayout.Label("Kitchen Nightmare");
GUILayout.EndArea();
elder pagoda
dusty wigeon
viscid flame
alpine dawn
#

Hello, I need some help with raycasting. I have grass over the terrain as independent objects, I want to detect the tag of those objects with raycasting, however grass is only detected when my player jumps, any advice?

alpine dawn
#

Thanks

burnt egret
#

i just recently put assembly definitions into the project so that it compiles faster and has a bit better separation of concerns, ive got a few questions

#
  1. do you like assembly definitions in general or only in medium/large projects?
  2. I've got an assembly definition with code that uses unity's async systems. Now, wherever i include that assembly, i have to include the async assembly that unity uses. This is kind of frustrating, since i was imagining it would work similar to C++ header files where the includes would "trickle down" so to speak. This example goes for other external add-ons such as text mesh pro, and considering that my game is mostly text its kind of annoying to include that in every assembly. Thoughts/solutions?
patent bear
#

To be more specific, a lot of my code live as packages that exist in many projects, so assembly definitions are required

burnt egret
#

Yeah I unfortunately don't have a vast library yet but I do have some things I want to turn into packages and having them use assemblies will just make them better

#

The idea of automating assembly definition dependencies sounds pretty cool though, not sure but if I could extend the class definition of that that should be a pretty nifty editor tool

vivid coral
#
        [field: SerializeField, HideInInspector]
        public float VelocitySqr { get; private set; }

So I have this property inside my scriptable object.
I don't want it to be available in inspector but still be serialized..
but I see this inside inspector
Anyone know why?

hoary merlin
# undone coral use UGUI

Heya, I would although I'm doing everything at runtime, nothing is made in the editor.

I'm making a workshop mod for a game, and the only thing supported it .dll injection

austere jewel
vivid coral
austere jewel
#

field: apply it to the backing field

vivid coral
# austere jewel `field:` apply it to the backing field

I tried it, same thing.
What I wanted was to save some perf by doing,

[System.Serializable]
class TestData {
[serializefield]
float velocity;
[field: ] //serialize this but also hide inside inspector
float VelocitySqr {get; private set;}

void OnValidate(){
 VelcoitySqr = Velocity * Velocity;
}
}
//usage during runtime
Debug.Log(TestDataInstance.VelocitySqr);

However, that hide in inspector doesn't work with serialize or backing field. So everytime I need velocity sqr, I am not doing velocity * velocity;

#

It's not mandatory though, I will just cache the sqr during runtime Start() usage of TestData instance, just wanted to know if it was possible to have the behaviour I wanted

austere jewel
#

Works fine for me

#

I thought you'd need to say field: twice, turns out I was wrong

vivid coral
# austere jewel Works fine for me

hmmm doesn't work for me in scriptable object though.
my TestData class is a separate data class,
so in scriptable object I have this:

[field: Serializefield]
public TestData[] testDataArray {get; private set;} //with Test Data having Sqr property defined inside it

austere jewel
#

The behaviour is no different in scriptable objects for me

#

I am looking at 2023.2 though, so something may have changed between versions

flint sage
#

(it also makes little sense that it would since they're treated the same)

austere jewel
#

I don't see why it would though, because it's just lowered code, might as well be a normal field

latent moss
#

Regarding performance, i currently wonder how to implement update / player movement logic, as there is a crossroad to decide on (both using the new input system):

A)
Regular Update() methods in the scripts constantly read values from unity's new input system and apply inside each script (the "classic" way), so WASD would be read inside the player movement script, Mouse would be read inside the script responsible for casting (rpg, mage, spellcasting), etc.

or B)
Event Driven + Global Manager: also new input system, all input events are referenced in one global script (for better overview), so if for example WASD is pressed, the script would call a public function move() from the player script. If Mouse is clicked, it will call the cast() method of the speel casting script. Benefit: in times where the player does no expensive movement or not pressing keys, there will be no processing of input in update() loops.

But not sure if i missed something. The goal is clearly the aim for performance benefits, as well of having all input references stored in one script, for better overview.

latent moss
# regal olive Anyone knows how to do this?

I believe this may be prevented because of security- if you could load assembly in an apple device, then that would be a major security flaw, as with assembly you could do bad stuff, like accessing the memory of other apps and their stored information.

soft shoal
# dusty wigeon For your insight, we have 450MO of DLL being loaded at the start of the game and...

Hi, friend, I was asking the question about startup time is too long on NX. I'm using NX CPU Profiler.
I've seen that the native profiler (instruments For IOS and Android Profiler for android) is able to auto start sampling at very beginning once the app launches, so that there is Unity Engine Initialization info.
But seems like there no such behavior on NX CPU profiler. No matter how I attach to my app, I have to manually click start sampling.
Did u do such analyze on NX before?

dusty wigeon
soft shoal
#

emmm alright thx

dusty wigeon
# latent moss Regarding performance, i currently wonder how to implement update / player movem...

If you are looking for performance, you should definitely use an Event base approach. In fact, I think this was one of the perk of the new Input System.

However, most of the time, input is not that costly. There should be a minimum of script reading inputs at a times and those script most of the time has something else to do.

Also, by looking at your example, I'm worry that you might implement the system in a non flexible way. The input should always flow from the logical owner to the deepest owned. What I mean, is that you should read input in such a way that you can amend the behaviour to be able to "consume" the input. This way you have better control whenever there is alternate context where you should not do an action such as when you use UI in game. Worst than that, in my opinion, you should also decouple the Input from the Character such as you can control a Character by faking input. This can be useful if you have to create cinematic or have to transform your Character in an "AI".

earnest ridge
#

Why is calling a function from a different class/struct that only draws Handles laggier than if drawing from the Editor script itself?

latent moss
latent moss
# earnest ridge Why is calling a function from a different class/struct that only draws Handles ...

In my case i am planing to release my game on steam and so i try to squeeze out any fps i can, through the whole development phase. I agree there would probably no noticable difference for this change alone, but for HPC all these tiny bits matter. For the scenario i explained, the goal was to not have the inputs checked in update() constantly, i rather wanted to have them checked only if a key is pressed to avoid unnecessary code logic in update() loops. So the whole movement logic would only be executed when the user presses a key. Hope this explains it well enough.

hushed fable
earnest ridge
latent moss
latent moss
dusty wigeon
hardy sentinel
#

sheesh 'Buffer' looks massive 😄

#

that is an InputManager, right?

dusty wigeon
latent moss
dusty wigeon
#

The buffer is an intermediate class which allow the interfacing of Character/UI with his controller (Player or AI)

#

It can also be useful for Cinematics.

#

The only part that would say is necessary is

latent moss
hardy sentinel
#

imo smth plain like this would be all that's needed:

class InputManager : Singleton {
    List<IInputUser> inputUsers = new();
    Dictionary<KeyCode, KeyBinding> keyBindings; //populate somehow

    // In-game input, UI input, cinematic input, or whatever could plug their input in and out dynamically whenever they are active/inactive.
    public void Add(IInputUser user) => inputUsers.Add(user);
    public void Remove(IInputUser user) => inputUsers.Remove(user);

    void Update() {
        foreach (var (keyCode, keyBinding) in keyBindings) {
            if (Input.GetKeyDown(keyCode)) { inputUsers.ForEach(x => x.OnInput(keyBinding)); }
        }
    }
}
#

no cross references either -- and the dependencies are corrected

latent moss
dusty wigeon
#

By example, you want your character to cast a spell in a cinematic.

hardy sentinel
#

ah, I see

dusty wigeon
#

Instead of directly calling the function, you use the input as if you were controlling the character.

latent moss
dusty wigeon
#

That being said, there is other alternative.

#

Using a buffer inbetween is a way that worked for me.

sage radish
#

In my opinion, something like casting a spell should already be a high level concept that should be easily invoked without faking input or digging into the internals of some script.

dusty wigeon
#

It depends. Some spell may have multiple stage where you charge the spell. You can either make the player manage the spell or let's the spell manage itself.

latent moss
#

These are all interesting points indeed

dusty wigeon
#

Making the player manager the spell add unnecessary code to the player in my opinion. Whenever you have multiple way a spell can be use. It can start to blob the Player/Character

sage radish
#

I've seen some bad input implementations that have led to bad performance. For example, I often see the OVRInput script in the Oculus SDK with 0.5-1ms in the profiler. This is because it's processing all input from all controllers, regardless of whether it's read anywhere.

dusty wigeon
#

This is why you should know what are your objective.

hardy sentinel
dusty wigeon
#

And what are your plateform.

latent moss
latent moss
#

Oh ok

hardy sentinel
#

it's far from a millisecond 😛 0.05ms in worse case, and typically I'd say 0.01ms even if u have tons of input

latent moss
#

and console?

dusty wigeon
#

Depends which

#

I would say low end mobile

#

But something like the Switch or a PS4 will be able to handle those just fine.

latent moss
#

Guys, i thank you really much for the great advices, you all have legit points i will take in consideration for the decision. I tend to Option B) as i feel there was the most consensus from each of you who helped here. Thank you very much, great help! 💪

abstract hill
#

Hi everyone, I'm unsure if this falls into general or advanced but I was wondering is it possible to run multiple simulation with the same physics setup. I know you can do both:

Physics.Simulate(Time.fixedDeltaTime);
physicsScene.Simulate(Time.fixedDeltaTime); 

However when trying to simulate something 200* a frame, things start to chug. I've looked into this a little bit and it seems that the major impact is the set up phase for the physics when calling simulate. Is there a way to avoid this or is it required?

What I need this for is just to render the trajectory of a projectile. I would usually use the Kinematic Equations and just do this as a equation over time, however since the projectile has custom physics running on it (in fixed update), I'm assuming the only real way of doing this is to create a new Physics scene, create the projectile there and then simulate and manually call fixed update from within a loop.

Is there any faster way of doing this? Or any suggestions that I could do this in a different less expensive way?

hardy sentinel
dusty wigeon
craggy spear
main pawn
#

sorry I considered entity slightly advance and maybe it is conected to code, that's why I asked this. sure ill ask there

craggy spear
#

these code channels are for discussing code you write

abstract hill
#

@hardy sentinel I agree, though the problem is I am trying to match a trajectory of a projectile that was once fired. It needs to be accurate to the original path and also effected by collision. The problem with a mathematical approach is that it is too true to the real world physics. Comparing manually simulated physics to the projectiles path when using a pure maths based model I get ever so slightly different paths.

@dusty wigeon Much in the same way, I can't really decrease the simulation time, since that would also make the projectile no longer accurate to its original path (which was generated using fixed updates delta time). A projectile with a lower simulation time seems to fall a lot shorter then that of one with a higher / more accurate time.

As such I don't think changing simulation step time will work, instead I was wondering if there was a way to manually call the PhysX functions. Looking into the code it seems that physicsScene.Simulate calls Physics.Simulate_Internal. Which intern calls Physics.Simulate_Internal_Injected. Which finally ends here with the rest being called externally.

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Simulate_Internal_Injected(ref PhysicsScene physicsScene, float step);

I'm wondering that if Unity itself can call these functions and run its physics in the background is there a way that we can also?

dusty wigeon
abstract hill
#

Hmm, okay. Thank you, I thought it may be but wanted to check. I'll see if I can think of something else that can fit for what I'm trying to get done. Thank you both

hardy sentinel
#

GPU physics pog

gentle pebble
#

Hey, I am looking for someone who is good with PlayerPrefs

#

dm me

fresh salmon
# gentle pebble dm me

No, you can ask your question in the most relevant channel here. If you're afraid your question will get buried, make a thread. Anyone can make threads here

gentle pebble
#

ok amigo

obsidian glade
nova steppe
undone coral
#

@latent moss if the player's inputs are driving the camera...

  • there is time between when the input is read and when the frame is presented to the user
  • so if you read the input in Update (which is the default when you use input events, so evented still means Update loop by default), and that Update happens to be very early...
  • the input you read may be dated at "time = 0ms". you position the camera
  • then the rest of your scripts run for a duration of 5ms
  • then you render for 5ms. so 10ms have elapsed so far.
  • then you wait for vsync (on a switch for example), so another 6ms.
    okay, regardless of what you are doing, your input was 16ms out of date. if you are targeting 30fps on a switch, it could be 30ms out of date.
  • so... it doesn't matter how long you spend processing the inputs provided it's less than 6ms in this example, if the moment you are reading them is far away from the time the camera picture is presented on frame
#

i don't know if you've been playing fortnite on the switch, but between 2018 and now there were huge changes to deal with input lag, including fixes from nintendo, because that platform is especially bad

#

i have no idea what input lag is like on a switch nowadays, but it has one of the worst architectures for FPS / input-driven cameras

abstract hill
# obsidian glade as a suggestion not mentioned yet, can you simplify the physics in the separate ...

Thats what I've done. Basically have a copy of a second scene generated through code on start that remains empty. Then I cache the physics scene.

On needing to start the trajectory test i create the projectile as a new game object. Move only the necessary geometry over and then inside a for loop run Simulate over and over.

Unfortunately the problem is the set up time used by simulate. Even with only one projectile and an empty scene the most I can get is around 100 framers per frame. Which I do understand is petty good. But ideally I would want around 500 -> 1000.
(But at 200 fpf we start hitting 15 fps).

obsidian glade
#

I can't imagine that would increase performance enough to go from 100 to 1000 iterations though

#

think you'll need to consider one of simferoce's suggestions

abstract hill
#

Will do, defiantly thought it was worth asking though, learning in recent months that there is a lot more in the engine that can be done if the right sort of tools are used. ^-^

#

Thank you

dapper cave
#

is this known bug that 2 overlapping screen-space camera uGUI lose the canvas stuff from the one below?

grim oxide
#

How can i Check if a particle system is a subemitter within a script? thinkPeepo

#

I can check if it HAS subemitters... thinkPeepo

#

But not if it ahs parents

lavish yew
#

RPG Maker Runtime

midnight violet
latent moss
# undone coral is this an FPS?

Thank you for the valuable input! ✌️ It's an rts like game with many units (thousands), so i have to keep an eye on performance, even if its only a few fps here and there. I have no experience with platforms like Switch so it is great to hear what obstacles to expect, when building for consoles. Main platform will be PC, but if console works out too, then that would be great.

#

Will definately keep this in mind, thanks a lot!

latent moss
# nova steppe can some one pleae help me https://discord.com/channels/489222168727519232/4978...

The error message indicates that there is an issue with the serialization for the players script. Unity's serialization system requires that all fields in a class are marked as either [SerializeField] or [System.NonSerialized], and any fields that cannot be serialized will cause the error you're seeing. You could try to add [System.NonSerialized] infront of the autoStartServer variable, so like this:

[System.NonSerialized] bool autoStartServer;

Chances are good that this resolves the problem.

midnight violet
#

But a simple bool serialisable, isnt it

latent moss
midnight violet
latent moss
#

maybe he can post the problematic file(s) here, that could indeed give more clarity about the root of the problem

modest ivy
#

Is there anyone know how to use ObjectParameter<T> in srp VolumeParameter?

#

I get error(Object reference not set to an instance of an object) if I write like this

nova steppe
lapis summit
#

Yo I'm tryna make an advanced AI for my game

#

and rn i'm having the issue of not being able to keep the enemy away from the player (ie, at its stopping distance)

#

how do i make the enemy move backwards when the player comes too close

midnight violet
lapis summit
#

although i am working on creating my own a* pathifinding

lapis summit
# lapis summit navmesh

would i set the new destination as player destination - stopping distance away from the player

#

or would i just find the distance between the player and the ai and then move the enemy the remaining distance

#

again by setting a new destination

#

i can't really think of anything else

midnight violet
lapis summit
#

tyvm

#

implementing that is going to be a bitch

#

but hey thats our job isnt it

hybrid plover
#

I'm writing a converter for URP to HDRP since there is none found online. my workflow is that you take your mesh, materials and textures, package them and import them in a hdrp project.
The good thing is that the YAML is still the same so the object doesn't lose its data. But the problem is that when i try and debug the YAML values, they return wrong values. Any clue what could be the reason for this? that is doesn't have a shader? my current workaround is actually reading out the YAML file but this is a slow process.

Example:

#

Here you can see, the bumpscale is set to 1

#

when i log the bump scale

#

It returns zero

#

When I do the same in the urp project, i get 1

#

Any tips on how to get around this faster?

icy glade
#

Hi all. Got a weird issue with Advertisement. When I use the Advertisement.Initialize (after saving the script) and run the game it initializes properly. If I stop the game and run it again it won't initialize at all or give any errors. If after that, I add a space to the script file and save it and then press play it will initialize properly again and then if i press stop and play again it wont until I save the .cs file again. Any ideas?

long ivy
#

maybe Advertisement isn't set up to work properly if domain reload is off. Project Settings > Editor > Enter Play Mode Settings > Ensure Reload Domain is checked and test again

icy glade
latent moss
# nova steppe But aren’t bool serializable anyways

Thats what we (user twentacle and me) also wondered about, it should usually be serializable as bool is a native type. Is it declared like this in the code? -> "bool something = true;" ..or false. If everything looks normal there, i would check next if there any cast or type conversion in a later stage of the code. But honestly its hard to tell without access to the files that throw the error and further guessing could lead along a false path.

latent moss
# undone coral is it a multiplayer rts?

Luckily it's singleplayer (luckily, because i did multiplayer before and that has other obstacles in terms of performance). Here, it is a singleplayer, but rts mostly requires a lot of units and moving these costs already some fps, aswell as rendering, obstacle avoidance, etc. So i must save fps at all places. Regarding the initial quesiton, i have now followed the manager / event based approach of input system, and so far i am very happy with it, its clean and i was able to have almost all checks for input removed from update (some updates() even removed completely), now only left with the ones you've mentioned like WASD and camera, those two are still in update. But the rest, is pushed into the assoiciated scripts by events. It seems atleast like a working way imo, would recommend 👍

latent moss
# lapis summit implementing that is going to be a bitch

you can use a Physics.SphereCast() for this to detect all colliders within a certain radius. With that, you can also detect the colision point and get the angle from this using "normal" (so you can detect if a collision happened left or right from the AI). Here is a snippet implementing this, it's from a local avoidance AI i did in a prototype:

EnemyCollisionPoint = new RaycastHit();
if (Physics.SphereCast(transform.position, CollisionRadius, transform.forward, out EnemyCollisionPoint, CollisionRadius, nonObstacleLayers)) {
    float angle = Vector3.Angle(transform.forward, EnemyCollisionPoint.normal);
    // here we check if the angle is within a 180 degree range in front of the enemy
    if (angle > 90 || angle < 270) {
        // and here if the hit occurred on the left or right side of the enemy and turn player into oposite rotation
        if(EnemyCollisionPoint.point.x < transform.position.x){
            transform.Rotate(new Vector3(0,90f,0));  // we get a hit on the left side, to turn right
            Debug.Log("Collision happened: left");
        } else {
            transform.Rotate(new Vector3(0,-90f,0)); // we get a hit on the right side, to turn left
            Debug.Log("Collision happened: right");
        }
    }
}

Here is a pastebin, for better view: https://pastebin.com/PnRsZQ3v

#

You can use ".normal" also for a raycast, so if you shoot a raycast against a wall which you are not facing 90°, hit normal can tell you to what side the wall is rotated:

// RHitS is a raycast Hitpoint
avoidingObj = RHitS.transform.name;
float hitAngle = RHitS.normal.x;    // hit.normal, super usefull in this case!
if(hitAngle<0){  
    transform.Rotate(new Vector3(0, 90, 0));  // we get a negative value for hit.normal, so turn right
    //Debug.Log("HitS");
} else {         
    transform.Rotate(new Vector3(0, -90, 0)); // we get a positive value for hit.normal, so turn left
}```

As i am not sure if its clear from writing alone, here is a vague display of the concept (only to demonstrate the use "normal". For your case, which was player distance, refer to the SphereCast):
jaunty creek
robust drift
#

I want to try to program my own simple lip syncing system. However, when I try to find resources I either find animators explaining how to manually lip sync an animation, or adverts for lip sync plugins. Does anyone know any resources for learning how programmatic lip syncing works?

#

Doesn't need to be specific for Unity, I just want to understand the underlying core concepts, I can figure the rest out myself

latent moss
# robust drift I want to try to program my own simple lip syncing system. However, when I try t...

I have no xp with this, but i would probably look at this approach: if the face where the lips are recorded is looking straight into the camera, you can use that image as 2D space (x and y axis) and think of a square. Then if you put 3 dots on each lip, where one dot is in the middle, the others between side and middle. If the lips then move, the dots will move on an x/y axis (mostly on y) and you can measure the positional coordinates of each dots. For example an "o" would result in bots middle dots showing much movement, one dot going up on y, the other one down (so you get something like -1 or other negative float value). From there on, you have to capture each letter and maybe spoken words with their coordinates and associate those.

robust drift
#

The actual animation part is pretty simple, but the thing that I need to understand better is how to actually capture the spoken letters/words. I'm curious if it's even possible without using some sort of speech recognition AI

#

I think maybe I'll take a look at some of the plugins and see if I can glean some hints from there

latent moss
#

my answer was refering to capture

#

you literally put dots on a humans lip

#

this kind of is how hollywood performs motion tracking in general

latent moss
patent bear
nova ivy
#

I am trying to create a remake of an old game and want to use the original game's assets. The assets primarily consist of PNG files that I want to use as UI sprites.
The problem is, because I don't have the rights to publish those assets, the built game and game repository needs to ship without the actual PNG files. During development, the assets need to be available in the editor so I can create the game using them, but I have to build the game without the PNG files being present in the binaries. When starting the remake, the PNG files should be loaded in at runtime from the original game's install directory. How can I do something like this in Unity?

midnight violet
nova ivy
midnight violet
nova ivy
#

Do you know OpenTTD?

#

I am pretty much trying to do that, recreating a game from early 2000s because the original source code does not exist any more. And of course the project is open source and non profit.

#

And anyone who wants to play is required to own the original game.

#

How is that copyright infringement? It's basically a mod.

#

Why would you just assume I am doing something illegal and tell me I am "faking my reality"? 😂 That's pretty rude.

midnight violet
#

A mod is a modification to the original game. You are doing your own version of it but using the assets. I do not know about the games copyrights, but you should be either sure they allow it or enough time has passed. Also OpenTTD is based on personal use. I am not sure how personal it gets when you make it open for everyone. But if you are sure about that, go ahead.

nova ivy
#

Also OpenTTD is based on personal use. I am not sure how personal it gets when you make it open for everyone.
How is OpenTTD not open to everyone when I can simply download and play it lol

midnight violet
#

As I said, it depends on the games copyrights, but if you are sure and with your examples "someone else did it too", go ahead. Seems valid if EA did not cry about OpenKeeper or others about TTD and similar

nova ivy
#

You are still assuming that I didn't talk to the copyright holders about this. My question was not whether this is something I am allowed to do, but how to use assets in this way.

midnight violet
#

And OpenTTD seems not to be using the original artwork "At this time (February 2022), proprietary data files from the original TTD are not required to play the binary packed game. " just for your interest

#

And you are right, if someone wants to hop in on that, feel free. I am out of this discussion

nova ivy
#

Anyway, I know I can use Addressables to load assets at runtime and exclude these assets from the build. But I don't think that would require the user to build the Addressables using the Editor themselves, instead of just running the game, which will then build the Addressables at runtime and use them. Is there a way around this?

devout hare
#

You can read files from anywhere using normal C# methods

#

The original files wouldn't be in Unity asset format anyway so Unity asset loading methods are of little use here

#

(I'm assuming it's not a Unity game)

nova ivy
#

But that would require creating usable Assets (e.g. Sprite objects) at runtime for each file and configuring all the metadata like PPU and everything from a script. I don't think that is very practical. The PNGs are available to me during development, so I can import them and create the metadata in the editor, but they need to be omitted from the build and then loaded again during runtime.

devout hare
#

You can make the game using the original pngs and then replace them with placeholder images and load the originals during runtime. The build then contains only the placeholders.

nova ivy
#

And how would I do that?

devout hare
#

Which part?

nova ivy
#

I mean I could write a build pipeline that replaces every PNG file with some placeholder file and builds the game with those placeholders. But then all the sprites would be these placeholders. How can I re-replace the placeholders with the real PNGs after the game was built?

#

I don't think that's possible, because the PNG files don't exist in the original form in the build directory, but are encoded somehow during the build process, if I am not mistaken.

devout hare
#

Read in the png file, change the SpriteRenderer to use that file

#

I haven't done it myself but it's definitely possible

nova ivy
#

Again, while this is possible, it is extremely inpractical. Imagine one of those PNG files is a spritesheet, which needs to be split up into separate sprites. This is normally done using the sprite editor. When the PNG file is read from disk during runtime, you would need to do the splitting in code. The same applies to all the other import settings.

devout hare
#

Right, that's what your game would have to do

nova ivy
#

There are definetely better ways that will still allow me to use the inspector to predefine import settings for all the files. I know this is possible using Addressables as I explained above, but this would require the user to build the addressables using the Unity Editor, since it's not possible to build them from runtime, I think.

robust drift
versed coyote
#

I have a grenade game object that on collision will play a VFX and SFX. I'd like to destroy the grenade GO as soon as the SFX has finished. However I could not find any event listener on AudioSource for that. Any idea how that can be achieved? Destroying a gameobject after an audio source has finished playing the sound?

hushed fable
#

You generally need to poll with most Unity things

versed coyote
#

hmmm ok will try if that is nicey

versed coyote
versed coyote
#

@dusty wigeon thanks. How did you find those so quick?

dusty wigeon
# versed coyote <@208422197348401152> thanks. How did you find those so quick?

By using google. I knew that ParticuleSystem is one of the alternative for VFX.
https://www.google.com/search?q=particlesystem+api&rlz=1C1CHBF_enCA958CA959&sxsrf=APwXEddkXfKghsjLCnWyZm4kvzJ9Bf-KIQ%3A1680265607486&ei=h9EmZM2yHeudptQP9L-9uAE&ved=0ahUKEwiNkqaVlYb-AhXrjokEHfRfDxcQ4dUDCA8&uact=5&oq=particlesystem+api&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIHCAAQDRCABDIICAAQigUQhgMyCAgAEIoFEIYDMggIABCKBRCGAzIICAAQigUQhgM6CggAEEcQ1gQQsAM6BQgAEIAEOgQIABAeOgYIABAWEB46CAgAEBYQHhAPOggIABAFEB4QDToICAAQCBAeEA06CggAEAgQHhANEA9KBAhBGABQcFjwCmCHDWgBcAF4AIABYogBwwKSAQE0mAEAoAEByAEIwAEB&sclient=gws-wiz-serp

The other, I searched and found a link to some user response.
https://www.google.com/search?q=unity+VFX+Graph+how+to+know+if+it+is+playing&rlz=1C1CHBF_enCA958CA959&biw=1920&bih=1089&sxsrf=APwXEdeKQUAph62j7NPdEuCITmm_ndnpFw%3A1680265690688&ei=2tEmZJXdKY6HptQPsq-32Ac&ved=0ahUKEwiVsvy8lYb-AhWOg4kEHbLXDXsQ4dUDCA8&uact=5&oq=unity+VFX+Graph+how+to+know+if+it+is+playing&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIFCAAQogQyBQgAEKIEOgoIABBHENYEELADOggIIRCgARDDBDoKCCEQoAEQwwQQCkoECEEYAFDGBljNCGCdFGgBcAF4AIABb4gBlgKSAQMyLjGYAQCgAQHIAQjAAQE&sclient=gws-wiz-serp

Now knowing the component, I searched for
https://www.google.com/search?q=unity+visualeffect+api&rlz=1C1CHBF_enCA958CA959&sxsrf=APwXEdfVS6IZza313FfyVz-JUWNDUeZrVg%3A1680265763774&ei=I9ImZP_vLqmmptQPs42NaA&ved=0ahUKEwi_jenflYb-AhUpk4kEHbNGAw0Q4dUDCA8&uact=5&oq=unity+visualeffect+api&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIHCAAQDRCABDIICAAQigUQhgMyCAgAEIoFEIYDMggIABCKBRCGAzIICAAQigUQhgM6CggAEEcQ1gQQsAM6BggAEBYQHkoECEEYAFB1WIQIYPwIaAFwAXgAgAFbiAGsAZIBATKYAQCgAQHIAQjAAQE&sclient=gws-wiz-serp

patent bear
#

Phoneme Detection

versed coyote
random dust
#

Wish I got paid for my Google skills

#

Then again, I do get paid for what comes out of it