#archived-code-general

1 messages Β· Page 410 of 1

leaden ice
#

Well that feels like a big assumption

#

that's a fighting game not a platformer

teal hare
#

not really

#

its called a platform fighting game i think

#

that genre of fighting games

leaden ice
#

I mean I guess, but they said "platformer" not "platform fighter". Anyway why don't we just let the person clarify instead of making assumptions and potentially giving useless advice

vestal arch
#

google says

  • fighting
  • sandbox fighting
  • crossover platform fighting
  • action
  • platformer
  • action fighter
  • platform fighter
  • platform battler
  • arena fighter
  • party fighter
teal hare
#

sandbox

vestal arch
#

someone on reddit said smash is a smashlike...

teal hare
#

that honestly makes sense

#

it is genre defining

#

that seems like the best description

#

same for roguelike and soulslike

#

its a first

candid herald
#

weird that castlevania 1-4 aren't metroidvanias though

teal hare
#

is it not

latent latch
#

not enough metroid in it

crisp minnow
#

If I have splines running up a 2d silhouette of a tree, can I rig and animate the tree to sway and adjusted the splines to conform to the animated movements?

Objects animating up the tree spline would still stay on track as it sways. If that's not possible what alternative could I consider?

slender bear
heady iris
#

notably, calculating the up-vector is quite expensive, so the spline caches a bunch of them and interpolates between them when query for that

#

but if you're moving the spline knots every frame, it has to rebuild that cache every frame

#

I also ran into additional editor-only caching of...some kind. i should probably figure out exactly what I've deleted from the Splines scripts...

unkempt meadow
#

Probably a lil bit of a stupid question, but how would achieve a 1:1 rotation of IK chain tip and target?

i.e. my hand (tip) rotates with the target but they don't have the same transform values because my hand is a parent of the forearm. How would I even change my hand rotation to world space?

#

Wait, can I set rotation weight to 0 and then rotate my actual hand? Would that be it?

wheat spruce
#

you beat the opponents up

vital salmon
vital salmon
#

so how do I prevent clones?

heady iris
#

note that the "cloning" doesn't mean it's copying the entire texture

#

you're getting an object that points to a texture and tells you where on it to look

hexed ravine
#

Hey! I'm scratching my head about this problem that I think stems from weird usage of cinemachine + Animation Rigging.

I was hoping someone could confirm/deny my assumptions, and if possible give me a jumping point for a better alternative?

Context: I have an FPS controller with an animated full-body model. There's a cinemachine camera in the hierarchy of the controller that follows a transform in the animated skeleton's eyes.

I use animation rigging to parent-constrain the player's weapon by the camera (to keep the weapon center frame). Additionally, I use animation rigging to rotate the player's head/body towards where the camera is aiming (via an aim constraint pointed at a child transform of the camera).

Together, this leads to a pretty delightful behavior that follows this chain:

  1. I rotate the transform on the player's eyes via script.
  2. The camera follows that transform due to the cinemachine "follow" thing.
  3. The head/body rotates towards the direction of the camera.
  4. The weapon tracks the position of the camera, keeping it smack center in the frame.

I'd be super delighted by this behavior if it weren't for one issue: The weapon jitters on screen, as if it were lagging one frame behind the position of the camera.

I think this is due to the fact that moving the camera moves the head/body, which in turn moves the camera as the followed transform is a child of the head. I think that animation rigging doesn't have the information on the true final transform of the camera until the body has moved, which happens in response to the camera moving, one frame later.

Does any of that make sense? Am I thinking about this correctly? What are my alternatives?

#

Here's a video for some visual context on what this looks like.

hexed pecan
#

Definitely seems like a problem with the order things happen in, yeah

#

Not very familiar with cinemachine but I think there is a setting for when the camera calculation happens (update, lateupdate etc.)

#

I personally like to explicitly control all of this in code. This way I can understand the execution order better. It's all just about modifying some transforms anyway

#

A good tip for debugging this type of stuff is to manually set your framerate low so it becomes more obvious. You can use Application.targetFrameRate

#

Its not clear from the video but does the jittering happen when you turn sideways? I only see it when you are turning up-down

hexed ravine
# hexed pecan Not very familiar with cinemachine but I think there is a setting for when the c...

Yeah, I've messed with that, but none of the options really solve the problem.

I almost feel like I'm trying to get the engine to do something impossible: move this object (the followed transform) to this position, react to that by moving camera to that position, react to that by moving the skeleton to some position derived from the camera (the skeleton), then move the camera again to the new position. Then expect all of that to happen in the same frame.

hexed ravine
#

i.e. I don't move the camera in relation to animation which I think is my race condition?

hexed pecan
#

Yeah the camera should only need to be positioned once

#

I cant think of the correct solution right now, mainly because I dont use anim rigging or cinemachine and not sure when/how they execute

hexed ravine
#

No worries, I appreciate you helping out. I didn't know the framerate trick, which will be super helpful now and in the future I imagine.

I'll try and see if I can reduce the camera positioning to just once in this flow somehow

latent latch
#

also make sure you got your physics body interpolating

hexed ravine
#

Already messed with that to no avail πŸ˜”

crisp minnow
#

Spline adjustment

hexed ravine
#

It seems like animation rigging just can't catch up to the camera's children. Setting the camera to fixed update seems to fix the desync but then my camera is on fixed update πŸ˜…

plucky inlet
hexed ravine
hexed ravine
plucky inlet
#

Did you just for testing purposes create a setup with a normal camera instead of Cinemachine?

graceful tangle
#

Is it the bigger the game, the longer the build time?

#

In terms of building to publish

thick terrace
#

would you expect the opposite? πŸ˜›

graceful tangle
#

Well the alternative I figured would be no relationship πŸ˜‚

thick terrace
#

well both size of assets and amount of code contribute to build times in their own way

graceful tangle
#

Got it, thanks!

#

Just confused because I just made my first project. Super small, 1 scene, and it took 30 minutes to build haha

#

Makes me wonder about progressing onto bigger games lol

plucky inlet
#

Might be the first build tho?

graceful tangle
#

Yeah it's the first build

#

I guess that takes longer!

#

?*

#

Complete beginner here lol

plucky inlet
#

yep, cause its generating a lot of temporary files it will reuse later, like shaders and what not. But even that should not take 30 min on a small scene. But I dont know your setup and what you decide is being a small project πŸ˜„

graceful tangle
teal hare
#

i had an issue like this after updating to unity6

clear basin
#

guys how do i make this condition not to cause error when switching between animations?

onGround && animator.GetCurrentAnimatorClipInfo(0)[0].clip.name != "animationName"
heady iris
leaden ice
heady iris
#

I do know that my WebGL builds still take a while to do the WASM compilation every time, though

#

As for applying changes: Unity doesn't provide any kind of patching system on its own; it just creates an entire new build

#

If you're publishing on Itch, its "butler" tool can upload just the diffs

#

very useful!

#

Steam, similarly, can upload a patch instead of reuploading the entire build. But you're probably not publishing a WebGL game on there :p

clear basin
leaden ice
#

pretty standard array out of range error

#

e.g.

onGround && animator.GetCurrentAnimatorClipInfo(0).Length > 0 && animator.GetCurrentAnimatorClipInfo(0)[0].clip.name != "animationName"```
#

(I would use an intermediate variable here so the code isn't completely unreadable like this, but this is the gist)

#

this is also probably creating an extra array, which is very wasteful and inefficient

clear basin
leaden ice
#

C# also has a & operator which will always evaluate both sides

#

both of them work as a logical "AND", but && is called the "short circuiting" AND operator or "conditional local AND"

clear basin
spice estuary
#

Has anyone here started using unity's new Behavior tree/graph yet? I'm getting some weird behavior when I try to make a simple custom action. I drag and drop blackboard variables (just a gameobject reference) onto the behavior agent, but in the action it says the reference is null as soon as it reaches it in OnStart()

leaden ice
#

Show code and show the error?

spice estuary
#

In the behavior agent of the NPC I've added these just by dragging and dropping

#

And the graph is very simple so far, just wanted to test the behavior graph to see if I want to convert my current npc state handler to use behavior graph instead.

#

I watched a few videos on it, and I've seen it be used by dragging and dropping references, so I'm pretty confused as to what is removing the reference. That being said it's pretty new, so it's hard to find a lot of information on it

heady iris
#

What is the exact error? Perhaps the object is being destroyed.

spice estuary
#

as soon as it reaches
root = Root.Value.transform;
it throws a null reference exception

heady iris
#

I need to see the actual error in your console.

spice estuary
heady iris
#

Okay, so it's not an error about trying to use a destroyed unity object

spice estuary
#

I can still see the reference in play mode on the behavior agent component

heady iris
#

Do any of your variables work?

spice estuary
#

yeah the Self and Target work

heady iris
#

well, actually:

if (Self.Value == null || Target.Value == null)
            return Status.Failure;
spice estuary
#

which is weird

heady iris
#

so yeah, they aren't null

spice estuary
#

Cos the target was added by me too in the same way as "Root"

#

I don't know if it's some editor bug or what it is

heady iris
#

Oh, is this a prefab?

#

If so, is the target in a scene?

spice estuary
#

yes

heady iris
#

You shouldn't be able to assign that at all. I wonder if this is a limitation of the BlackboardVariable type...

#

A prefab cannot reference a scene object.

spice estuary
#

Well the component is only on the non prefab object in the scene

heady iris
#

You have to provide the reference after instantiating the enemy.

spice estuary
#

This was purely for testing

heady iris
spice estuary
#

The Root is a child of the gameobject that has the behavior agent

heady iris
#

oh, sorry, I got "Root" and "Target" mixed up

spice estuary
#

The target will be some "Detect target" action in the future, but for now I just wanted to get it working at first πŸ˜„

#

Root for sure should work

heady iris
#

But that's a bit odd. I would expect you to not be able to assign the Target variable if:

  • The Behavior Agent is on a prefab
  • The "Body" object is in a scene
spice estuary
#

Well I only put the behavior agent on the scene object for now, it isn't instantiated or anything right now

#

that's why I can assign the target since I am not changing the actual prefab right now

heady iris
#

Ah, gotcha

spice estuary
#

hmm maybe it has to do with this

#

The target is highlighted in bold here but root is not linked or something

heady iris
#

yeah

spice estuary
#

ok yea that was it lol

#

idk why it didnt do that for Root but did with Target

#

so I have to link the variable

#

and it works

#

well thanks anyways for being my rubber duck πŸ˜„

heady iris
#

I wonder if some names get special treatment

spice estuary
#

Yeah it could be

#

Also noticed there's no rigidbody blackboard variable, wonder why that is

clear basin
#

another problem, each time i run the game i get this error
Invalid editor window of type: UnityEditor.FallbackEditorWindow, title: Failed to load UnityEditor.EditorApplicationLayout:FinalizePlaymodeLayout ()

knotty sun
heady iris
spice estuary
#

Ok I think maybe I know what happened

#

I think maybe my Root was a transform at first. If I try to create a new action and they are all gameobjects, it autolinks

#

seems like it doesnt like transforms for linking

heady iris
#

Oh, the types didn't match

#

That'll do it

spice estuary
#

Well it did after, but even now if I create a transform blackboard variable, it doesnt want to autolink it when you type the definition of the action

heady iris
#

Interesting.

spice estuary
#

for example here I created MyTransform

#

but as you can see it autofills Gameobject in the action, but the transform isnt

clear basin
heady iris
#

I guess they want you to use GameObject instead of Transform (since they do always go together)

spice estuary
#

must be a bug with Transform then, I just tested with float and it autolinks there

heady iris
#

Is Transform even an option in that list?

spice estuary
#

it is

heady iris
#

wait, of course it is; you already did that

spice estuary
heady iris
#

Weird

spice estuary
#

it seems very limited what it auto fills out though, seems like it's just gameobject and maybe the basic types

#

tried with AudioClip and a monobehavior script too and none of those get filled out

heady iris
#

i have to stop before i get nerd-sniped any harder haha

#

didn't see anything too obvious in the code

glass swan
#

Hello!

#

Is there an existing way for making this (but 3D):

#

I want a kind of navmeshsurface that bakes a bit like if there was a cloth over the objects

#

(in the quick paint I did, the **black **part is the ground & its objects, and the **red **part is the surface that elements could use for calculations)

#

(for giving 100% of the info, this is for moving the root of a procedurally animated
crawling-thing)

leaden ice
#

So you'd need NavMeshPlus

#

And Navmesh uses an agent that has a radius so it should kinda work that way out of the box

glass swan
#

Ah no no I want it 3D

#

Just didn't had budget to draw a 3D example lol

glass swan
vestal arch
#

(but 3D)
smh praetor

glass swan
#

I'll try to explain myself better: The image shows a front view (NOT top view). And it is 3D

leaden ice
#

Afaik navmesh doesn't handle anything in the "vertical" axis really

glass swan
#

So what I want is kind of a surface that would look like a cloth was put on the whole level

rigid island
#

navmesh surface can bake at any angle

heady iris
#

It would be reasonable to create a surface that doesn't tightly stick to a visible object

glass swan
heady iris
#

You know, mentioning terrain gives me an idea

#

you could figure out a sampling process that gives you this "smoothed out" surface, then use that to set the height of a terrain that you then bake

#

It's a bit roundabout, but that saves you from having to figure out how to generate the navmesh on your own

glass swan
#

Honestly if it isn't even a navmesh it would be OK to me

heady iris
#

oh, you'd still get a navmesh

#

you'd just bake it based on a terrain you create

glass swan
#

The main thing is this sampling process hahaha

heady iris
#

The process could actually be pretty simple

#

Create a heightmap from your world -- so, basically, shoot raycasts straight down

#

Next, blur the heightmap.

#

You'd want to do something that never reduces a height, though

#

Maybe blur it and then take the maximum of the new and old pixel values

glass swan
#

Bro this is genius

heady iris
#

plug that heightmap into a terrain and you can bake a navmesh based on its collider

#

you could also create a mesh out of it, I guess

#

but the terrain does that for you

heady iris
glass swan
#

Yep

#

Thx for the help mate πŸ’ͺ🏼

still jungle
# spice estuary

WordTyprSentence.cs in com.unity.behaviour have code of this wizard, seems like only value types are supported and GameObject for auto suggestion since only those gets pulled from blackboard asset for suggestions

compact spire
#

Hey everyone, I need help wrapping my head around this issue. I have a 3d grid of size 1 for objects and another grid of size .5 for volume. If I create a cube (center pivot) in the first grid I would then need to create a 2x2x2 set of points in the second grid. The problem is that the 2 grids aren't aligned in world space and I'm not sure how to do deal with the offsets in a way that won't cause problems. Anyone dealt with anything like this before?

leaden ice
#

Convert to and from grid coordinates with myGrid.CellToWorld and WorldToCell

#

You can convert from one grid to the other with:

Vector3 worldSpace = grid1.CellToWorld(coordinateInGrid1Space);
Vector3Int coordinateInGrid2Space = grid2.WorldToCell(worldSpace);```
compact spire
#

@leaden ice I was using those originally, but I moved away from them for some reason. I'll take a look at them again.

leaden ice
#

i.e. if you scaled, rotated, or translated the GameObject the Grid is on, it will be respected.

compact spire
#

Well I am doing a lot of rotating/scaling ect on these objects

#

that's been a whole other issue

#

Are there any downsides to Unity's grid system?

leaden ice
#

I guess the fact that it's a Component and requires a GameObject?

#

also if you use hex grids the coordinate system they use is weird

compact spire
#

That's not a dealbreaker

heady iris
#

I really like working with grids

#

they give you a new coordinate space and make it very easy to reason about that coordinate space

deft hornet
#

Hello, i have a problem with facepunch steamworks api. When i try to upload a folder to the steam workshop it gives me InvalidParam no matter what. I have tried changing the lenght of the title and description, removing the image, changing steam cloud storage limit, activating ugc on steamworks. I just can't get this to work properly, it always says InvalidParam

 async void PublishToWorkshopAsync(string Path)
 {
     var result = await Steamworks.Ugc.Editor.NewCommunityFile
         .WithTitle("Test world")
         .WithDescription("Workshop test")
         .WithContent(Path)
          .WithPreviewFile("C:/Users/Username/OneDrive/Desktop/test/test.jpg") 
         .WithTag("Level")
         .WithPublicVisibility()
         .SubmitAsync();

     if (result.Success == false)
     {
       
         Debug.LogError("Error while uploading");
         Debug.Log(result.Result);
     }
     else
     {
         Debug.Log("Succedss workshop");
     }
 }```

Thanks
leaden ice
heady iris
#

A pretty big revelation I had is that I don't need to think about things like "how do I figure out how much to move based on the size of the object?"

#

I just need a fixed move in local space

#

the Transform will figure out what that means in world space

heady iris
#

I have a script that scatters objects on a flat surface. I realized that I literally do not need to care about how that surface is positioned, rotated, or scaled, as long as I work in the correct coordinate space

deft hornet
#

it returns a result

#

and it says invalid param

leaden ice
deft hornet
#

Debug.Log(result.Result);

heady iris
heady iris
# compact spire How so?

I have a "reference" Transform that's used to define the area in which I scatter objects (using a Bounds struct). I calculate a local position to put each object at and only go to world-space at the last second (when I'm actually spawning the object)

heady iris
#

unless your username is literally "Username" πŸ˜›

compact spire
#

@heady iris Oh I see

#

I think there still an issue even if I use the grid system

heady iris
#

I wish Transform gave a clear way to go from world to local and vice-versa for rotations

compact spire
#

there has to be a .25 offset somewhere between my size 1 grid and my .5 size grid

#

or I need to not be using center origin for everything

leaden ice
#

that's what I was saying before about it respecting the position, rotation, and scale of the object

deft hornet
heady iris
#

yeah, I was hoping for a detailed error message

#

a string or something

deft hornet
heady iris
#

Ah, one possibility

deft hornet
heady iris
#

darn

wheat spruce
#

I just discovered something pretty helpful!

#
  private void Start()
  {
    Destroy(gameObject, 3f);
  }```
#

You can destroy something after some time in the Destroy method

#

Makes it very easy to despawn my bullet prefab after it gets instanced

deft hornet
deft hornet
#

a lot of blank maps just got added to the workshop

#

0 bytes and no previews

spice estuary
wheat spruce
#

I should put a trello board together, tbh

#

On the topic of bullets, a ScriptableObject would be an ideal data structure for projectiles, right?

spice estuary
#

Depends, it's def an ideal data structure for storing data that doesnt change much

autumn field
#

I'm trying to use newtonsoft json to populate specific fields of an existing array, leaving missing members alone. Unfortunately it is assigning default values to missing members and I have no idea why. I've tried every setting and attribute which should signal newtonsoft to ignore missing members, but it refuses . Am I missing something obvious here?

[System.Serializable]
public class GameRefs
{
  public SceneInfo[] SceneInfos;
}

[System.Serializable, JsonObject(MemberSerialization.OptIn, MissingMemberHandling = MissingMemberHandling.Ignore)]
public class SceneInfo 
{
  [JsonProperty("Header")]
  public string Header; // correctly populated by newtonsoft
  [JsonProperty("Body")]
  public string Body; // correctly populated by newtonsoft
  [JsonIgnore]
  public Transform Transform; // nulled by newtonsoft
  [JsonIgnore]
  public float ScanAngle; // set to 0 by newtonsoft
  [JsonIgnore]
  public Image3DScene Scene; // nulled by newtonsoft
}

public GameRefs Refs; // Serialized as a monobehaviour field

// Json with just the Header/Body members
var json = 
@"
{
    ""SceneInfos"": 
    [
        { 
            ""Header"": ""ElC-39A"", 
            ""Body"": ""Test"" 
        },
        {
            ""Header"": ""ElC-39B"",
            ""Body"": ""Test""
        },
        // ... omitted for brevity
    ]
}";

var settings = new JsonSerializerSettings
{
    MissingMemberHandling = MissingMemberHandling.Ignore,
};
JsonConvert.PopulateObject(json, Refs, settings);
// Still assigns default values to missing members
soft shard
# autumn field I'm trying to use newtonsoft json to populate specific fields of an existing arr...

JsonIgnore attribute should usually be enough, are you certain that newtonsoft is specifically nulling these fields? If you set them to some specific value in the inspector, is your loading of that file then resetting those specific values to default? (being null or 0 in your case) if so, how are you loading the data? Does it do the same if you make a constructor for the data your loading? AFAIK JSON basically does the equivalent of new T - and Unity will default serialized types automatically so float will default to 0 by Unity, and Transform will default to null by Unity if they are public/serialized to the inspector, so JSON calling new T would also cause Unity to default those values (without a defined constructor)

autumn field
heady iris
#

It is relevant in both places

#

but only if you have a [DefaultValue] attribute, I think

autumn field
#

Roger - well I have tried it with no luck in any case, tho I probably haven't tried every permutation of applying that setting (to the JsonSerializerSettings, attribute on array field, attribute on array element type, attribute on array element fields etc)

@soft shard
The array is serialized on a Unity component. I want to populate the Header/Body members for localization reasons, but the other fields need to be left alone since they are configured in the inspector. So the array is prepopulated with important data, but after calling JsonConvert.PopulateObject the missing members are assigned default values (as shown in second screenshot). If I don't call the function the fields not lost so it isn't something else.

I tried adding ObjectCreationHandling = ObjectCreationHandling.Reuse to the JsonSerializerSettings in the hopes it would not construct new instances of the array elements, but that did not work. I figured PopulateObject would not create a new instance since it's meant to deserialize over an existing object and a new instance couldn't be assigned to the original unless the target object was passed as a ref parameter, tho I guess it could be doing that for the array elements within the passed GameRefs object's SceneInfos array

#

I added a trace writer to the serializer settings and it is not logging anything about the missing members, so it seems to be skipping them as intended. I'm guessing it is creating new instances of the array elements and losing the other serialized fields in the process as you suggested @soft shard

2025-01-17T15:57:59.531 Info Started deserializing GameRefs. Path 'SceneInfos', line 3, position 17.
2025-01-17T15:57:59.536 Info Started deserializing GameRefs+SceneInfo[]. Path 'SceneInfos', line 4, position 5.
2025-01-17T15:57:59.537 Info Started deserializing GameRefs+SceneInfo. Path 'SceneInfos[0].Header', line 6, position 21.
2025-01-17T15:57:59.537 Info Finished deserializing GameRefs+SceneInfo. Path 'SceneInfos[0]', line 8, position 9.
2025-01-17T15:57:59.537 Info Started deserializing GameRefs+SceneInfo. Path 'SceneInfos[1].Header', line 10, position 21.
2025-01-17T15:57:59.537 Info Finished deserializing GameRefs+SceneInfo. Path 'SceneInfos[1]', line 12, position 9.
...

Do you know if it's possible to circumvent this? Maybe ObjectCreationHandling = ObjectCreationHandling.Reuse needs to be put on an attribute somewhere rather than in the serializer settings πŸ€”

#

This does not solve it either πŸ˜“

[System.Serializable]
[JsonObject(
  MemberSerialization.OptIn,
  MissingMemberHandling = MissingMemberHandling.Ignore,
  ItemIsReference = true,
  IsReference = true
)]
public class GameRefs
{
  [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse, ItemIsReference = true, IsReference = true)]
  public SceneInfo[] SceneInfos;
}
#

To test if newtonsoft was reassigning references I stored a reference to the first array element before the Populate call and then checked its equality against the first element afterwards, and they are not equal

soft shard
# autumn field I added a trace writer to the serializer settings and it is not logging anything...

Im not sure if its possible to take over what happens when you add a new element to your array, or if using a constructor for SceneInfo that only populate the 2 fields will work for you, otherwise the only other option that comes to mind atm may be less ideal, in using JSON to create a "clone" and copying the data over, effectively doing the population yourself, something like:

var data = JsonConvert.Deserialize<SceneInfo>(...);
for (int i = 0; i < data.Length; i++) { someMono.actualData.infos[i].fieldA = ...; } //and so on for all relevant fields

or something similar, except using the data from element 0 of your actual mono data, to re-assign the 3+ missing fields that the default constructor may be setting, though maybe there is a better way im not familiar with or thinking of atm

autumn field
# soft shard Im not sure if its possible to take over what happens when you add a new element...

Thanks! I ended up writing this function. Not happy about it, but it works haha.

void PopulateArrayInPlace<T>(string json, T[] targetArray)
{
  var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
  var sceneInfosJson = JsonConvert.SerializeObject(jsonObject[jsonObject.Keys.First()]);
  // Deserialize the JSON into a temporary list
  var tempArray = JsonConvert.DeserializeObject<T[]>(sceneInfosJson);
  if (tempArray == null || targetArray == null)
    return;
  // Update existing array elements in place
  for (int i = 0; i < targetArray.Length && i < tempArray.Length; i++)
  {
    // PopulateObject updates existing instances
    JsonConvert.PopulateObject(JsonConvert.SerializeObject(tempArray[i]), targetArray[i]);
  }
}
soft shard
#

Well, at least it works lol, glad you found a solution

hexed ravine
# hexed ravine Hey! I'm scratching my head about this problem that _I think_ stems from weird u...

Alright, I got this down to a tiny repro with basically nothing but cinemachine and animation rigging:

  1. Gave MainCamera a cinemachine brain.
  2. Gave CinemachineCamera a cinemachine camera, with a pan tilt bound to input system/mouse look.
  3. Created an empty object, "Sphere", gave it an animator and rig.
  4. Created a "model" child of "Sphere" containing a sphere mesh renderer.
  5. Created a sibling "Rig 1" object containing a multi-parent transform constraining "Model" to the cinemachine camera.
  6. Observed the exact same jitters (vid incoming).
#

Does anyone know what's up? The problem starts happening the moment I introduce the cinemachine into the mix.

Constraining to the main camera (if no cinemachine brain on it) will track beautifully.

#

LateUpdate/SmartUpdate makes no difference.

prime acorn
#

Probably super easy mistake but how do I add materials to the materials array of a mesh renderer? It doesnt let me add them saying the array is of a fixed size so whats the intended way of adding some?

ocean marsh
#

I believe you will have to make List<Material> variable where you store the meshRenderer.materials and then add your material to that variable before storing it using meshRenderer.SetMaterials().

Untested:

var renderer = GetComponent<Renderer>();
List<Material> mats = renderer.ToList();
mats.Add(yourMaterial);
renderer.SetMaterials(mats)

latent latch
#

Ya sure you have multiple material slots on the mesh data?

prime acorn
latent latch
#

Are you working with the prefab or the actual import instance

prime acorn
latent latch
#

Actually it looks like you can just drag it onto it unless you mean in code

prime acorn
#

Yes I mean in code I have the 1 prefab and the material for parts of it are set in a ScriptableObject so now I need to transfer it from the SO onto the prefab in runtime

prime acorn
ocean marsh
#

Add is on the list

quartz folio
#

Well yeah, it's an array

prime acorn
maiden fractal
ocean marsh
#

yes I realize that...

latent latch
#

ToArray ;)

prime acorn
quartz folio
#

You've not posted the error or the code

#

It's very much a function you could choose to use

prime acorn
#

saying the array is of a fixed size
Thats the error, wdym I didnt post it

quartz folio
#

That's a sentence you wrote

hexed ravine
#

just make a new array with the objects you want and reassign the variable

prime acorn
#

A sentence telling you what the error is

quartz folio
#

That's not an error

latent latch
#

you get back array -> make into list -> append to list -> make new array from list

hexed ravine
#

doesnt matter how you make the array, just get the final list of crap you want in there and set it to the property

prime acorn
quartz folio
#

Looks like you don't want any help

prime acorn
#

I do what I dont want is snarky remarks of people that dont intend to give me any

quartz folio
#

An error is a formalized string that usually has a stack trace.

hexed ravine
maiden fractal
#

We also don’t have the context of your code to work with so the solutions provided may not be helpful in your case

#

#πŸ“–β”ƒcode-of-conduct clearly states that you should have those in your posts when relevant so asking for them is not snarky in any way, it just avoids confusion if you just provide them

quartz folio
#

ToArray wouldn't produce an error, which is what I was going to point out with both. "literally what's giving the error..." is the real snark

prime acorn
#

"NotSupportedException: Collection is of a fixed size"

Now that really does sound like its put to the sentence "saying the array is of a fixed size"

I didnt give you my direct code to avoid an A - B problem because maybe my approach is completely incorrect but rather explained what Im trying to do, sure have a single line of code that mirrors what I said Im trying to do

   myMeshRenderer.materials.AddRange(mySOReference.materials);
prime acorn
hexed ravine
#

there's not a single cast in this code

quartz folio
#

There's no casting here, but yes that's one way to do it. Though it's weird to resize the materials array

prime acorn
#

I have 2 array, make those arrays into a list, make the list into an array

quartz folio
#

The materials array should be the size of the number of submeshes, which is generally the size that it imported at

hexed ravine
#

anyway, there should be cuter functions you can use for this if that's what you're after

knotty sun
hexed ravine
#

but it's all generally the same thing

quartz folio
#

But you can use GetMaterials and SetMaterials with only lists too

prime acorn
maiden fractal
quartz folio
#

Sure

hexed ravine
prime acorn
#

I have a creature
that creature has a Material that makes it blue
I spawn creatures according to my ScriptableObjects
this SO decides what color it should have so I put the material on that instead
So I end up with the same prefab having the same mesh but that mesh can get either of many Materials depending on what SO I chose

hexed ravine
#

Okay yeah, I follow.

#

What's the problem with that?

prime acorn
#

Well since I removed the material that I recolored and have it as a Material[] on the SO now I need to add the Material[] of the SO back onto the MeshRenderer, else it just wont have that material obviously, and the question now was for the proper way of doing so because as I mentioned above I dont like the constant back and forth on the different types and just adding doesnt work because of fixed array sizes

hexed ravine
#

Gotcha, yeah. I think all of that makes sense but there's not really a way around it.

You can't resize an array. You have to make a new one in the desired state.

#

There's a couple of different syntaxes by which to do that, some approaches are slightly more efficient than others, etc.

but ultimately you need to put a new array in there, and that array needs to have more elements than either of the arrays you're sourcing elements from.

#

like for example, you don't need to go array -> list -> array.

I think that the firstArray.ToList().AddRange(secondArray).ToArray() is the cutest/most legible approach

prime acorn
#

Yeah I think I found a way that while not totally making me happy I feel relatively okay about

hexed ravine
#

but it's slightly less efficient than the alternative:

make new array of size firstArray + secondArray then iterate over each element in each array, setting them in the new array

#

that said it doesn't really matter, it's a little extra pressure on the GC because it will need to collect the intermediate list but shouldn't take precedence over readability

prime acorn
#
foreach(MeshRenderer wingPart in WingParts)
{
    Material[] wingMaterials = new Material[Moth.Wings.Length + wingPart.materials.Length];
    int i = 0;
    foreach(Material wingMaterial in Moth.Wings)
    {
        wingMaterials[i] = wingMaterial;
        i++;
    }
    foreach(Material wingMaterial in wingPart.materials)
    {
        wingMaterials[i] = wingMaterial;
        i++;
    }
    wingPart.materials = wingMaterials;
}
hexed ravine
#

yeah basically the only two approaches

quartz folio
#

Reading .materials creates a copy of the array, so now you're creating an array just to get the length

prime acorn
#

aint that great

hexed ravine
#

your code is a lot uglier than it would be with just the toList().toArray(), but I mean, I never have to read that again 😎

#

why would .materials be creating a copy? You're just accessing the materials property

prime acorn
#

because unity magic

hexed ravine
#

that's fucking nuts

#

til LOL

knotty sun
prime acorn
#

but it will do that anyways at some point, at latest when I set the new arra yso I should just cache it in general then I suppose

hexed ravine
#

but yeah, I did say there were two options

prime acorn
#

Or will the cached value also be copied?

quartz folio
#

The best part is when people use mesh.vertices.Length in a for loop and allocate a massive array, a massive amount of times lol

hexed ravine
#

that's so dope, tbf that is the last thing I would expect

prime acorn
#
foreach(MeshRenderer wingPart in WingParts)
{
    Material[] GOMaterials = wingPart.materials;
    Material[] wingMaterials = new Material[Moth.Wings.Length + GOMaterials.Length];
    int i = 0;
    foreach(Material wingMaterial in Moth.Wings)
    {
        wingMaterials[i] = wingMaterial;
        i++;
    }
    foreach(Material wingMaterial in GOMaterials)
    {
        wingMaterials[i] = wingMaterial;
        i++;
    }
    wingPart.materials = wingMaterials;
}
``` this would fix it and only create 1 copy instead of 2 right?
spice estuary
quartz folio
#

No, though Rider has a lot more warnings than VS/VSC

spice estuary
#

right now I'm using sonarqube

calm echo
rich ledge
quartz folio
#

Also half of those materials will be copies, and the other half not-unless the SO ones are being instanced somewhere else

quartz folio
bright token
#

Hi, Im having a problem: When I build and run my game from the editor, it works perfectly but when I close it and then start the .exe manually or just build and start the .exe manually, it loads the "Made with unity" and then instantly crashes. My only idea on why this could be is because I worked on settings (resolution settings) with playerprefs

Also: Im using steamworks, I have my own steam app id and its connected to steam, but that wasnt hte issue, before I added the settings it worked fine

knotty sun
bright token
knotty sun
#

are you doing a mono or il2cpp build?

bright token
#

mono

#

but I do not think switching to il2cpp will change much, i mean i dont have much yet, and as i said building and testing worked perfectly everytime before I added the settings

#

i will quickly remove everything about the resolution thing and try it out

knotty sun
#

I'm concerned by the lack of info in the player log, that indicates a severe error

bright token
#

I mean it could be that I overread sth but this is the log

#

ill do some more debugging and report

cosmic rain
bright token
#

ok I did some debugging and testing and its because of steam initialization, i have my steammanager here:

So it might be related to my appid, since the "RestartAppIfNecessary" is invoked

#

this is so weird, i did build and run again and it works

#

now i click the .exe file and it doesnt work

cosmic rain
#

One thing that bothers me is that you only catch specific error in awake. I'd catch a generic error, output it to the console and quit instead.

catch (System.DllNotFoundException e)
#

Also, I'd debug the issue like this: add code that waits for the debugger to attach in awake. Then attach the debugger and step through the code.

vague tundra
#

Hey guys,
How can I define an area of my UI (by stretching a panel over the area, for example) and have that panel be invisible, detect some pointer events like Enter and Exit, but be transparent to all other events like mouse clicks?

latent latch
#

probably

#

Oh you're asking how, well start on something and probably seek help when you can offer something to work with

floral river
#

Why if i change global volume component values in game its not changing it. but if i change it when game is stopped it works

quick elbow
#

I'm trying to add a .editorconfig to my unity project, but VS doesn't seem to be using it. I want it to essentially auto-format my code or give a warning for things like modifiers not being in order. What might be the reason that it isn't working? I have a .editorconfig file at my root unity project level (Assets, Builds, Library, Packages, etc.)

rigid island
nimble dagger
#

So i am making a unity 3d fps multiplayer game with photon fusion and i have stumbled upon a problem where the other players can not hear your footsteps, i have tried using photon [Rpc(RpcSources.All, RpcTargets.All)] but this did not work. Anyone that can help?

low root
#

Hi is there anyway that Unity supports Webcam eye tracking? My team is thinking of developing a game with blinking but we are having issues finding anything about the subject. Most searches lead to adroid stuff or like oculus. But we want just the webcam

rigid island
low root
#

its really annoying cause theres been a bunch of development with XR tech but like webcam tracking has been left to rot lol

low root
#

we might just have to work on something elese (its for a game jam)

#

super sad how hard it is to find stuff on this

rigid island
#

yeah working with these models isn't trivial , at least unity makes it easier to load them. Check quickstater on sentis

rigid island
low root
#

we just want blinking man T_T

plucky inlet
#

Do you need to use unity at all, as hte gamejam is about unity, or could it be anything?

#

You could also look into web solutions and run your game as a webgl export. than you could hook the web part to the unity part with calls

low root
#

we wanna make a run and gun game with blinking as a mechanic

#

like you blink and teleport as a little gimmik

plucky inlet
#

then your gimmik might take 75% of your time of the game jam πŸ˜„

rigid island
#

unity also lets you just use python libraries

low root
#

yeah lmao. Were about to abbanodn it if we can't get this addon to work

#

it's so werid cause like people have done this before??? but liek a bunch of stuff is deprecated

#

this is a two week game jam so we have a good amount of time which is why we are exploring it

rigid island
#

pepole who make it work don't bother writing guides for it

plucky inlet
#

most of it is on mobile devices, which is still working

plucky inlet
low root
#

no sadly not. We need a webgl build too

plucky inlet
plucky inlet
rigid island
#

bummer

low root
#

like look I've made around 21 games before I got no idea how I'd do that stuff lol

plucky inlet
low root
#

not that making a lot of games is credentials im just saying

plucky inlet
#

So, your web plugin detects blinking, you can send the message to unity and do your stuff there

rigid island
#

still need some type of model to you can use maybe JS has tensorflow

plucky inlet
#

hit and miss on google first result

low root
#

my teams brain is too small lmao im gonna be real

plucky inlet
#

But thats out of scope from this channel then, cause its not unity relevant to get facetracking running in web πŸ˜„

rigid island
#

tbh you can just use one specific to blinking

low root
#

like theres a hundred things with like mobile and shit but like why no webcam one lmao I just wanna blink

plucky inlet
#

I think you got the leading ideas, that can help you. The rest is up to your team πŸ˜„

low root
#

Dude im gonna be real doing it through webgl java scripting does not seem really that viable for us cause we would have to learn the xr stuff on top of the browser scripting through unity lol. I do apperciate the help though my guy. We are probably just gonna move on with a different idea if we can't get this openCV addon to work

#

πŸ™ thank you for the wisdom my guys

plucky inlet
# low root Dude im gonna be real doing it through webgl java scripting does not seem really...

In the end you have to learn
β€’ WebGL JavaScript to C# Calls
β€’ Install a javascript package and run it
β€’ Fire the call from 1st step with the recognition from the package
β€’ React to the event in Unity

Or you could pay someone who did it probably https://assetstore.unity.com/packages/tools/camera/imagine-webar-face-tracker-279828?srsltid=AfmBOoop7a75d4wEzFFWarlZHiAilGP-_e9vFgbbsxpzFwWDGrwnWGGY

Get the Imagine WebAR - Face Tracker package from Imagine Realities and speed up your game development process. Find this & other Camera options on the Unity Asset Store.

low root
#

also wouldn't doing it through javascript make testing really really slow? cause we would have to build it every single time

plucky inlet
#

There is also a tutorial, but might be for mobile, not sure: https://learn.unity.com/course/create-with-ar-face-filters?uv=2022.3

Unity Learn

In this course, you will learn to create your own augmented reality (AR) face filter apps using Unity. You will create multiple face filter projects from start to finish that are compatible with both Android and iOS devices. The first app you’ll create will overlay textures, animated 3D models, particles, and other effects on the user’s face. T...

#

But as you keep argueing, what COULD slow you down, just decide for your own πŸ˜„ Go for it or not.

#

If its not important to the game, its not important

low root
#

cool thank man

still jungle
# low root cool thank man

you should use OpenCV but there are only 2 options c++/python for easy set up, rest will be troublesome or deprecated

#

i tryed with js some years ago, it was huge pain

dense rock
#

Hey there, I've been trying to connect my MySql Database to unity via ASP.Net Core API (Been following Tarodev's tutorial). It's been working well until I tried introducing the Identity package in the API. I can't use the user account table as a class in unity, but I need to store all data in reference to their user, so I don't know how to progress from here. I thought about creating an additional player table, which basically just copies the users and is referenced with their ID, so I could store additional app-specific info there, but I really don't know whether that would be good practice or just bite me in the knee in the long run..
Anyone got some ideas?

cold parrot
quick token
#

how can i rotate towards a target rotation using rb.angularVelocity

#

google has come back with nothing and everything i've tried has just turned into this in some way or another guh

mossy snow
languid hound
#

You need a perpendicular vector for torque which cross provides

#

If that doesn't work try switching the arguments in cross around I'm not too sure which way they should go around because quite frankly my brain is melted right now

#

Oh right uhh

#

targetForward should be (lookAtPosition - rigidbodyPosition)

quick token
#

lemme try this real quick

languid hound
#

Oh right uhh you might also want to increase the angular drag btw

#

This isn't a spring so it wont account for the angular velocity and it might overshoot a bit

#

I found 1.7 is a sweet spot

quick token
languid hound
#

Awesome!! Glad it's all good

faint hornet
#

hey everyone, am wondering... how does discord impliment code snippets and do you know if it has an api that i can use in my own applications outside of discord?

somber nacelle
unborn elm
#

Any good input on how to best organize a system for display sprites based on underlaying grid system. Would like to avoid a game object for each sprite. Is the standard tilemap the best option?

latent latch
#

probably

#

it'll chunk it all for you

stark plaza
#

I'm very used from work to ReSharper, is anything similar widely appriciated and free for Unity?

hexed pecan
#

I'm struggling to understand what ReSharper is

#

Seems like a bag of handy features?

#

What features does it have that, say, Rider doesn't already come with?

stark plaza
#

I don't know if free Rider already includes ReSharper, but yeah I mostly use it with vs2022

#

It provides utilities, formatting, enforces coding standards yadda yadda

hexed pecan
#

Apart from some of the AI assistant stuff I guess

stark plaza
#

Time to always use rider out of work? I guess

hexed pecan
#

I suggest trying it out πŸ€·β€β™‚οΈ

stark plaza
#

ty

hexed pecan
#

My migration to it was very seamless (from VSCode), mainly because it lets you import the keymap and other settings from your previous IDE when you start using it

vague tundra
#

Hey guys,
How can I define an area of my UI (by stretching a panel over the area, for example) and have that panel be invisible, detect some pointer events like Enter and Exit, but be transparent to all other events like mouse clicks?

narrow nebula
#

So I made a encounter system for my game so I can easily create different enemy encounters. Now I want to add a encounter manager script that can handle the behaviour of the enemies.
But i'm not sure whats a good way to make it so that I can attach the script to the ScriptableObject in the editor since I can't just attach a normal script there.


[CreateAssetMenu(menuName = "Custom/Encounter")]
public class Encounter : ScriptableObject
{
    public GameObject[] enemyPrefabs;
    public Vector3[] spawnPositions;
    public int minFloor;
    public int maxFloor;
    public EncounterManager manager;
    public bool IsValidForFloor(int floor)
    {
        return floor >= minFloor && floor <= maxFloor;
    }
}
knotty sun
#

you cannot do it in the editor. you will need to use either dependency injection from the EncounterManager or have the SO find the manager object OnEnable

narrow nebula
knotty sun
cold parrot
hexed pecan
#

That's what I thought heh

chilly surge
#

I've heard that ReSharper hardcore kills VS performance.

cold parrot
#

Doing something will always be slower than doing nothing.

#

If there is no net-value in the things that R# does for you, it should not be used

lost rivet
#

wait does unity not support priority queue?

chilly surge
#

Right but I've heard that it's by a lot, to the point that people advice against it.

cold parrot
#

Generally R# and rider help a lot with reducing refactoring effort, language misuse and paying down technical dept

cold parrot
chilly surge
lost rivet
cold parrot
chilly surge
cold parrot
chilly surge
#

Not from what I've been told by others, but eh I don't use either so I can't know for sure.

cold parrot
#

Or make your own

rotund burrow
#

I want to create a camera system like in game Furi. it's a top down 3D boss rush game, camera centers on player, center of arena, midpoint between boss and player and so on. I could try to replicate it but i dont know exactly how it works, so i'm looking for tutorials.

lost rivet
#

doesnt make it any less lame

hexed pecan
hexed pecan
#

Cinemachine probably has a lot of the features seen here, if you don't want to program it yourself

rotund burrow
#

i'm fine with programming myself

lost rivet
#

seconding cinemachine

hexed pecan
#

You didn't really ask a question yet

lost rivet
#

just make a script that changes the cameras transform?

#

if thats what u are asking

hexed pecan
#

At its core, camera scripting is just about moving a transform

rotund burrow
lost rivet
#

i would suggest you try doing it without a guide and look for one if you get stuck

lost rivet
#

do you guys think its better to represent a grid as a 2d array or as a dictionary of Vector2Ints?

wheat spruce
latent latch
#

dictionary because best data struct

wheat spruce
#

unless of course you have something fancy in mind

steady bobcat
#

if its a fixed size grid then do a 2d or single dimension array as this the lookup is simply calculating the index

steady bobcat
#

🧠

latent latch
#

what's the cost of a null index though

knotty sun
#

none

latent latch
#

assuming say you want a 100x100 grid

#

no pointer cost or anything of that sort at all?

knotty sun
#

no

steady bobcat
#

just the memory being un used but its often worth it

hexed pecan
#

The use case matters

latent latch
#

for the most part Unity makes all its grid with some dict, but it's because they're usually infinite

hexed pecan
#

Yeah, with an array you are constrained to a certain size

wheat spruce
#

I like how easy it is to represent a 2D array as a 1D array
[x,y] isnt too bad, but its added effort to deal with a second item
[i] is just so much simpler

hexed pecan
#

And resizing it would be costly

steady bobcat
#

yea if its not a fixed size then do something else or have small chunks of a fixed size

hexed pecan
lost rivet
#

its not sparse, but from what ive seen 2d arrays dont support a lot of operations (like, linq stuff) which is slightly annoying

knotty sun
latent latch
#

I think box did some testing in c#'s 2D array and apparently has some performance problems

hexed pecan
steady bobcat
#

I thought a 2d array is just syntax to do the a,b -> index for you

knotty sun
steady bobcat
#

then there shouldn't be a perf difference right?
I prefer single dimension and doing it myself as i needed to use said array in some generic stuff and 2d arrays cannot

latent latch
hexed pecan
wheat spruce
#

i wouldnt suggest copying the code, just more as a way to show how youd store a 2D array inside of a 1D

steady bobcat
wheat spruce
#

array[(y * Width) + x] its pretty much just this expression that matters

lost rivet
#

so 1d array thats a 2d array?

latent latch
prime acorn
#

How can I add sections like these to my script in the editor?

latent latch
#

SerializedClasses

steady bobcat
#

all an array access is in non managed languages is array pointer + index so if you access sequential elements frequently you benefit from less cache misses
but no idea what bullshit mono causes

latent latch
#
[Serializable]
public class Damage
{
    [field: SerializeField, Range(1, 20)] public int Amount { get; private set; } = 1;
    [field: SerializeField] public CombatElement DamageType { get; private set; }
}

[Serializable]
public class Defend
{
    [field: SerializeField, Range(1, 20)] public int Amount { get; private set; } = 1;
    [field: SerializeField] public CombatElement DefendType { get; private set; }
}
...
public Damage Damage;
public Defend Defend;```
hexed pecan
#

The default foldout is a bit less sleek than the one in the screenshot but yeah

steady bobcat
latent latch
#

people just need larger monitors

wheat spruce
# lost rivet so 1d array thats a 2d array?

not sure how much this helps, the yellow is if you had a 1D array, blue is the 2D array.

Say you wanted to find item 4, which would have the actual coordinate of [1,1], if you follow the white boxes (sorry if theyre badly written) you can get an idea of how it would work

steady bobcat
#

i prefer attributes to be above fields and properties myself

wheat spruce
#

really the 1D array should have been formatted like this, but for the sake of the diagram it might have been confusing

knotty sun
hexed pecan
#

Well I mentioned that in the very message you replied to

knotty sun
hexed pecan
#

Happens

teal hare
#

im late the convo but i have a 1d array for my dungeon grid and it was a bit difficult

#

mostly cause i didn’t look up a tutorial and didnt know 2d was an option

hexed pecan
#

Just make methods that do the index conversion for you

teal hare
#

yea i did

knotty sun
teal hare
#

but i place objects in the place of the array and i had to specify their spacing and everything in code

#

and then the rooms are connected by hallways

#

and they form a maze with specific rules

teal hare
#

turns out i did something sorta normal

chilly surge
# knotty sun you know you can remap a 1D array to a 2D one with no extra cost

There are 3 options when you need to deal with 2D (or nD in general) arrays:

  • 1D array (T[]) and map index x, y into index x + y * w.
  • Jagged array (T[][])
  • Multidimensional array (T[,])
    Unfortunately multidimensional arrays miss out on quite a lot of optimizations, that they are even slower than jagged arrays.
    Jagged arrays while faster than MD arrays, is likely to be slower than 1D arrays, because each row is a separate array on heap and likely to not be in CPU cache. Although whether this cache miss matters or not does depend on your access pattern.
#

Whether the performance difference between these 3 options are big enough to matter or not, is a separate question.

fringe knot
#

Need Help: is it possible to access or save values in cloud save using path to the data so that nested values can be easily accessed or only save load using dictionary like structure key and value.

cold parrot
lost rivet
#

i ended up going with the dictionary anyway :/
being able to use a sparse grid might be useful in some applications

#

damn this version of C# doesnt use collection expressions either noooo

latent latch
#

dictionary is bestest

lost rivet
lost rivet
fringe knot
lost rivet
#

I am not super familiar with networking stuff in unity but i doubt there is such a restriction

#

i think its better if you looked at the documentation

fringe knot
#

well the examples they have is like using a dictionary not a path so i guess that might be it still thought there might be any other alternative way which they might have not shown. anyway thanks

heady iris
chilly surge
#

I haven't looked into the exact mechanism as to why MD arrays are so slow, but IIRC it has something to do with lower bound handling.

heady iris
#

That's what I'm seeing on some StackOverflow post

#

That's so counterintuitive.

chilly surge
#

Yeah it's a bit unfortunate that a language feature created to solve that problem ends up not being used over a primitive hand rolled solution.

heady iris
#

Good one, Stack Exchange. I'm not losing half an hour this morning

limber sentinel
#

Prevent Wallrun

grim flame
#

Hello, I am making a new camera controller for my space game. And need a bit of help. I currently have this code here. I now want to fix my bug that the camera is wrongly rotated. For that this.planet.Vector3Down(transform.position) returns the correct down vector. How can I implement that it uses this down vector? As you can see in the video, the camera is rotated wrong

vestal arch
#

doesn't look like it's rolled?

#

i think you would have to roll it

grim flame
#

yes

#

How can I automaticlly rool it based on the down vector

#

The down vector dynamiclly changes

quick token
#

have you tried rolling it based on the surface normal?

grim flame
#

no

#

i am new

#

can you help me with that

#

should i shoot a raycast

#

and then use the normals of the hit point

heady iris
#

You need two vectors! The normal vector is easy, but you also need a tangent vector

#

I can explain more later β€” gotta run in a minute…

marble portal
#

There was an issue I had with a college project involving setting the velocity of the player's rigidbody2d in coroutine functions

I set up knockback and wall jumping, which used similar scripts. However, both abruptly fell apart after working on my project for reasons that couldn't be fixed via code. (When the velocity of the rb is set, usually sending the player to the upper right or upper left, an outside factor ends up completely screwing with the rb, only making it go upwards for as long as the coroutine lasts. Print functions showed that the code was working, there was no restrictions on the rb's x position, nothing affected collision, but the x axis never changed during runtime.) I don't want to encounter this again if I ever use Unity in the future, so if anyone has some sort of input for me, I'd like to hear it.

vestal arch
#

well unless someone here has experienced the exact same issue, it's gonna be hard to debug from just the description without specific information

knotty sun
leaden ice
thin aurora
#

Sounds like a lot of guesswork unless code and other stuff is shared

last idol
# teal hare im late the convo but i have a 1d array for my dungeon grid and it was a bit dif...

Hey, I have a game where I store map representation using 1D array of tiles with some calculations. Sorry for late reply but I wasnt nearby PC earlier on. Maybe this will help or inspire you to create your solution: https://pastebin.com/Pqjq4mEi - look at Tile[] array and GetTileIndex method (note-code is not exceptional quality to say at least xD) @teal hare

vestal arch
#

!code

tawny elkBOT
willow pecan
#

i am using dotween and when i use my sliding script it makes it default to the center of the ui, how do i make it so it defaults to where it was when it was edited?

upper pilot
#

I meant a weapon attack collision like a sword slash or a whip.
What are best practices regarding animation + collision.

From what I've seen I can edit each frame of an animation and enable/disable a collider + set the collider manually to match the animation etc.
That is a lot of work, but it's also going to be consisten with the animation.
Another way is to simply have "sword slash" object and enable/disable it separately whenever we attack with a character.

leaden ice
#

not with colliders

#

You can use animation events to fire off the physics queries at the appropriate time in the animation

upper pilot
#

I need to read up on that, first time I hear about it πŸ˜„

leaden ice
#

I mean things like Physics2D.OverlapBox, Raycast, BoxCast, CapsuleCast, OverlapCircle etc

upper pilot
#

Thats the first one I got from googling, let me check

#

is there a guide on that?
It it different from manually placing a collider for each frame(so it matches an animation) then using onColliderEnter/Exit to detect if an enemy was hit?

leaden ice
upper pilot
#

This is what u mean

leaden ice
#

Yes it's much different from using colliders

#

it's a lot simpler

leaden ice
upper pilot
#

Right, but just to clarify, if I have a 2d character sprite animation that has a sword animation/whip animation.
Is the query approach going to make it easy to setup those collisions to match the animation?
I am not sure if I am clear on that part or maybe its not even relevant.

leaden ice
upper pilot
#

I will play with that tomorrow after I setup a scene.
Can I "see" those queries on screen in the editor to make sure they match each animation frame?

#

For example a sword animation that has a long arc for few frames would hit enemies far from the player for few frames, or if its a forward slash it would hit enemies above player head for few frames before hitting the ground etc

leaden ice
#

With some pretty simple Debug.DrawLine or Gizmos code you can visualize them

upper pilot
#

i see, I guess this is still faster that manually adding collider to each frame, so it makes sense to do it this way πŸ˜„

#

Thanks, I will play around with it and see what I can do!

fossil blaze
#

What is the best way to place objects if they have different sizes?

leaden ice
#

What are you trying to accomplish?

#

You need to provide some context

cold parrot
#

!collab

tawny elkBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
β€’ Collaboration & Jobs

earnest gazelle
#

Why does nav mesh agent is slow to calculate the path even in the flat ground and almost 40-50 agents! The agents stop and after some duration, they start moving

fossil blaze
# leaden ice You need to provide some context

I'm trying to organize the placement of items on the shelf, left to right and have some space in between! Each shelf will have a different item on it and each item on the shelf will have a different size

#

it's not like I'm gonna specify for every shelf

leaden ice
jolly anvil
tawny elkBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
β€’ Collaboration & Jobs

fossil blaze
vestal arch
leaden ice
jolly anvil
steady bobcat
fossil blaze
leaden ice
steady bobcat
#

ive made something that does this in 3d with 3d colliders with custom spacing but i cannot share it

fossil blaze
#

I'm making a 3d game, how do I calculate the distance between colliders?

leaden ice
#

You mean "how do I know how big the object is?

Define it manually on the object on a script
Or use its Renderer or Collider Bounds
Or use empty child objects to define the extents of it and use their distance.

fossil blaze
#

you can't use the collider?

steady bobcat
#

How i did it was have it configurable what axis is used. i get the collider sizes and add up the total length and add spacing to know the end total length
Then i calculate the start pos and start placing the elements based on their size for the axis and spacing.

leaden ice
steady bobcat
#

both work but colliders are configurable by you more easily

fossil blaze
#

why it's so complicated:(

leaden ice
#

it's not that complicated

#

it's 5th grade math

fossil blaze
#

Thanks guys, your method seemed to work.

#

Cool, now how to center it all on the center of the shelf.

steady bobcat
#

hows it looking rn?

fossil blaze
steady bobcat
#

snipping tool is your friend

fossil blaze
#

how can I center them on the shelf now?

steady bobcat
#

nvm then. if you want to dynamically "center" all the elements you can calculate the total width first then offset by half on the axis

fossil blaze
#

if my placement point starts on the left

steady bobcat
#

read what i said

#

its basic maths. if box is 300 wide then -150 will "center it"

fossil blaze
#

Okay, thanks. I'll give it a try.

steady bobcat
#

as i presume the objects you are placing are "center pivot" you need to place them but adjust the position so they get placed with their min edge.
Then when you center them all it will truly be centered.

leaden ice
#

Is this not valid or something?
In IdentifiableSO.cs:

    public abstract class IdentifiableSO : ScriptableObject {
       [SerializeField] protected string id;
    }

In RunBaseSO.cs:

    [CreateAssetMenu(fileName = "Run", menuName = "DeltaD/Run", order = 1)]
    public class RunBaseSO : IdentifiableSO { }```
When I create the RunBaseSO from the Create menu I get this error:
> No script asset for RunBaseSO. Check that the definition is in a file of the same name and that it compiles properly.
#

Can we not have an abstract parent class for SO's? I could have sworn this worked

#

Ok restarting Unity fixed it. That was weird.

austere sleet
#

Hello, I have a simple 3d level where a player is on a large cube that rotates on all axis. I want to player to move with the cube, for example if the cube spins, the player is also moving in the game world. Okay so I made the player a child of the cube, easy now the player is not just on the cube not moving, but the player is moving with the cube. One issue now (that I have been trying to fix for a few hours): when the cube roles, so does the player, as in now the player is sideways in the game world, this obv is causing issues with the camera, and it just looks weird from 3rd person.

So my question is how can I keep the player upright at all times relative to the game world, instead of relative to the spinning/rotating cube that it is a child of? While also having the player move with the cube? Any help is appreciated! (fyi I am only a few days into using unity)

hollow ermine
#

can someone help me code movement

somber nacelle
tawny elkBOT
teal hare
austere sleet
#

yes, which I actually just got working, but now the player camera gets all messed up, as in the controls for the player camera, after the cube rotates

teal hare
#

what are the controls for the camera and how is it affected by being a child of this moving cube? is it also rotating?

austere sleet
#

this is the control for the camera movement:

// Control camera movement
if (cameraCanMove)
{
    yaw = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * mouseSensitivity;

    if (!invertCamera)
    {
        pitch -= mouseSensitivity * Input.GetAxis("Mouse Y");
    }
    else
    {
        // Inverted Y
        pitch += mouseSensitivity * Input.GetAxis("Mouse Y");
    }

    // Clamp pitch between lookAngle
    pitch = Mathf.Clamp(pitch, -maxLookAngle, maxLookAngle);

    // Apply the camera's rotation relative to the initial local rotation
    transform.localRotation = initialLocalRotation * Quaternion.Euler(0, yaw, 0);
    playerCamera.transform.localRotation = Quaternion.Euler(pitch, 0, 0);
}

The parent is the rotating cube. The child of the cube is the firstPersonController (which is where this camera control lives)

quick token
#

huh, just realised that the tooltip attribute works with enums

#

anyway, im making a generic script for projectiles. what are some methods for finding an object?

#

so far i've got GameObject.Find and OverlapSphere. my brain is blanking on the rest though guh

#

also added FindGameObjectsWithTag

somber nacelle
#

why does a projectile need to use any Find method? πŸ€”

quick token
#

i was thinking for projectiles that follow an object. just trying to account for as many edge-cases as i can (+ i had a projectile that i need to follow an object anyway lol)

somber nacelle
#

but why would the projectile need to manually find that? could whatever is shooting the projectile not just pass the target in?

leaden ice
#

Seems like bikeshedding

quick token
#

now i gotta try and figure out how to fit that into my code guh

#

wait nvm, i remember why i was putting that in the projectile script now

#

a drone enemy i was making also uses the same script. i should probably rename that script guh

#

i end up rewriting most of this code a lot for a bunch of different things. its way faster for me when i have it in a single component

#

if i need something more specific then i just rewrite it into its own script

quick token
soft nymph
#

I am having some trouble understand the workflow and architecture of engine. I come from a background in Roblox Studio and a common setup is a microservice architecture with a bunch of small systems coupled together that call each other. Rather then a bunch of scripts within the objects themselves

still jungle
#

what the qustion is?

quick token
#

i assume their asking about how they should set-up their projects. how the code should be put together and all that.

quick token
tawny elkBOT
#

:teacher: Unity Learn β†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

cold parrot
#

Might also be helpful to forget everything about Roblox, Unreal, Godot, Processing, Enterprise code and web dev for a while when learning a new framework like Unity

soft nymph
#

thanks

heady iris
#

I remember talking recently with someone about how Roblox games are "shaped". It did feel pretty alien to someone used to Unity.

soft nymph
#

Yah its much different

livid olive
#

Genuine question. I believe this is a c# or i'm crazy. Why does: float a = (int a/int b) Return a as zero?

#

There was a bug in my code with this and this drove me nuts until i saw this on the debugger

quick token
#

wait no it doesn't

#

guh, need more coffee

livid olive
#

C# needs some milk bro.

quick token
#

real pensive

livid olive
#

I'm gen upset tho this was 2 hours of debugging

quick token
#

hm, maybe its something else. i can try helping if you send the full script

livid olive
#
public bool ReduceHealth(int Damage ) {
        health -= Damage;
        float precentage = health / FullHealthRef;
        this.SetSpritePrecentage(precentage);
        if (health < 0)
        {
            return false;

        }
        else { return true; }
    }``` legit just this.
#

heath is a pub var

leaden ice
#

you're doing integer division

#

since they're both ints

#

print their values

#

if health is less than FullHealthRef it will be 0

#

.e.g
5 / 10 is 0 with a remainder of 5

#

when doing integer division

livid olive
#

But does not any other language convert it?? I swear I'm not crazy

leaden ice
#

Most languages will give you 0 here

livid olive
#

especially when the equated var is a float

quick token
leaden ice
#

something like python or JS might give you .5

leaden ice
#

it only see two integers as inputs

#

and does integer division

livid olive
#

This drove me nuts for 2 hours because I though C# would understand this.

leaden ice
#

it understands fine

#

when you do int / int it does integer division

#

If you want a floating point result you should cast one or both operands to float first

quick token
still jungle
#

you need to cast at least one of those ints to float so it auto performs floating-point division

livid olive
#

Wait can I dead ass just do this? float a = (float) b/c

leaden ice
#

yes

#

or float a = b / (float)c;

livid olive
#

Brother notlikethis

quick token
#

2 hours and all you needed was a single typecast

#

truly the c# moment of all time KEKW

livid olive
#

Sobbing crying. Dying a little inside.

#

4 years of comp engi has lead me to this moment of never actually experiencing this.

#

Ya know maybe I haven't coded enough in my life.

quick token
#

i've been doing coding in c# since i joined this server. but, i still make basic errors like that.

#

seems like no matter how hard you try and prepare, it's pretty much impossible to be able know the answer to every problem. just gotta learn as you go

livid olive
#

ya know the more I think about it. The more i realize this is the most (Making a game in unity) I've ever utilized floats. I've worked with a lot of whole numbers in code.

#

That or i'm just using a library someone created or bytes or a network/Dis Sys protocol.

teal hare
#

ive made that mistake so many times and still do but im only now starting to catch it faster

#

ive spent many hours

quartz folio
#

Rider will warn you if you're assigning integer division to a float

loud wharf
#

Btw, how does Unity expect us to prepare to migrate to Unity 7 when it comes?
Will the code be mostly transferrable as long as they're not depriciated?

leaden ice
loud wharf
#

Reasonable.

somber nacelle
cosmic rain
#

Especially knowing that unity is very picky about backwards compatibility

quartz folio
#

Unity 7 isn't a normal release. Whisperings have it having a massive amount of variance regarding changes and impact

#

Depends on what they've settled on now they've gone through the change of management and had time to reflect

#

I've heard talk of ripping out legacy systems completely; but also that management was trying to scale back plans. Nobody can say anything with any confidence beyond the announcement threads made last Unite

cosmic rain
#

I mean, if you're homeless, just buy a house if you use legacy systems, just don't use them.thinksmart

latent latch
#

Unity could use some cleanup. Too many solutions to one problem

loud zenith
#

Hi guys, I have purchased an asset from the store. It is a UI asset. They are using an OFL licensed font in it but it's not looking good for me. Can I change the font when I'm using the asset in my game? Its license agreement says "Standard Unity Asset Store EULA".

leaden ice
latent latch
#

I'd post that onto a paste site even though I'm not likely able to help you here. My only suggestion is chopping it up and printing the work to some doc with a timestamp to figure out what parts of it could be optimized upon.

loud zenith
cunning raptor
#

how would i give my plane lift? and make it turn? i cant find any proper tutorials, the only one i found has no lift. also tried to do it myself, but turning is very unstable

plucky inlet
cunning raptor
#

afair i got a baseplate and a model(i made) as a plane

hexed pecan
#

How realistic are we talking?

#

Because I'm not an aerodynamics expert... but for lift you could just use AddForce/AddRelativeForce, right

#

And turning can be done with torque

#

A joint (probably configurablejoint) can be used too but can give pretty wonky results if you don't adjust it properly

soft nymph
#

i am trying to figure out which public fields are updated and when on GameObjects but is very inconsistent, sometimes when I hit save after adding a field it doesnt show and other times after removing the field it never leaves

#

for example I removed a boolean from my script and it's still in the explorer

plucky inlet
soft nymph
#

maybe, would hot reloading mess with that?

plucky inlet
#

with "hot reloading" you mean the Unity one?

soft nymph
#

I have Fast Script Reload by Chris Handzilk

plucky inlet
#

yeh, I dont know this one, but I guess, it might

soft nymph
#

is there an official unity one?

plucky inlet
#

Unity should reload your scripts on default, when you change them. your plugin is for playmode bneing active and main changes, so it does only reload the parts and not entire classes and break your playmode session

soft nymph
#

is there a way to reenable reloading after saving?

plucky inlet
#

But description already says: β€’ Creating new public methods

Hot-reload for new methods will only work with private methods (only called by changed code)

soft nymph
#

ahh

plucky inlet
#

So, when you enter or leave playmode and did not turn it off, unity should recompile anyways

#

but if you rely on hotreload in playmode (feels hacky to me :D), you should read about what to expect from it

soft nymph
#

it doesnt seem to be working at all now even after restarting

#

Just made a boolean in the script, saved, entered unity and hit play but it doesnt appear

plucky inlet
#

Remove the package and see what happens

thin aurora
#

Script reloading will become a thing then, which is essentially Hot reloading as far as I know

soft nymph
#

ok now my unity is fully busted

#

restarted unity entirely and its not synching code at all

plucky inlet
#

Check that your IDE is correctly installed

soft nymph
#

it is

#

well

#

it was working before I installed the package

#

so not sure how that works

#

it's very inconsistent

plucky inlet
#

so did you remove the package?

stark sun
#

https://pastebin.com/HPePvkJj grab script
https://pastebin.com/UFaeAgpD lever script
https://pastebin.com/aeE4Gcf0 trapdoor script
the balance script I didnt include just have rigidbody2D.Moverotation()

problem is when I grab to pull the lever, its like changing its limits the second time I grab.It cant get past a point by grabbing but can push it with my body.

soft nymph
#

and then restarted unity and visual studio

#

it was working and every other time it breaks

#

like the code has an error right now and yet unity runs as if it doesnt

#

as well as not creating the explorer value

plucky inlet
#

explorer => inspector ?

soft nymph
#

yah sorry

#

force of habit

plucky inlet
#

Maybe restart your entire system. that package seemed to hook into a lot of stuff

soft nymph
#

is there a way to reset unity

#

without reinstalling

plucky inlet
#

Starting by deleting the library folder. Maybe regenerate the csproject files from settings menu

soft nymph
#

where can I find that fodler

plucky inlet
#

Right to your assets folder in (actually) explorer/finder

soft nymph
#

alright trying it out

#

still nothing

#

this alone makes me want to move to godot lmao

#

ok so the only times the files sync

#

is on

  1. Startup of unity
  2. when I hit "attach to unity" in visual studio
plucky inlet
tawny elkBOT
errant flame
#

Is burst supported in webgl i mean can i run my jobs in webgl ?

late lion
errant flame
#

if i use paraleljobs in webgl they behave in single thread and other platfroms its uses other threads too right ?

latent latch
#

webgl is single threaded

#

for secruity reasons

#

you can actually enable those native arrays shared buffer arrays but most services dont support them. (Actually they been long since depreciated)

errant flame
#

thanks alot @latent latch @late lion

latent latch
#

odd time to be alive when there's more GPU support for browsers

indigo orchid
#

in this code the running anim works well it switches to the walk animation but the player is unable to move like it glitches out after 1 or 2 key presses and I want it to switch to the 2nd frame of the walk animation in the blend tree
https://paste.ofcode.org/b7sUm2sgjL77HmjY3Udq2z

cunning raptor
#

i tried giving lift based on speed, and the plane did go up, but turning was a nightmare

#

i have no idea how to combine lift and turning

plucky inlet
cunning raptor
plucky inlet
#

Just post, please dont ping πŸ˜‰

obsidian mulch
#

Quick question. Say I have to NPCs with CircleCollider2D and Rigidbody2D, and they are supposed to detect each other. Both colliders have a radius of 5. Does the colliders detect the rigidbody of the other NPC, or will it detect their circle collider, effectively making the radius needed be 10?

errant flame
#

Can i use native list like this ? for extracting data inside a job because i dont know the possiable lenght of result

            [NativeDisableParallelForRestriction][WriteOnly] public NativeList<NetworkTileBurstData> Results;

if i dont use disable tag it gives error for reading it i guess, should i use it anyway πŸ˜„

cold parrot
latent latch
errant flame
#

@cold parrot so if we dont know the lenght of the outcome inside job should we use arrays like a fixed buffer and give them a extra size for not reaching limit then discarding the empty or invalid ones inside buffer is this the best route ?

cold parrot
#

if you use parallel writers as suggested you will need to pay the synchronization overhead

late lion
#

But note, parallel writer cannot resize the internal array, so you will have to have pre-allocate for the maximum size.

errant flame
#

@late lion @cold parrot thanks a lot i will give a try for both methods

errant flame
#
            NativeList<NetworkTileBurstData> results = new(allCombinations.Count,Allocator.TempJob);

            [WriteOnly] public NativeList<NetworkTileBurstData> Results;
            
            public void Execute(int index)
            {
                NativeList<NetworkTileBurstData>.ParallelWriter writer = Results.AsParallelWriter();
                writer.AddNoResize(new NetworkTileBurstData());
            }

Still getting old issue also i used parallelwrite for it , i cant find what i am missing :/

InvalidOperationException: SolveCombinationJob.Results is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.
#

Also do can give a advices for nested lists for example if i want to NativeList<NativeList<NetworkTileBurstData>> its not possiable therefor what should i use for it UnsafeList ?

late lion
#
[WriteOnly] public NativeList<NetworkTileBurstData>.ParallelWriter Results;
late lion
errant flame
#

NativeParallelMultiHashMap i will searched and these can help me i guess

#

the order not important for me

errant flame
soft shard
# obsidian mulch Quick question. Say I have to NPCs with CircleCollider2D and Rigidbody2D, and th...

Colliders dont usually detect rigidbodies, they detect other colliders (which in some cases, might also have a rigidbody attached), although you shouldnt need to double your radius for this detection to happen, a collision is detected on the frame that any "pixel" of the either collider overlap eachother, and OnCollisionEnter2D or OnTriggerEnter2D will be fired in the same frame - so from what you described, your collision should detect the circle collider on your other NPC, and as Mao mentioned there could be exceptions to this, such as your NPCs (or more specifically, the object with the collider) being on different layers

fallow quartz
#

How can I make a circle collider but in 3d? Like with depth

#

for example for a circle table

tired elk
#

You mean a cylinder ?

heady iris
#

There is no primitive cylinder collider, but you can use a convex mesh collider

fallow quartz
heady iris
#

yes, because the cylinder object uses a capsule collider

tired elk
heady iris
#

If you remove its capsule collider component and add a mesh collider component, you'll get the right shape

#

you should also tick the "Convex" box

#

since this is, indeed, a convex shape -- it has no holes or valleys

fallow quartz
heady iris
#

Show the inspector for this object.

fallow quartz
steady bobcat
#

where mesh 😐

hexed pecan
#

No mesh assigned

steady bobcat
#

we all expected it πŸ˜†

heady iris
#

ah, I thought you were using a Cylinder object here

hexed pecan
#

Meshn't

heady iris
#

which would have a mesh filter component that holds the cylinder mesh

fallow quartz
#

its a particle system, it doesnt have any mesh and anyway even if i apply a mesh it doesnt appear the green lines

heady iris
#

that would've automatically filled in the mesh collider

#

The easiest thing to do, to be honest, would be to just slap a cylinder object on as a child

hexed pecan
heady iris
#

That'll give you something you can see

heady iris
lost rivet
#

do dictionaries not appear in the inspector?

heady iris
#

It'll grab the mesh from the MeshFilter component automatically

heady iris
#

I often just serialize key-value pairs and then fill in the dictionary at runtime

hexed pecan
lost rivet
#

like an array of key value pairs?

fallow quartz
hexed pecan
tired elk
#

You can also customize the serialization to make your dictionnary serialized as 2 list (keys and values) and make your custom inspector to render it

hexed pecan
#

KeyValuePair can't be serialized so if you go with a single list/array you need to use a serializable type to hold the key and value

steady bobcat
lost rivet
#

tuples cant either?

#

i guess ill make a struct

steady bobcat
heady iris
#

"Convex" causes it to operate differently.

#

Normally, a mesh collider can represent any mesh shape. It's kind of like a thin shell.

#

When you turn on "Convex", it bakes a collider that is solid -- it's kind of like stretching plastic wrap over the mesh

fallow quartz
heady iris
#

This gives you better behavior. The collider actually knows what's inside and outside.

heady iris
#

(actually, even if it didn't, the convex baking process would still wind up giving you a top and bottom)

fallow quartz
heady iris
#

The most flexible option would be to generate a mesh with the exact size you want and manually bake it. But that sounds a little excessive

heady iris
#

and the Mesh Filter only really needs to be there for the Mesh Renderer to use.

#

The Mesh Collider does grab a mesh from the Mesh Filter when it's added, but it doesn't rely on the Mesh Filter being there

fallow quartz
tired elk
#

!collab

tawny elkBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
β€’ Collaboration & Jobs

barren elbow
#

Hey what's up y'all

#

I have this

#

And I get a stack overflow, as I assumed

#

I'm trying to fix it but don't really see a logical thing to do here.

tired elk
# barren elbow

Well, you should try using a private field instead of doing LockMouse = value. You have quite a big circle here

#

To put it simply, you have a method that calls itself

hoary root
#

someone warned me when i said hi

barren elbow
#

I figured it was recursive but what exactly do you mean by using a private field? In what way?

sleek bough
#

@hoary root You did read the warning message right?

hoary root
#

now i see but i got kicked joined back and then got warned

#

i didnt say anything after i got kicked

tired elk
#

this is obviously optional, but i wanted to make the difference between the field and the property more visible

barren elbow
#

I see, but how does that change anything? I don't really understand why it should.

sleek bough
tired elk
barren elbow
#

Oh

#

Okay

#

Thanks man

barren elbow
#

Oh nevermind

#

I understand it

indigo orchid
#

the movement now works but now the animation freezes even when the z key is released and it stays in the run blend tree without switching to the walk one and the freezing animations are now also staying for longer like one state is being repeated for 3 keys or so script - https://paste.ofcode.org/Ftdf37bDpS8fGPqRz2VNDZ pls help fix it

hexed pecan
#

I pointed this out to you before

wheat spruce
#

Is it generally a good idea to set timescale to 0, to allow for pausing?

Time.timeScale = CurrentPlayMode == PlayMode.Play ? 1f : 0f;```
indigo orchid
hexed pecan
indigo orchid
wheat spruce
#

I know timescale generally only helps to stop the games time from increasing, so any actual logic in my various C# files will continue to run even when the game is in this fake paused mode

indigo orchid
leaden ice
#

you will need to separately handle any logic that doesn't depend on game time that also needs to be paused

wheat spruce
wheat spruce
#

great minds think alike πŸ˜€

indigo orchid
hexed pecan
#

Yes that's AnimationState.time in C# (or normalizedTime idk)

#

The second link is for the script documentation

indigo orchid
#

ok let me check and see how they should be used

#

thx btw

indigo orchid
prime crane
#

Hello, i would like have a float value but no with the "E" something to readable for human ex : "0.0789" not that : "-8,109922E-12"

modern creek