#archived-code-advanced
1 messages · Page 19 of 1
Assuming I understand, you could do this but that would require you to instantiate TestColor instead of Test1 which is probably not what you want
class Test1<T>
{
}
class TestColor: Test1<Color>
{
public void Blur()
{
}
}
Otherwise extension methods is the way to go
Surprisingly I didn't think of that but it isn't what I am looking for, thank you though!
Yeah in that case, extension methods
is it possible to convert euler angles to quaternions in javascript ?
It's just math so why not
DOTS physics is also deterministic (on the same machine)
Havok may even be less deterministic by default. DOTS physics is stateless but Havok is stateful.
https://docs.unity3d.com/Packages/com.havok.physics@0.6/manual/faq.html
While you could do this with extensions, you generally want generic classes to be, well, generic. If you're changing behaviour depending on the type there's probably a better option.
Hi. I’m making a physics based spaceship game where ships are rotated by torque. To make sure enemies can aim correctly and not overshoot, I use PID controllers. It works very well enemies have very good aiming.
The problem is once I start the design process of tweaking the torque power of the enemies, the pid controller is broken and the controllers need to be tuned. This makes the iteration time painfully slow
Has anyone dealt with a similar issue? I’ve used a genetic algorithm to automate PID learning but it takes 10mins with the computer at 100% so iteration is still slow
I’m considering if PID controllers are the best solution
so long as you stick to correctness/realism as your top priority, a PID approach is your only option. If you opt for a less simulation driven (kinematic) approach you can do it all with closed formulas and interpolation
at the end of the day what matters most is game feel and correct physics usually get in the way of that.
I think there’s a holy grail somewhere in this problem though. I think there should be a way to automatically tune (ie deterministic, without genetic brute force) PID controllers based on the max angular acceleration. I’m just not good enough at math to figure it out lol
Realistic and feeling good movement are pillars of this game and why I invest a lot of time in it
Tuning a real physics thing for a specific effect is very difficult and not something easily automated. Just look at tuning/setting race cars and launching rockets or walking robots. It’s a black art, a slow iterative process, ML can help.
Hello!
My managers are derived from the same base class. I can not assign them to base classes' array field.
You're not dragging an instance into a field. They must be instances of components or scriptable objects to be serialized references.
hmm I'll initialize them via constructor then. @austere jewel
If they're not UnityEngine.Object types, that's definitely how you do it
Thanks!
hi guys, trying to use reflection to call a method on a class but getting this error that is commented in the code, but sure what it means tbh..
{
Type myType = typeof(UnitStats);
FieldInfo myFieldInfo = myType.GetField(statInfo.Name, bindingFlags);
if (statName == statInfo.Name )
{
// ArgumentException: Field moveDistance defined on type UnitStats is not a field on the target object which is of type System.RuntimeType.
object myObject = myFieldInfo.GetValue(typeof(UnitStats));
MethodInfo myMethodInfo = myObject.GetType().GetMethod("");
object[] args = new object[] { percent };
myMethodInfo.Invoke(myObject, args );
return 0;
}
}
return 0;```
GetValue(object obj), obj is an instance of the type you're getting the value from. It's not the type.
(if the member is static that instance is just null)
right that makes sense, the instance isn't static, need to think what this instance should be i think i know it
thank you
I have octree GetNearBy method by max distance (radius) but I want k-nearest neighbor. How can I change it?
Because finding neighbors using radius sometimes for example returns 3 points and sometimes 100! It is not fixed
Do I have to sort the result or add them in a heap (priority queue) when finding them?
kLog(n)
n: number of result points
k: number of nearest points
hey mate, i wanna return a value from the method invoke is that possible? it doesn't seem possible
return myMethodInfo.Invoke(myObject, args );
It returns an object, you just need to cast it to the type you're expecting
(or keep it as object if you don't know what it is)
oh of course, ok thank you
Hi everyone, when I assign a value to a float without any calculations, like for instance
float myFloat = 7071077f, it should always be exactly the same value on different x64 machines, because floats are 'accurate' by up to 7 digits, correct?
(And if I would assign a value with 8 digits, float myFloat = 70710771f it wouldn't always be exactly the same value)
No, there's no number of digits in particular that guarantees this. The number of digits is a rough estimate
hmm, okay then I'll have to look out for that. Thanks!
Kimbatt's deterministic physics implementation uses floats this way (although for in-place casting instead of field assignment).
https://github.com/Kimbatt/unity-deterministic-physics
Here you can see an example in his readme on soft floats: https://github.com/Kimbatt/soft-float-starter-pack
In his testing he seemed able to get away with it 🤔
For floats with more than 6 digits he's using hexadecimal values like this
public static sfloat FromRaw(uint raw)
{
return new sfloat(raw);
}```
sfloat k_cosMaxMergeAngle = sfloat.FromRaw(0x3f3504f7);```
Seems to be quite a lot of conceptual/terminology misunderstandings here
if something is accurate up to N digits, it means by definition that it's inaccurate after N+1 digits
so if you have numbers 0.70710701f and 0.70710702f they're both accurate to 7 digits but not the same number
That said, I'm pretty sure (but not certain) that float constants are the same everywhere. The issues come from operations like addition (0.2 != 0.1 + 0.1)
That's what I assumed aswell but I couldn't find any information on it 🤷♂️
At least that's what the soft floats library thing assumes
But for large numbers he uses hexadecimal values in his code
I don't see any evidence of that?
sfloat a = sfloat.FromRaw(0x00000000); // == 0
sfloat b = sfloat.FromRaw(0x3f800000); // == 1
sfloat c = sfloat.FromRaw(0xc2f6e979); // == -123.456
sfloat d = sfloat.FromRaw(0x7f800000); // == Infinity
0 and 1 are not large numbers
so he uses sfloat.FromRaw()
But for values like 2.0f he simply casts to sfloat
That might be just a style issue, or the reference values come from somewhere. You'd think that it would be mentioned in the documentation otherwise.
Idk, should I notice that casting floats with lots of decimals to sfloat not being deterministic I'll give FromRaw() a try 🤷♂️
you're fighting the good fight
this is an interesting project
VR Cloud Manager
you're on the start of a very, very long journey
i forget, the plugins, are they streaming something? data or audiovideo?
did you consider authoring a physics engine with networking* as the primary goal?
there is a lot of gameplay that works with that
with those constraints*
it's networked right, that you're after, not necessarily deterministic?
no, just physics for my wip rts game. But who knows, parts of it might end up on the Unity asset store, but not anytime soon.
as a single player game or multiplayer?
I'm using lockstep networking. If physics should actually be relevant to the gameplay it has to be deterministic.
https://github.com/skyteks/WarKingdoms is this you?
oh no
nah
that's Skyteks he's actually in this server lol
Is it possible to convert a world position to screen position even outside the camera frustum?
Sometimes, the built-in functions returns some weird numbers so, is there a workaround for this? This is somehow related:
https://forum.unity.com/threads/worldtoscreenpoint-bug-returning-huge-numbers.536564/
But I don't intend to do the same thing. I'm trying to get the screen coordinates of the 4 corners of a plane without clipping the results.
I had an awful experience trying to do that. Ended up using this but my use case is not the same as yours but maybe you can re-use it https://github.com/jinincarnate/off-screen-indicator
PLEASE! Is here anyone who can help me with netcode? I'm loosing all my braincells!!!
Yes, in #archived-networking
thx
this is nice
i also have seen this issue. many people have
i am not 100% sure why it occurs. I used to believe it happens because the camera is moving
I think it happens when you get close to the 90deg angle to the camera
Because if you think about it 90deg from the camera would be infinite
yeah this is not my use case but thanks for this! I'm afk now but I'll see if there's something I can get after I get back.
this makes sense but I don't think it only happens at that angle, I'm not sure as I still cannot determine tbh. All I know is if it's outside the frustum then it becomes pretty random at times.
hi, not really advanced but other channels seem to be in use, i've created a scriptable object but it won't show up to be created despite the [CreateAssetMenu] attribute and i have no idea why
#archived-code-general is a fine place to ask
thanks :) i just thought i should wait a bit in case someone replied to the one above
post your code to a paste site
[CreateAssetMenu()]
still isn't showing up :/
Then you must have a code error because it works for me
yep had a code error in another script thank you!
Always, always, always check the console
Hello, I just noticed in my code I have some reference to GameObjects that are active (activeSelf = true, activeInHierarchy=true) but they do not exist or are not visible in the Scene on the Editor.
Such reference is a static reference to a GameObject
static GameObject cameraObject;
I wonder if somebody can help me understand what is happening here.
Thasnks!
what are the hideFlags?
Also
is it a prefab:?
Prefabs don't exist in the scene
duh, that makes sense, I didnt know you could set flags to a GO to hide it on the Scene
thanks for the clarification
No it's not like it seems. It's a communication library for our backend. 😀 But cool name is not it
Does anyone have any experience with digitally signing unity .exe files on Windows 11? Would like to get rid of that ugly "don't trust this software" screen.
Main question is if you need a cert from a CA, or if you can self sign?
wow, these bloody certs are expensive!
How much lol
hundreds of dollars
Also how do those thousands of games on steam for example not have that?
They certainly dont just buy certs right
from https://www.reddit.com/r/Unity3D/comments/645y7k/should_i_digitally_sign_the_stand_alone_player/
"If you're worried about the message popping up when launching via Steam... it won't. Steam games are run through their launcher which avoids these issues. This also solves the bigger problem of unsigned Mac games not even being able to run without Gatekeeper disabled.
tl;dr No need to sign it for Steam, do it elsewhere if you really want to."
Ah
I'm distributing on itch, I haven't looked into Steam, but my understanding is its a pretty involved process to put something on Steam.
Still sucks though if you wanna let people buy/download from your own site
doing a little more research, I'm wondering about the implications of signing a project with an IV cert, or if you even can? I don't currently have a business license.
Isnt there something like certbot, which is for ssl, but for applications? 
I answered my own question. With anything less than an EV cert, you have to have thousands of downloads verified to build reputation with Windows Defender Smartscreen, and not see the warning message. With an EV cert, you get automatic recognition.
It looks like you can qualify for an EV cert as a Sole Proprietorship. You would need to get a DUNS number, or a letter from a CPA.
Honestly, I'm going to do some research on deploying XR Interaction Toolkit apps to Steam VR. That might be a lot cheaper, and less legally fraught.
(talking to myself at this point, sry!)
Hello!
What is the best way to store API endpoints in unity? I want to put them all into a static class as constvalues. Is this approach ok?
I have almost one hundred APIs
generally you have a repository
we used that approach for a multiplayer game at my old company. we had about 20-30 endpoints written as constants in a static class. you can make nested static classes for different categories of endpoints, so the code is easier to read and navigate through
it worked out fine for us. the endpoints all had the same base URL, which we stored as a separate constant that was referenced by them (easier to change from development to live APIs and vice versa).
the main thing to watch out for is not to publish builds with the wrong base URL (for this, you could consider a configuration file or something similar)
i could understand that being a config file or something
but wouldn't you just wrap it in a repository
why have statics
if anything it would be constants in the repo
or a scriptable object
if all he needs is a place to get some unchanging URLs from, a repo is superfluous, imo.
a SO is a good option too, and it's more editor-friendly, but then you have to keep a reference to it somewhere so you can access its values
Hey, i wonder if you can overwrite in an extended class a field from the base class
So if i have ItemPicker with an Item type field. Create an ItemPickerExtended with ItemExtended field (without creating additional fields)
I'm not sure thats a thing, you can use Item base type in ItemPickerExtended and use
if (item is ItemExtended itemExtended)
{
itemExtended.DoExtendedStuff();
}
@scenic sapphire u cant override fields, only methods, you can technically hide an inherited field by doing something like:
public new bool ShouldHide = false;
in the derived class, this will cause an error if both the base and derived class serialize said field.
Alternatively if the 2 fields have the same base class then just keep the one in the base class.
For example:
public class A
{
public Item item;
}
public class B : A
{
public ItemExtended _item;
}
A.item can store instances of ItemExtended but B._item can only store ItemExtended not Item
great explanation, appreciated
hello. i was told by phota to ask here: why
Debug.Log(cellDict[tileLocation].Position); reports position
but
Debug.Log(cellDict[tileLocation] == null); reports true ------- here is code, sorry in advance for all the comments but i figured it was better not to delete bc then our lines wouldn't line up http://pastie.org/p/00uBFlm9AK1ihr1j7QmaoR
true as in null
yeah, this part specifically
last 2 lines, first debug reports true but last line can get position
thank you, i should have included that. i'll save it for the future. also sorry about misspelling your name there xD
what do you mean repository? monolithic approach can be done here as well?
I have written the API as monolithic with 3 physically separated layers. But have not seen any example how to communicate with the backend in Unity in this way
That is why I am making a library that consists of managers and a general manager, to make the unity frontends job easy, they all will be using only Unity Objects to interact with the backedn.
@real plume what happens if you use a single Debug.Log?
Thanks!
Ill stick to this approach!
just to confirm when you say api endpoints
you mean rest apis right?
or graphql etc...
yes, rest apis
have you heard of the repository pattern?
not for unity
don't think it matters if its unity or not at that point
cause repositories normally get DI'd but you can't do that in unity
so i guess you just hold it in a some sort of reference object
but there is no DataAccess layer in unity since Unity won't be calling DB functions.
its not necessarily just for sql data
the datasource can be from anywhere
like rest apis
hmm. have not thought about that. you re right!
its why repos are normally interfaces
base implementation + concrete where ever the data is
but then the responses of APIs matter a lot. They need to be in the same pattern and a very good error handling should be done.
otherwise the unity side blows up. Am I right?
then you need single point of entry
that has a validator that runs through
generally i would use fluent validation but have nfi whats supported in unity
I used fluent too in the backend
why is it 100 api end points btw?
i'm sure you can break it down into multiple parts
No we have about 40. its just exaggeration 🙂
fair enough
first, I'd check for == override for that class and confirmed there's no weird null equality condition there, something like "it equals null when instance isn't initialized with values"
apologies i missed your message. what do you mean single?
thanks @pliant crest
public class OnLoginAttempt : UnityEvent<bool, float> { }
public class OnLogoutAttempt : UnityEvent<bool, float> { }
public class OnOTPSendingAttempt : UnityEvent<bool, float> { }
public readonly OnLoginAttempt onLoginAttempt = new OnLoginAttempt();
public readonly OnLogoutAttempt onLogoutAttempt = new OnLogoutAttempt();
public readonly OnOTPSendingAttempt onOTPSendingAttempt = new OnOTPSendingAttempt();```
Is there any way how can I pass an object that is derived from UnityEvent as an argument to be invoked
it's my own class but i didn't do any overrides it's just a bunch of variables, most arbitrary for now
i mean instead of doing 3-4 Debug.Log in a row do something like
Debug.Log($"{cellDict[tileLocation]} - {cellDict[tileLocation] == null} - {cellDict[tileLocation].Position}");
that way you make sure that your logs aren't coming from different instaces, positions on the array etc
is it possible that the comparison to null actually creates the entry and then your second log returns the position due to a default position value or smthing ?
it is possible if both CellData and CellData.Position are structs
i think problem is that CellData was inheriting MonoBehaviour
so == null was checking does it have gameObject
we are testing that now
then again if they would be structs wont return true on == null i think
Good God use a local variable
ah you are doing new() on a monobehaviour, it has never done any good
CellData cell = new CellData();
cellDict.Add(tileLocation, cell)
cell.Index = ...
cell.Active = false;```
Etc.
nono
But yeah new with MB is no good
var cell = new CellData()
{
Index = ...,
etc...
};
cellDict[tileLocation] = cell;
Either way
Use a variable
Don't you get tired of writing out cellDict[tileLocation] 80 times?
.Add might be viable if you care about collision
as this just inserts or overrides cellDict[tileLocation] = cell;
we were testing lots of stuff...
this part not important right now
it was variable at first
Making a variable would never have been the problem
(ps if you are lazy and need to show a whole object in debug you can just convert it to json)
or you know use a breakpoint
https://blog.unity.com/technology/custom-operator-should-we-keep-it
If that class is a MonoBehaviour, looks like the issue does lie in a custom == operator
even if you didn't write it yourself
even is null behaves weird in that case
but CellData never should have been monobehaviour as it only stores data about cell
the monob class should be separate from the data class
which is in dictionary
whats the standard for hiding an object that needs to be hidden unhidden alot?
@flint wraith just noticed that ur snippet of CellData didn't contain the declaration for Position
its much longer
and code is not mine
trying to help aes0p
depends on your use case, you can toggle the SetActive on the gameobject or toggle the enabled on the Renderer
theres no performance issue on set active?
i remember vaguely when i was doing unity in the past it was a bad idea to spam this thing
there is a performance cost for everything, you need to see if that is worth paying in your particular case
welp
i guess i'm gonna cheat
and throw it out of bounds then
thou might be the same as disabling the renderer hmm
@real plume in my experience issues like this usually mean that the Debug.Logs are coming from different places/instances/places in loops hence my suggestion on placing all the info in one Debug.Log, and you should fix the new CellData() issue mentioned by others, it can definitely cause weirdness, either use AddComponent instead or (temporarily) make it so doesn't extend MonoBehaviour
There's no point in trying the roundabout ways before measuring the "correct" way
Is it really that impactful? make it changeable easily. at end of project if causes lots of slowdown i would then look into it and optimize. seems like that is optimization that doesnt mean much
thank you. i apologize for dipping in and out, i'm in a thread w/ someone and we're trying a couple other things
Hey guys! I asked a question on StackOverflow and thought you might have some insight about my issue
https://stackoverflow.com/q/73895019/9985392
Hope it's not against rules to post a link like that 😄
class that should change it should inherit scriptable object you described
in so make getter and setter functions where setter is protected while getter is public
So what you are saying is that I should have a SO:
public class HealthSO: ScriptableObject {
[ReadOnly]
public float health {get; protected set;}
}
and another SO:
public class HealthSetterSO: HealthSO {
public void SetHealth(float value) {
base.health = value;
}
}
Like so?
yeah
dont know what [ReadOnly] means
but that code should work
you can try now creating third script and see what you can access and what you can change
To me, that looks like a normal get / set property with extra steps, but maybe I'm missing something
yeah but that was question
[ReadOnly] mens that this value cannot be changed from editor
But this doesn't really fix my issue. I want to block the possibility of changing this value at all from other components other than the "owner"
well value now cant be changed except from HealthSetterSO script or HealthSO
But you could reference HealthSetterSO instead of HealthSO
new script shouldnt be able to change it except through HealthSetterSO
And still get away with changing this value
then remove sethealth from HealthSetterSO
What you want is basically impossible
The pattern i use is make a public propery with getter only and a serialized private field with [ReadOnly]
At least, in any sensible way
You want to be able to change it externally, but only from some one unrelated script
I wouldn't be asking about it if it was easy xd
honestly just have private float health
with public get and set
that way you know only setter is changing value
They literally want it to be impossible to change the value, like imagine a coder was actively trying to change it. They should not be able to.
That's the goal, to make it impossible for other members of the team to change it
Or at least make it very hard
think its not smart and possible.
you can make it const or readonly that way it cant be change but why make health readonly
or as i said, make health private and have public getter and setter that way only setter changes values
Well, I think that it would be good for only one component like HealthController to change this value
well then as i said, make health setter protected
I expressed myself incorrectly
and HealthController inherit HealthSO
It should be possible to change this value only from one MonoBehaviour
I guess you can use an interface like IHealthSetter and pass the setter object as a parameter and check in the set if the setter has the IHealthSetter interface, if yes, accept the change, but tbh I would just let the other script change the health if they want, its too muc hwork
then only healthcontroller can change it
we got it solved. i don't fully understand it but basically the class wasn't working right. i had to copy paste the code to a new file and it worked.
But I don't want the HealthController to be a SO
then cant help you
This could work yes, I also thought about passing an owner object and checking with each set if this is the owner
i mean part of your question is, is this good practice, honestly no
But there are ways to cheat it
bigger projects rely on readability, this wont help it
cheat + good practice = ...
Is it a good practice to allow any UI script to change an important value?
I would like to avoid a situation where a HealthBar has the ability to change player's health
Exactly
playerInstance.TakeDamage(someDamage)
why would you cheat yourself? and why not have HealthController as SO?
What you are asking requires it to be that way, if you want just to read value you pass HealthSO if you want to chanage and read, you pass HealthController
to UI elements you pass HealthSO
But I would like to pass the current value of player's health to the UI script via SO
It's not only myself, there are other people working on this project
scriptable objects are for immutable data
just say you can't do that
and move on
like it makes no sense to
What do you mean immutable? You can totally change values in a SO
just because you can
doesn't mean you should
atleast during runtime
whats the benefit of doing this anyway?
As I said, You make variable private and setter public, if there is case that someone is changing health and you dont know where from. you add debug.log to setter and it show you callstack, shows where from is called
you have an additional middle man for no reason
everyone keeps saying this, but why not?
Decoupling data from logic
Connecting different systems through editor
There are a lot of fancy tricks that you can do with SO
And they are great
it sounds like you want to fake ECS
theres some weird things that happens to it
like if you change a value
its persisted
you don't get a base version of it again
That's just something that you have to remember about
yeah you are retrofitting something to your needs
You could save those values in a file and load them back
using SO's for dynamic runtime data is just an unnecessary can of worms - their behaviour changes between editor and builds, in the editor they can persist between plays, can be overwritten, and wont function that way during a build. If you're using them during runtime they don't really do anything that a normal class wouldn't
just use ECS if you want to do decoupling of data
the argument is fine if you do it for everything
ah so the values don't persist at runtime?
It's not possible to do that at this stage of development :<
sadge
with a build your SO's wont just magically save with runtime data between sessions, they will reset if you restart the program
theres just lots of edge cases you gotta remember basically
I think that those are just the two xd
fair
i actually can't think of another
(i don't use SO's myself)
well thats a lie
this project right now is the first time i used them
stop shitting on SO's just because you heard they are bad lol
theyre really good for shared data
just a question, why would you be worried others would tamper with hp?
unity is not for building large MMOs
where that would be concern
how would using SOs prevent that?
Thanks for the discussion guys I've got to warp up
I just wanted to use them to connect UI with a system that controls the health
wasnt that what i was saying?
you want to stop others from accidentally setting variables on this SO
Yes it is
Exactly
I also agree that you should not worry about other developer setting the health, just write in the doc of your system smthing like don't set this value yourself thats it
no i agree
Maybe that's the way to go
this makes sense as a worry
you shouldn't be allowed to access something if you aren't suppose to be able to set it
But we have an active discussion about this in our team
I feel like accidentally changing health would be quite the obvious bug
And I just wanted to use some of the internet's collective knowledge 😄
I also never quite understood, do people in programmer teams just change random values for the sake of it? And then they have to be made inaccessible 😆
yes xD
its more about not knowing you aren't allowed to
documentation can only be enforced if you read it
Yes, that's true
like imagine instead of a group of 5 people
you have a group of 100 people
propagating changes like these is dangerous
then again
and for SO runtime data you can use the NonSerialized attribute to ensure the value gets reset each time you press play and avoid magic values like in an actual build
i wouldn't use scriptable object
If we live the possibility someday someone might change it
why not just some data class?
You can't pass those to prefabs
because he wants to inject the health via the inspector I guess
yup
a scriptable object can just hold that data class
to me its a container
SO are great for creating templates for stuff like starting gear for player
fair that makes sense
this isn't about templating thou
there is no template here
i would use player class to store actual health
but structure of code is really dependant on project and this is just bunch of bullshit
this still runs the risk of them replacing the reference
but i can't think of how to protect from that anyway
the player class would be the only one that can expose anything at this point
and everything needs to be a backing field behind that
I accept anyone’s contribution on https://github.com/cathei/AntiScriptableObjectArchitecture 😄
O wow
I should work on it more, been busy on other things
Hello everyone, does anyone know if is it possible to somehow see Debug.Log messages on a build? Or maybe even start the application using Windows command prompt and use Console.Write() to show messages at runtime in the console?
Its always visable, hidden in %appdata%
AppData\LocalLow\project creator name\project name
It has an "output_log.txt"
Yeah, i know, but maybe is a little bit unconfortable ... is there some kind of alternative to see at runtime what is happening?
and reroute all your debug.logs to a singleton that switches between debug.log and that debug console output depending on build (or use preprocessor directives if they are allowed in unity)
That's interesting
As far as you know, however, is it possible to use the windows console to debug the build?
try google, i have no idea
Okok thanks 🙂
https://github.com/SpaceMadness/lunar-unity-console
This is for mobile but you can see how they implemented
built application displays there?
Yeah, I think any Unity application writes there.
No worries man 😎
you can't use the windows console to debug the build
you can start with -logFile log.txt and tail the file path you provide
In a nutshell use Application.logMessageReceived/logMessageReceivedThreaded and write to own log console
so you would do
C:\Player\player.exe -logFile C:\Player\log.txt
that's it
does that make sense?
you cannot make unity on windows print out to the console window, period full stop. on all other platforms, you can pass -logFile -
when your colleagues have access to the source code and they are modifying it in Unity, access keywords like public and private are as good as the documentation gets for how a variable should be modified. if someone who can update your source code (i.e. a programmer colleague of yours) wants to modify a variable, they can. they can always change whatever you wrote. so i wouldn't get too hung up on it
That said you should not be using scriptable objects at all
Yeah i can definitely agree
I'm sort off getting around that particular problem by making our internal framework in to a upm package
I mean they can still do it, it's just harder xD
Anyone have an idea how to make a dropdown list of strings in unity code? Like if I have a collection of types for powers (ice, fire, rock) but I want to select them in the inspector?
Use enum?
Otherwise you'll have to do with custom inspector/property drawer
Is there a specific way to be able to see it? Like code wise? I have it as a public.
Oh wait-
I think I found it...?
I don't understand your statement and not sure if this is advanced code question.
In any case you want to be more flexible than enum then you should use this
https://dbrizov.github.io/na-docs/attributes/drawer_attributes/dropdown.html
I figured it out.
I was trying to make a drop down. Not sure what was supposed to go where.
Sorry to bother anyone if I did.
Holy C > all other languages
Hey guys, what do I miss from the onDestroy?
public void ChangeURL(string nextURL = null) {
OnDestroy();
Awake();
if (nextURL != null) {
url = nextURL;
} else {
url = origURL;
}
Start();
}
private void Awake()
{
WebRTC.Initialize();
Debug.Log("WebRTC: Initialize ok");
}
private void OnDestroy()
{
pc?.Close();
pc?.Dispose();
pc = null;
WebRTC.Dispose();
Debug.Log("WebRTC: Dispose ok");
}
private void Start()
Hello, any idea why Material.HasProperty(int nameID) is returning true on the Standard shader for a property it doesn't have?
Im checking as follows:
if (mat.HasProperty(SeparateCutoutTex)) {
Debug.Log(mat.name + "of type " + mat.shader.name + " has it");
}```
Any help is appreciated
impossile
Is there a way to await for an already-running UniTask to finish?
E.g.:
Start my first
UniTask
Don't immediatelyawaitfor thatUniTaskto finish
If thatUniTaskis still running at some uncertain point in time later on,awaitfor it to finish
Can't you await it at any point?
just save the task in a variable
Yeah save the task itself in a variable
UniTask<int> whateverTask = WhateverAsync();
// .. other code
await whateverTask;
Will try that, thank you both :)
I am guessing that I receive this error because the UniTask is not a UniTaskVoid and returns a Vector2?
oh wait
Ok so I don't await it at that point in the code, I await it afterwards
How would I go about accessing the return value?
You can still do var result = await savedTask;
Just use UniTask<TReturn>
Ah yes I think I see, like this
Yes
Thanks :)
use var
@placid jacinth do this
Ok, can I ask what the benefit of it being a var is?
There is no benefit. You don't need to cache the task before awaiting it though, you can just get the Vector2 on one line by awaiting
Aha I see now, thanks for the tip guys :D
Ok I'll throw one more out there before I go to bed - I can't seem to call the function? I must have missed something but I'm clueless as to why I'm getting a conversion error
huh, that's a strange solve
I will test it to see if the entire thing works, but I changed the library method from a UniTaskVoid to a UniTask and now it provides no error
UniTaskVoid is equivalent to async void. It's fire-and-forget. You cannot await it.
Thanks, that makes a lot more sense
Anyone know why an API connection does not work on Android? I connected to APIs and on PC it works perfectly fine but on android I cant establish a connection. I use the UnityWebRequest stuff
should I just try it with native C# HTTPClient ?
not yet actually, was just hoping someone might have a quick idea. Ill check the logs when Im back from work
what are the first 5 characters of the URL you are trying to access, and what are the last 3 characters of the domain name in it?
you can also paste in the whole URL if it's not sensitive
"http://api.voicerss.org/?key={key}&hl=en-us&b64=false&src={audioText}" for TTS and https://opentdb.com/api.php?amount=10&difficulty=hard to generate questions
okay
so i assume the first one is busted
do you know if the second one is busted?
it should not be as the operation to get data actually finishes
Ill get back to you guys tomorrow, I need those logs lol
the second one will definitely work
the only thing I read was that some people had problems with giving their app access to the internet
i am trying to find a definitive answer, but try changing the URL to https in the first URL
will do, thank you. I dont give you much to work with haha. Sorry im a beginner at best ^^
ill tell you if it works ❤️
aight
Found the error
really dumb stuff on my part
I had this line within my code: File.WriteAllText("C:/C#Test/quizText.txt", answerText);
both APIs work
whenever i instantiate my prefab from my assetbundle it just appears black
its not a material issue its the shader, it says its loaded but it only appears black until i change it
left is the prefab i made the bundle with
right is loaded from the assetbundle
what the heck do i do
No idea but this is a #archived-shaders or #🔀┃art-asset-workflow or #archived-lighting question
I have an odd question. If I wanted to extend the animator to be able to change the animation curves and use other interpolation types than easing, how would I do that? They are written in C++ so I can't exactly change the code myself.
You can already change the easing curves in the animator
I meant for an animator and animation clips, so I can change the curves in the animation clip's interpolation type from a script, like to bounce or whatever
wdym by "animation clip interpolation type"?
In animation, there are multiple kinds of tweening/interpolation- Linear, easing, bouncing, cubic, etc etc
the animator only seems to let me have linear and easing
which part of the animator you're talking about is what I'm asking though
like, animation clips, not the sequence timeline or whatever it is
where on an animation clip is an interpolation type?
isn't that all just determined by the curves?
Exactly
Is there a way I can like… change the sampler, or extend the animation clip, that would allow me to do that
Determine how the curves look
Rather than just being bezier
don't think so. It uses AnimationCurve which isn't exactly set up to be inherited/overridden or anything:
https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Export/Animation/AnimationCurve.bindings.cs
you can of course programmatically create the curve
Yeah that’s what I saw… darn.
trying to figure out what you're wanting to accomplish
I could. But the animator automatically uses the curves
What can't you do with the bezier curves
You can edit the curves so they have hard corners
So. Say I have an animation of a character turning to the left. It has a smooth ease in and out between key frames. Now, if that character is scared, I want to set that curve from script to be more jittery, like an old Mickey Mouse cartoon. Or like exaggerate the motions
Right click on the node and change its tangent type
I would just use a looping shake tween
But if you want to hand author it, you can use animation layers
Make them additive
So make a jitter animation and put it on an additive layer
Nah, I want to do it procedurally.
What is that
this can all be done with the curves
by setting tangents etc
A tween? It's a kind of simple programmatic animation. DOTween is the library that most people use these days
But that will shake the whole model
Yeah I was thinking of using DOTween but I wasn’t sure how that would fit into the system
yes
you can set the tangents to whatever you want
The thing is I suppose I could make my own animation system (because the regular animation system is lacking in what I want it to do) because it's basically just sampling points along a curve but it also does fancy stuff like retargeting, which I'm not at all comfortable doing.
I could use IK rigs for retargeting (which is kind of my eventual goal) but that might be too daunting of a task
playables looks kind of promising actually
Hello there, we are currently experiencing crash on build from 2021.3.5f1c1, here is the following error message before crash:
The file 'none' is corrupted! Remove it and launch unity again!
[Position out of bounds!]
UnityEngine.Object:Instantiate(Object, Transform, Boolean)
UnityEngine.Object:Instantiate(T, Transform, Boolean)
Common.SceneDirector:SetWorldOverlay(GameObject, Vector2, String, Single, Boolean, Boolean)
Common.TimelineExtestion.COM_WorldOverlay_Set_Behaviour:OnBehaviourEnter()
Common.TimelineExtestion.GameTimeManager:Update()
[ line -1200368312]
Crash!!!
<///Crash Message>
The game runs fine inside the editor, and always crash at the exactly same spot on build
@trail cloak I think we will need some more info like code from Common.SceneDirector:SetWorldOverlay, and possibly the value of the arguments its getting
Sure
This api works fine under all other scenario though
public void SetWorldOverlay(GameObject overlayGameObject, Vector2 worldPosition, string label, float transitionDuration, bool uiMode, bool tutorialMode)
{
if (!overlayCollection.TryGetValue(label, out var instance))
{
if (uiMode)
{
instance = Instantiate(overlayGameObject, AdpUIPannelManager.GetActivePannelTransfrom());
}
else
{
instance = Instantiate(overlayGameObject);
}
if (tutorialMode)
{
UniversalGameManager.PlayTutorialOpenAudio();
}
overlayCollection.Add(label, instance);
}
if (!uiMode)
{
instance.transform.position = worldPosition;
}
if (instance.TryGetComponent<SpriteRenderer>(out var spriteRenderer))
{
PannelTransitionController.Instance.SetSpriteRendererActive(spriteRenderer, 1, transitionDuration);
}
if (uiMode && instance.TryGetComponent<CanvasGroup>(out var canvasGroup))
{
PannelTransitionController.Instance.SetActive(canvasGroup, transitionDuration);
}
}
The game crashes on Instantiate
This is the prefab I'm instantiating
your stacktrace looks fishy to me. GameTimeManager is a MonoBehaviour, and that's the normal Unity-called Update right? You aren't doing something off the main thread or doing some kind of native interop?
That's just unity update
relax
I'm using that to ensure timeline goes exactly one cell each frame
So you generate a number between 0 and the sum of all rarities (doesn't have to be % based), then if it's in the first 20 then it's rare, the next 30, it's uncommon, the last 50, it's common
You misunderstood
you literally write a loop that goes through your drop rates and adds them together until you reached the number you generated
int target = 67 (random)
int sum;
for (drop in droprates)
{
sum += drop.perc;
if (sum > target)
return drop
}
Ahh the sum is what I'm missing, makes perfect sense now. Add it up as I go through each rarity until I hit the target.
Thanks Navi!
cs
public void MakeRequest<T>(VRCloudRequestBase vrCloudrequest, UnityEvent<VRCloudResponseBase> callback) where T : VRCloudResponseBase, new()
{
if (vrCloudrequest is IPost)
{
var request = new HTTPRequest(new Uri(baseURL + vrCloudrequest.Endpoint), methodType: HTTPMethods.Post, callback: OnPostRequestFinished);
request.Send();
}
}```
This generic function has a "T" value. Is it possible to pass the "T" value to "OnPostRequestFinished" callback of the HTTPRequest?
I got a simple question about the job system
Basically can I do the following:
struct TestJob : IJobParallelFor
{
public NativeArray<byte> type;
public void Execute(int index)
{
if (type[index] == 1)
{
if (type[2] == 1) // CAN I DO THIS??
{
// do something
}
}
}```
or is that not allowed?
I don’t see anywhere you are actually using type T. Generic parameter is not any value and it is just a type.
I want to pass the T as an argument to a callback method.
But its not a reference type so, it does not make sense to me if there is a way
But you never know if there is a way. That is why I asked
You can't, as HttpRequest isn't generic, nor its callback property.
You'll have to make another lambda to use the generic parameter, and make OnPostRequestFnished generic itself:
callback: (...) => OnPostRequestFinished<T>(...)
Do you guys have some idea what am I missing?
I saw the question yesterday and couldn't answer
You tell us what's missing. Do you get errors? Post them. Debug your issue, this is #archived-code-advanced
That is the intereresting part, no error, i just see that the image is corrupted and the game is lagging each time stronger when i call the changeURL. In the logs i can see that the close, dispose etc run well
See that's some info that should have been included in the original post
Also I see you call OnDestroy, Awake, Start manually from ChangeURL? What?
These are Unity methods and are called by Unity. These shouldn't be ran manually
Either way open up the profiler, enable deep profiling and check out what makes the game lag
is there better method to change the source? I tought that i close the current and open the new one
Can't answer that, didn't use WebRTC
Their docs probably have the answer, or at least best practices
But if that thing is used to connect to a server then yes, I would get rid of the old instance and create a brand new one when changing the URL
{"data":null,"success":true,"message":"The password has been send to the phone number"}```
var ob = JsonUtility.FromJson<T>(request.downloadHandler.text);```
[Serializable] public class OTPResult : VRCloudResponseBase
{
public string Data { get; set; }
public bool Success { get; set; }
public string Message { get; set; }
}```
Hello. The incoming JSON has "Data" field as null object.
But in my class it is string.
Maybe that is because this FromJson can not convert it to an object.
where am I missing? The generic "T" is OTPResult class in this case.
What is the problem? Seems like your json field names don’t match the c# names
I want to convert the string coming from the server to a unity object
I marked Data field in OtpResult as nullable
it did not work either.
Unity cannot serialize/deserialize properties
these are properties not fields
JsonUtility only serializes fields
Also Your property names in c# are wrong they need to match the json exactly
also there are no fields 😉
what is difference between field and property 🙂
Now if you want to get cute about it you can do this:
[field:SerializeField] public string data { get; set; }``` and keep your properties.
properties are a pair of functions to get and set data
in this case you have an "auto implemented" property, so there is a magic field C# compiler creates for you that your functions are getting and setting
fields are actual, normal variables that actually hold information
If you do it this way, Unity will know to serialize the "magic invisible field" behind this property
but normally you'd just do this:
[Serializable] public class OTPResult : VRCloudResponseBase
{
public string Data;
public bool Success;
public string Message;
}```
now those are fields, not properties
Still wrong names
what do you mean wrong names ?
yes they are case sensitive too I believe
oh! that sucks. I must change the backend responses for that.
honestly all these little weird restrictions are why I prefer to use NewtonSoft JSON instead of JsonUtility
much more configurable
I've just started interpreter library for the backend.
so you can keep your capitalized property names and serialize as something else with an attribute like [JsonProperty(PropertyName="data")]
nothing to lose to jump into newtonsoft then.
Hello, my Unity build crashes on MACOS on launch (Intel64), does anyone had a similar issue?
Unity Version is 2021.3.5f1c1
anyone here used the new openID connect with the latest unity version? I got an error
WebRequestException: {"title":"PERMISSION_DENIED","detail":"validation failed","details":[],"status":401}
which apple device is this?
This is my apple vm
this particular stack isn't saying anything
you can try to reproduce the crash on a development build, i forget where the standalone player symbols are
but i doubt that stack is going to say anything interesting
But unity editor do run on mac vm
it says bad access right?
or
no
it's not
i mean
it's weird that you have audio calls on the main thread
do you use OnAudioFilterRead
No I didn't...
i think that's a red herring
really hard to say. this might be worthy of sending a bug to unity
That's too bad if true...
just got the crash log from the user
May be I should't build the project using VM.... but it works in 2019.4 LTS
It's a pain testing mac without an actual mac lying around
Oh no
Can somebody help me with bundles and execution order? because scripts from bundles dont have correct order to execute. How i can execute scripts in bundle object by default order in project settings?
bundles?
what is the actual exception?
this is just the stack
it should say something like SIG BAD ACCESS or whatever
is this on launch?
AssetBundles
u know what is it Bundle? and scripts inside it?
Simple question why scripts inside bundle not work as in custom order execution in project settings that all.
there is a lot of writing online about the limitations and challenges of scripts in asset bundles
are you trying to say you've authored a script that does not exist in the built player, and you're delivering it in an asset bundle?
you also shouldn't rely on order of execution for the most part for anything
even if there is a way to configure it
i am not sure if unity built players respect the attribute that allows you to set an order
If you know how to work with inverse kinematics, animator and a physical doll, without script execution order! You will receive $1,000,000
hmm
what is your objective?
like what kind of game is this and why do you need to bundle characters?
i have 1 000 000 000 characters, and i not need to store all of them in side current state of game progress
i think this might be beyond my abilities i'm sorry
good luck out there
You cannot put scripts in asset bundle, they are not bundled. unless you manually do dynamic assembly loading stuff
i dont put scripts inside bundle. they just have data of the script. Code exists only on client not in bundle. why u not know about this, u just learning unity?
this is advanced code group?
scripts from bundles dont have correct order to execute. How i can execute scripts in bundle object by default order in project settings?
Read what you said
Exactly. if you are advanced you wouldn't say "scripts from bundles" or "scripts in bundle object"
First learn how scripts work in the bundles.
I know well enough 🙂 You are the one having problem with it, not me
I need help in unity3d.
Create object, drop on script -> create prefab and bundle of this prefab -> load the bundle in play -> get info about the scrip and how it is work.
@hard osprey try in #💻┃code-beginner and talk about your game as it is
@undone coral my knowledge does not stand still like yours
@undone coral gloss dont worry u banned
You have such a low chance to get help with that attitude, lol
yes but i dont wont holly war here 😭
i just create manager of script execution order at this moment, before fix this bug. For custom Update, LateUpdate and FixedUpdate by extension interface
There is not exception, which is weird
I moved the project to an actual Mac PC then build & run it
This is the log
Following on from my inquisitions yesterday:
Does anyone know if there is an equivalent or a way to make a while loop work with the UniTask system?
I can't mentally grasp how to combine it with the process of awaiting functions
I'm pretty sure what I'm asking for is a way to await a while loop's completion
For further context, I am trying to move an object to a position over a duration of time, if there is an alternate way I would gladly use it over a loop :)
ever looked into DOTween? UniTask has support for it
Does it give you any error in editor when running. Or. high profile spikes?
I have heard the name, I'll look into it and see if that can do what I need, thanks :)
If you dont need a big tweening library, dont go dotween for every single movement. My personal opinion
If you need a lot of animation of a lot of different objects, dotween might be worth a short
What is your issue with waiting for a while loop there? Await just waits for whatever you throw at it
Well my question is simply how to go about doing it?
I haven't found any forum posts, or anything on the GitHub page, and I'm having a hard time understanding how I can await a loop as to speak
Tasks themselves work fine for this. Is there a gain to uni task that you need?
Yes, it's designed to work with Unity
private async UniTask MoveObjectToPosAsync()
{
var t = 0f;
var duration = 5f;
var startPos = Vector3.zero;
var endPos = Vector3.one;
while (t < duration)
{
t += Time.deltaTime;
var newPos = Vector3.Lerp(startPos, endPos, t / duration);
// use newPos to do something
await UniTask.Yield();
}
}
Seems to me like this would work just fine
Tasks are designed to work with c# what's the gain with unitasks?
Assuming you want it to move something over time
and you could just await the function call if you want to "await the while loop"
but you could also use async delegates, etc
I was originally going to use tasks, I was recommended by several people in here that UniTasks would be a better solution as it is actually integrated to Unity's playerloop
Thank you for the example, I will tailor this to what I needed, I sort of had a brain melt yesterday getting it all working lol
I just looked into the difference it doesn't look like therrs any gain.
If unity has a native way of doing it, most of the time, 3rd party packages will just clutter up your workflow
If anything it looks like it uses tasks under the hood.
That's the point of it all tho
Tasks are not native to Unity
I would have to say that UniTask does the exact opposite of "clutter up your workflow"
it's the least boilerplate thing I can imagine
Unitasks are a layer on top of tasks 😄
Well I'll trust that you have more experience than me on this, so be it
I'm not that worried about bloat as of current because this is the only 3rd party package I'm currently using
So what about System.Threading.Tasks?
If all you're doing is awaiting I would just use the task Lib.
Await Task.yeild()
Obviously, otherwise UniTask wouldn't be using it... But UniTask just enhances the Task system with all the bullet points mentioned in their github page.
Unless someone else can explain what the gain from another Lib would be ( I am interested) after doing a quick look it's not doing much.
No warning, but High Profiler Spikes... let me check
Than Apple is stopping your app from allocating too much memory maybe.
unitask also gives you a better sychronisation context, makes switching between main thread and thread pool very easy during the execution of a task and provides extension methods to unify all async patterns that are commonly used in unity (coroutines, events, dotween, async/await, channels) into one API
Yeah I guess thats the point. If you need that whole async extents for events in UI and stuff, it makes sense to use it. But not just to do simple awaits. Guess its subjective to the needs of the person asking here 🙂
Good point 🙂
I just don't get the pushback. It's fine to be skeptical, but as someone who uses it regularly, I can't see a reason not to use it. Even if you only use it in GUI, and especially with DOTween.
It's simply a good library
But yeah, subjective to the needs I suppose
It's fine to use it, but would you use a dictionary in place of an array for storing a few enemy names?
It's knowing when to use the right tool.
I might, if it's more convenient
You're free to do it no one will stop you, but it's not really the best way.
I just jumped into the fun of ARCoreExtensions. Best way to have a full package to just do one job and give you a lot of bugs. Thats why I am not always a fan of 3rd party 😄
There is no memory spike though...
Does the app crash immediately on start afte rbuilding it with xcode?
This is a great point, something that's not standard Lib is not guaranteed go be stable.
The game runs fine inside editor, it just crashes in standalone build
Are you building on the new chip?
I did not build the app using Xcode, Unity just build it and output an .app executable, but yes, it crashes on start
No
I think unity uses xcode under the hood for it, right? Or not
Well in my opinion the "best" way is the way that makes it easiest to code and maintain. But clearly we share different viewpoints so I don't really want to drag on the conversation
I know what you are saying though, I just don't agree.
Experience is a great teacher. 😄
But yes that's fine.
Maybe yes? I am not familiar with the Macos pipline
You're building a apple build without an apple?
Can you share your debug log in raw text so checkout?
Previously I'm building it on my mac VM, but now I am building though a real macbook
sure
And what device are you trying to play on, the new chip comes into play. Make sure this isn't the issue.
https://answers.unity.com/questions/1872228/does-any-unity-editor-run-native-on-m1-macs.html
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
Just mentioned, it's an ancient macbook
Silicon versions are in hub already, just use them. but as it is building, I think its already working
There's m1 and silicone.
Not apple sillicon
Oh yeah, your debug log said intel iris
What's the build device running?
You can't run a m1 build on a silicone.
It's different arcetecture.
Silicon is m1
What's the old chip?
Intel
Oh, 2015 macbook air and only 4gb of ram. you might just run out of memory
I'm 99% sure you cannot built the old arcetecture with the new one.
All iOS apps have to be updated for the store as well.
It is working ,yu can build for old and new hardware with old and new. Apple is doing a great job here also running everything on everything
Can you export the xcode project and zip and send it? I can test it
Sadly the build crashes every time, even on customers' mac
If you export xcode and throw it over, I can have a look at it @trail cloak
Let me see
Sadly I might not be able to send you the xcode project, since it contains confidential assets & code, is there documentation about testing this?
Can you send the app itself?
Yeah, you might update your sdk, if you even can with that older machine
I can compile to il2cpp if I choose only Intel64, working on that
Takes forever for il2cpp compilation...
Hi all, I'm wondering if anyone here has any experience/resources with sending data from an android phone to unity via a USB cable?
It's important that the data is sent through USB serial ports, not through anything internet related. This software will be used in real world locations that wont have internet connection
Oh, so you need wired data transfer, got it
Yep
Well, then you gotta put yourself together your own drivers that handle your phone correctly.
Cause, USB is nothing you can easily address
almost definitely something you're going to need a native plugin for
Most phones have a USB Tether option, you can probably use that to establish a local network where you can send data via usual sockets.
Seems much more direct, except that you'll need to instruct the user to manually activate USB tethering.
Or you can hook into serial communication like arduino does it.
But still you would need some software on your machine that interprets the serial calls. Arduino has its chips, your unity host machine and/or android phone needs that software wise if possible
I'll start looking into these methods. Thanks for the step in the right direction @midnight violet @sly grove @pale pier !
Dang that is long 😄
yep...
If I had a MacOS VM here, i would hand it over to you to speed it up 😄 Sadly I did not manage to run macOS on VM yet
I do have a MacOS VM for building... but after upgrade to 2021 (along with a bunch of code restructure) everything it builds start crashing
I would rather investigate in a fast VM build than that. Imagine doing changes to test and going through 30+ minutes build times
That's for sure
Sending you right now
Where, discord DM?
Yeah, unity is quite huge even with minimal setup
All good, I got time and fast download 😄
Sry for letting you to wait for so long
? All good. I am working on my own project besides, setting up my VM, updating steam, playing some game maybe 😄
Here
It wants a code
did you get my access request
Yes, done
Cant run. Might be because I am on M1. But tthought rosetta takes care of that
Well, with the xcode project I could have checked it, but with the app itself, nope
I dont get any debug logs from the build app. thats the reason
I see, let me check if there's any way to not leak the code itself
while giving you the xcode project
Debug?
It will convert it to cpp anyway. And I really do not care about your contents. Be sure, I signed enough NDAs in my life 😄
I see, which mode should I create the Xcode Project?
Go with debug, thats fine
Its just building the xcode project, not the app itself
thats what xcode will do then
All good 😄
Oh sorry, missed that
Lets see what I get for output
Ty
Hm, did you remove something from the xcode project?
no, I didn't
GameAssembly.... that's the lib for user code
under il2cpp
I believe it's within the previous .app you got
Yeah there is something wrong with your project entirely 😄
error build: Command PhaseScriptExecution failed with a nonzero exit code
I would try another unity version and maybe an updated xcode version. Also use shift command k to clean build folder. That also helps sometimes. What happens if you open the xcode project and press run?
Why not? what does it say? 😄
"We cannot install Xcode on 'System', because it needs macOS v12.5 or higher version"
Guess I need a new vm for building
Maybe that explains...
I'm going to create an empty project, build it and see if it runs
If it doesn't, I probably need a newer version of MacOS
I already forgot which on I followed..
But it's not smooth
After I create the project, it immediatly enters safe mode with compile errors
I resolved it removed 2D feature pack and visual scripting pack
Then I made a build and it runs normally....
But there are visual glitches
I think I need to get a new vm
Anyway, thanks for the help
If you already get errors when opening the project, there might be a script buggy
you're an experienced developer. you know you can't send screenshots of logs.
this is very strange
did you decompile a game?
I sent the log file itself later
No
This is our product
It use to work when using Unity 2019.4 LTS
After upgrading to Unity 2021.3.5f1 LTS every build on mac crashes
*Works fine in Unity Mac Editor
Anyone ever had this happen? It stops me from building, not sure what is going on:
Asset has disappeared while building player to 'globalgamemanagers.assets' - path '', instancedID '-268732' UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Already tried a reimport with no success
could someone help me with this? I am looking for the closest vector between two vectors relative to another vector, check the image please
This is just vector projection right?
Vector3.Project(c-a, b-a)
You're computing the magnitude twice, change line.Normalize() to line /= len
Hello, what is the way to initialize the variables of a ScriptableSingleton.
Thanks!
When i send a request in my script and it returns JSON, how would I handle that?
You deserialize the Json and turn it into a class instance
And how would i go about doing that?
i found out
Oh
I have implemented a 3d A*. It is OK but there are some issues.
I do not want to let the algorithm find a path like the picture below. A path passes below another path
How can I add the limitation mentioned?
The sample path has been shown by cubes
in your closed set you could keep track of x,z and reject any (x,*,z) as being already visited
I can add the upper and lower voxels to close list when the current voxel is added to but it removes some search space
If it is your meaning
that's true, it may be brutally inefficient but perhaps you can store the current optimal path for each node in its state and check against the entire path up to that point
not sure I have an exact answer that would definitely work and be optimal though, just throwing out ideas
You say it should work?
var currentNode = _openList.Dequeue();
_openSet.Remove(currentNode.Point);
_closeList.Add(currentNode.Point);
_closeList.Add(currentNode.Point + Vector3Int.up);
_closeList.Add(currentNode.Point + Vector3Int.down);
Maybe, my algorithm has bug because sometimes it cannot find the correct path (optimum)
Yes, I can store the current optimal path and check the condition but inefficient as you mentioned
as you said doing that will stop the path from going underneath, but it also may remove the actual optimal path incorrectly
Probably, I do not need it
Yes but when one node has been chosen (remove from openset and add to closeset), it means the path is optimum to this point! isn't?
So, I can add upper and lower voxels to close list as well!
I don't know
you may find the optimal route to a point, say (3, 1, 3), and then add (3, 0, 3) and (3, 2, 3) to the closed set - but it turns out the optimal path to your target actually goes through (3, 0, 3), you just happened to search (3, 1, 3) first - so I think you're right that it doesn't work in general, but it might work depending on the structure of your pathing/weights
Yes, it should not work because I have tested
and thought maybe it is a bug
Really thanks
@obsidian glade
But it is annoying the current path should be kept and then check if the upper voxel is empty or filled :/
I want another easy solution 😦
Also, I found this problem in Dijkstra not A* but definitely it is not related
I'd think you could include the path in the node structure, say, _openList.Add((nextNode, pathToThisNode), weight); , then when searching for adjacent nodes you can compare the path to this node and reject going underneath - I have a feeling this might blow up though
So, the only way is this :/
I'm sure someone out there has a better idea than this
I have other two questions but related 🙂
Sometimes when node extension (children), they are obstacles and sometimes not.
It depends on the direction of extension and some conditions.
For example, a final node (target) should be connected to the previous one horizontally not diagonally.
In this situation, I return a giant weight for that child in gcost to prevent this node from extending. It is OK
and the last question is how I can limit the search space because the world size is large.
Therefore, it can find a path or not, it is OK.
1- Distance between source point and current node (child) and if it is greater than a threshold, add it to close list (soft condition)
2- Limit node count in open set (hard condition)
on large graphs you typically implement some sort of hierarchical A*... you might have a "overland/highway" graph that contains information about which regions are connected and a "local" graph that is used for finding the path from the closest exit of the overland graph to the actual target. This local graphy may even be dynamically generated if storing/loading a baked graph is not possible
is it possible to check which file opened my game? I'm using custom file types to store 'projects/scenes'
either a path or a file name, i can't seem to figure it out
Hello does anyone know how multiple players with multiple concurrent scenes would work? I'm thinking of offloading each player to load their own scene and sort of synchronizing all the gameobjects between players of the same scene otherwise disable/delete it.
Is there any library/API that can be used apart from just disabling all previous scene stuff and loading a new scene locally and syncing it up with the network manager
So I went for this approach and managed to make a type
https://github.com/cathei/Incremental
Performance seems alright, better than decimal or BigDouble in many cases
Though still wondering if there is any better algorithm/feature to calc 128 bit multiplication or division
nvm got a solution^ not needed anymore
your pfp is so sadisfying, I'm like watching at it for 2 minutes
Looks cool 😎
Anyone know how to deserialize a json string and get values from it?
Uhhh JsonUtility ?
https://docs.unity3d.com/ScriptReference/JsonUtility.html
JsonUtility indeed. Create a class that "maps" the JSON string and deserialize away!
may you give an example of how to use this?
I understand its JsonUtility.FromJson(string)
The docs provide an example
https://docs.unity3d.com/ScriptReference/JsonUtility.FromJson.html
ah ok thankyou
My game doesn't pick up my SQLite database when it's built
But it does pick it up in the editor
How do I solve this
where do you store your database?
what is your target platform?
what platform are you building to?
then your database needs to be in Assets/StreamingAssets for it to be included in the build
Do I need to create another folder StreamingAssets or should it already be there
you need to create