#archived-code-general

1 messages · Page 39 of 1

somber nacelle
#

nowhere in the code you just showed do you attempt to change the value of the Restrict bool

devout solstice
#

I clicked on it in the inspector

#

Didnt do much

somber nacelle
#

show me where you changed it and share the entire class again

devout solstice
#

uh idk if you want to see this script

#

its my main inventory script

somber nacelle
#

also by doing this you're fucking yourself over in ways you clearly don't see

devout solstice
#

oh

somber nacelle
#

maybe some day you'll actually listen

devout solstice
#

But Im not using it for the main part of it

somber nacelle
#

then what is the point of it

devout solstice
devout solstice
#

Just for getting if restrict is on and getting what the variables are set to

somber nacelle
#

no wonder it doesn't work

devout solstice
#

Turns out im not actually using it

swift falcon
#

Does anyone know why this rarely gives a really small magnitude direction?

_minibossPos = Random.onUnitSphere.normalized * 40;```
It should give me a 2D direction of magnitude 40 right? 
Sometimes I get values like (-1.8, 7.2) so clearly I'm doing something wrong

Is there a better way to get a random direction?
#

thanks that fixed it. What would be a better solution?

I started out with a Worldline type that holds different types (human, work, organisation) but since the language is slightly different (ie dob, dateFounded, etc) I'm finding I'm writing lots more code to process similar but not identical things. Guessing this is a well known problem and perhaps there's a much better way since i don't know what I don't know...

somber nacelle
devout solstice
#

Shield your eyes

somber nacelle
#

lmao you're just constantly clearing the list any time you make a change in the inspector

#

that was supposed to go inside the if statements. you also didn't bother changing the first if statement's condition like i'd suggested

devout solstice
#

What was it you suggested

somber nacelle
#

if (ItemType.Count != Menu.ButtonList.Count) this but for the first if statement too

devout solstice
#

This one?

somber nacelle
#

yes

#

because, again. what happens if the list is larger than the count you are checking against?

stable rivet
devout solstice
#

oh I can change the restrict bool now, I got rid of the new thing up top

somber nacelle
stable rivet
# swift falcon thanks that fixed it. What would be a better solution? I started out with a Wo...

You can improve what you have in several ways - but for starters, you have 3 isX properties on whatever "w" is. Why can't this be a state? something like w.Type, which returns an enum value of Human, Work, or Organisation.

Now, you could do something like this to handle errors properly

switch (w.Type)
case Human:
  // do stuff
case Work:
  // do stuff
case Organisation:
  // do stuff
default:
  throw new Exception("Unexpected type")
#

I'd even go a level deeper and say this should be a separate method that returns the string you're expecting. are you familiar with SOLID?

swift falcon
#

Ok great thanks will look into how to setup the w class with .Type
Guessing would do that for databinding then inject into a separate but common method

stable rivet
swift falcon
tardy basin
#

How can I know which object / prefab does this refer to?

stable rivet
#

in future, better naming of your GOs would help

sweet perch
#

im using urp and light 2d, everything works fine in the editor but when i build and run it, the lights dont work. are there any build settings i have to change?

tiny delta
#

In case anyone is interested, I made a fully modular menu navigation system for my game. Feel free to give any feedback or suggestions, I'm still working to improve it! At the very minimum I certainly want to add more and improve my comments. https://hatebin.com/vrvueorbmt

#

I also plan on removing some of the logs once I finish working on the script

whole portal
#

I am trying to clamp the movement of the eye bones via a surface volume box, I am setting up the box and the eyes behave unexpectedly

#

I can show the code as well if anyone wants to take a look

sudden plover
#

Hi guys, I want to make an Android game where basically every time the user touches the screen he hits a little monkey/doll. How can I do to program this, that is, where do I start?

zinc parrot
#

Hey is there a way to get direct lighting of the scene in a format that I can then read and determin the place in the world?

zinc parrot
#

nvm sorry figured out I can do linecasts between the voxels and the lights to get direct lighting visability

tawny elkBOT
#

🧑‍🏫 Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/

potent glade
#

sorry was away... yes I am

vague tundra
#

Whats the name of the website that allows you to paste code and share via temp link?

tawny elkBOT
#
Posting code

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

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

vague tundra
#

Legend thanks!

frigid wren
#

hi guys, do you recall if there is an callback for opening editor window? I would like to do something after timeline window is being opened

unreal notch
#

Hey, I have this code for making serializeable dictionaries, and I'm trying to use one in a ScriptableObject, but I am having this issue:

I can't set the length of the lists in the inspector, because it errors on validation because the list lengths are not the same... and I dont know how I can change the code to set them at the same time, or even just hard code in a set length for DictionaryOfIntAndSprite

https://pastebin.com/bMzyxxyN

dusk apex
fossil blaze
#

Is it true that this code is responsible for building verification? That's what chatgpt told me

#

I need to make a visual radius of where I can and cannot build

unreal notch
dusk apex
#

With the above, you'd get a a key-value pair if and only if a key and value both exists. Else consider filling with some default value if i is >= the length of values.

dusk apex
#

With minor edit to the delimiter of the loop

unreal notch
#

sorry, honestly, this serializeable dictionary script is a bit of a black box... I wrote it after days of googling around on how to do a serializable diction and just barely got it working

fossil blaze
dusk apex
fossil blaze
#

Why such a mistake?

slow crag
#

How can I rotate my camera around a certain point in the world?
I want it to look like the camera is orbiting that point - kind of how you can rotate the camera in Don't Starve

dusk apex
#

Special note: the compiler likely isn't wrong

fossil blaze
#

How not?

dusk apex
fossil blaze
#

How do I make it work? I need to make a visual radius for building

dusk apex
fossil blaze
#

help guys please

slow crag
main shuttle
dusk apex
slow crag
unreal notch
slow crag
crude mortar
slow crag
#

It's just an example point in the world if I understand correctly

#

I thought it would look at Vector3.zero, and rotate around that point, while keeping its distance from it

mellow sigil
#

Well your camera seems to be at 0, 0

#

if you want to rotate around the table then you have to use the coordinates of the table

slow crag
#

maybe Vector3.zero are some sort of local coordinates and not world coordinates?

paper heart
#

I am trying to access different C# script that i made, but it doesnt want to find it in GetComponent<>(). with other scripts it works...

mellow sigil
#

I'm guessing you have some other code that sets the camera position

somber nacelle
paper heart
#

the name is exactly same
and what do you mean exactly by the namespace?

somber nacelle
#

looks like that file isn't actually in your project

paper heart
#

it is in my project, and its even added to some emptyobjects already

somber nacelle
#

i mean the file you currently have open. notice how it says "Miscellaneous Files" there rather than "Assembly-CSharp" close that file then double click the one inside your project to open it then make sure that you've spelled the name correctly

slow crag
coral kettle
#

I'm trying to instantiate a world space TMP text gameobject to have pop up damage above enemies in 3D world space. I setup the prefab under the parent, save the prefab

when I instantiate the prefab instantiates off the parent, then is set as a child to that parent, but it's huge and not setup how I did making the prefab. anyone know what I should do for this?

grand hemlock
#

guys how can i make a snake script where the tail follows the head?

#

ive done research but its all about the classic snake game

#

i am trying to make one where it moves freely

#

instead of only moving in 4 direactions

#

i tried storing them all in a list and then lerping the positions, it somewhat works but not the result i want

mental rover
grand hemlock
mental rover
#

maybe have a think about what you really want it to look like, and try to write down exactly what properties it should have

#

it sounds like you have something that sort of works but isn't quite what you want, you can tell it's not right, and might recognise when it is, but that's not too helpful in making progress in building it

thin aurora
finite plinth
#

How can I calculate the final position of moving a child to a point and then also moving the parent with relative offset?

#

I've tried doing position = target.position - parentvariable.position

#

but it doesnt seem to be 100% accurate

prime sinew
finite plinth
#

Basically I want to automate a gun's ADS positioning by moving the iron sights to the centre of the screen and having the parent move with it

prime sinew
#

how about lerping?

finite plinth
#

i can already set the position manually

#

and it works

#

but i want to try automating it

#

just need to find the correct position

prime sinew
#

it sounds like the parent should be the child

#

i'm afraid I dont know. sorry

finite plinth
#

thats alright, thanks

finite plinth
#

but surely theres a way to calculate it all into a neat vector3 variable lol

night relic
#

Why don't you calculate the parent movement and the child be be just moved?

#

Other than this sure you can do:

  1. store child global position before movement
  2. move the child
  3. calculate global position delta (new - old)
  4. move parent with the delta
  5. set child local position to the initial local position in parent
    However, sounds pretty bulky solution
finite plinth
#

hmm

night relic
#

If the local position in parent variates, you can introduce step 0 where you store that too

finite plinth
#

thank you, ill look into what you said

#

aswell as some further testing

#

if i were to make the the parent the child

#

would the new parent then have to be the location of the sights?

night relic
#

sights? what do you mean?

grizzled venture
#

I use Pascal case for public fields and methods. Camel case for private fields and variables.

night relic
#

I have to admit I am using the Java camel case notation, so starting with lower case. however in C# I think starting with upper case is rather the standard.

finite plinth
#

i was overcomplicating it alot before

night relic
#

well, congrats 🙂

finite plinth
#

thanks for the help

night relic
#

most welcome

#

Actually I have a question as well

finite plinth
#

sure

night relic
#

I have just upgraded Unity from 2021.3.1f1 to 2022.2.6f1 and I face a very weird behavior: adding force seems not to work any more somehow? The code below is super simple and worked flawlessly with the old version.

#

The print statement is executed, force is added (vector is not zero) and still the velocity always stays at 0 (as printed in next update run).

#

I already tried with adding relative or not relative force, as well as changing the force types to impact, velocity, etc - always zero velovity on next update.

#

void Update() {
if (accelerate && (rb != null) && (rb.velocity.magnitude < maxSpeed)) {
print("a++: " + rb.velocity.magnitude + ", force: " + (Vector3.back * maxSpeed * Time.deltaTime)); // TODO: rem
rb.AddRelativeForce(Vector3.back * maxSpeed * Time.deltaTime, ForceMode.Impulse);
}
}

#

rb comes for rigidBody

#

Any ideas?

finite plinth
#

hm

#

quick check if you accidently set the rigidbody to have no gravity or iskinematic

#

and if it worked in a previous version i'm not sure why it wouldnt be working now

still token
#

I'm having a bit of a brainfart on a solution for this. I have an isometric camera that rotates around a small scene. The walls are planes, so I can see through the backfaces (intentional) but I intend to have objects on the walls that I would like to hide when the walls are occluded. (see screenshot for example). Any ideas?

night relic
#

yeah, same here... i am kinda clueless... is so simple code and stopped working out of the blue...

#

is not kinematic, no gravity and also not frozen

kind pivot
#

hi I have a question. say I have a game object A with a unity event on it and another game object B is subscribed to that event. now if game object A is destroyed do I still need to unsubscribe game object B from A's event? cause I don't think I could get a reference since it's now destroyed

hexed pecan
swift falcon
#

I have a smart string and want to replace it in code, I tried:
string wrTime = "test"; LocalizationSettings.StringDatabase.GetLocalizedString("Game", "SHOWING-WR", new string[] { wrTime }
and
string wrTime = "test"; LocalizationSettings.StringDatabase.GetLocalizedString("Game", "SHOWING-WR").FormatSmart(new { wrTime })
but both dont work

#

so I set it to "Maintain Tokens" and LocalizationSettings.StringDatabase.GetLocalizedString("Game", "SHOWING-WR").FormatSmart(new { wrTime }) now works. I dont know if its bad to do it like that but it works

tawny elkBOT
#
Posting code

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

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

thin aurora
#

Suggest you debug the values in the if statement and/or check if the if statement is entered at all

night relic
#

As I wrote above - the statement is executed and the print statement shows continuous velocity of 0, while the force variates a bir as it is depending on Time.deltaTime

grand hemlock
#

guys this error is popping up even tho im not using a custom editor
type is not a supported pptr value

night relic
#

And was working without any changes before the upgrade to 2022

leaden ice
night relic
leaden ice
#

With the last point I mean you should show the inspector

#

If maxSpeed is too low or zero ot won't work

#

If acceleration is false it won't work

#

Etc

night relic
#

Ah, got it. No, the syatements are all executed - the print is inside the check

leaden ice
#

You are also kinda weirdly doing double duty with this maxSpeed variable. It's both the speed limit and the force amount

night relic
#

True. I will have to change this, especially now that deltaTime is not used - it was naturally/steady reducing the added amount

icy sundial
#

can I use a custom index.html for a webgl build?

tacit edge
#

I have a list that is randomized every time there is clicked on the screen, and you fill the content of the list in the inspector for example

Element 0: Everyone do this
Element 1: <name> do this

But I want it when every time the <Name> element is mentioned in the sentence it will get a different color.
Anyone know how to make it

night relic
#

now constant after Time.deltaTime is gone

leaden ice
night relic
#

It's a space simulator - nothing there... no floor, no walls... no objects around...

#

I am getting crazy...

leaden ice
#

Show the scene

#

Show the inspector

#

Etc

night relic
#

one sec

ebon pagoda
#

I am not sure if this question should be posted here or in an other channel; I am trying to work with the Test framework, but in my unit test I can not access anything form the Assembly-Csharp project and I cant force the buildpath to build the UnitTest project last. Does anyone have an idea how I can fix this?

zenith atlas
#

Did you create assembly reference for your scripts ?

leaden ice
ebon pagoda
#

Where can I do that?

leaden ice
#

You need to make an asmdef for your main game code

zenith atlas
#

Just watch one tutorial about unit testing and that's all

leaden ice
#

And reference it from the test assembly

ebon pagoda
zenith atlas
night relic
# leaden ice Show the inspector

The yellow fire things are the "bullets", which are not moving any more. On the right is the prefab config. The actual code making the movement is in PlanetDesctructionBullet, which I (most of it) pasted above - the one with the FixedUpdate

languid hound
#

Why is it saying these don't exist?

#

I did have to launch my project in safe mode after upgrading it to a later Unity version so that could be why. I'll try load it normally

leaden ice
night relic
#

Sorry for this :/ One sec, have to do slight code change, so that the bullets do not disappear and i can make the screenshot

night relic
crude ridge
#

Does anyone know why I am getting this error? I did not change anything and all scenes are in the build settings?

weak nacelle
#

What is the best way of copying all property fields in a constructor when there are a significant amount of fields?
I'm finding propertyname = x.propertyname is getting hard to maintain.
The class is not fully serializable as I tried serializing and deserializing with Json which did not work

night relic
thin aurora
#

Then you can specify the fields/properties to implement

#

If it generates in a practice you don't like, you can specify the way Visual Studio auto generates public/internal/private fields/properties in the options

thin aurora
kind pivot
thin aurora
kind pivot
#

in my example, object A with the event will eventually be destroyed at some point. but object B, my object won't be destroyed. but I'm wondering if even after object A is destroyed if the link will still exist in memory

thin aurora
#

You can always do the same in the parent, but then set the event reference to null

#

Because this could be a reference that causes garbage collection to not work, and setting it to null removes that reference

#

Probably best to look up how that works

kind pivot
#

problem is I can't access the event if the gameobject is null

icy sundial
#

im trying to reload current scene using
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
but the scenes go into a loading/unloading loop

main shuttle
hexed geode
#

why does it return negative values?

thin aurora
tawny elkBOT
#
Posting code

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

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

buoyant crane
hexed geode
#

cos of angles between 0 and 90 should only return positive values, no?

hexed geode
# thin aurora !code
float randomAngle = Random.Range(0f, maxOffset / 2);    
                    if (Random.Range(0f, 1f) > .5f)
                    {
                        offsetVector.y = Mathf.Sin(randomAngle);
                    }
                    else offsetVector.y = -Mathf.Sin(randomAngle);
                    offsetVector.x = 1 - Mathf.Cos(randomAngle);
                    Debug.Log("cos: " + Mathf.Cos(randomAngle) + " angle: " + randomAngle);```
#

why does the cos return negative values

hexed geode
#

this is in radians

#

Mathf.Cos uses degrees no?

#

and pi/2 in degrees is 90

#

so it should only return these values

main shuttle
#

Well I'm not 100% sure, but it looks like its doing what I posted in the graph.

hexed geode
#

it works with angles

hexed pecan
buoyant crane
main shuttle
hexed geode
hexed pecan
hexed geode
hexed pecan
#

The input angle, in radians

hexed geode
hexed geode
#

i'm dumb ok

#

didn't see that mb

hexed pecan
hexed geode
#

alr ty

hexed geode
hexed pecan
#

Btw Mathf.RadToDeg and Mathf.DegToRad exist for convenience

hexed geode
#

ye i'll use that

#

ok yeah works good now

kind pivot
hexed pecan
kind pivot
#

they do mention that there shouldn't be any risk of memory leaks so I'll take that as the garbage collection cleaning up the loose ends

thin aurora
#

Well events are weird so idk if Unity is smart enough to realise the event is no longer valid

#

Not sure if the build in Event types fix that

#

General rule is to always somehow unsubscribe if you're certain you are losing the reference due to destroying it or whatever

kind pivot
#

looking at it, it is actually an Action I'm subscribing to. so it should be handled by C# itself

thin aurora
#

You don't subscribe to delegates, you assign

#

So if you mean you assign to it, then yes, it's garbage collected

kind pivot
#

so you're saying someAction += MyMethod is assigning?

#

@thin aurora

stuck forum
#

If i want to use scriptable objects to keep data between scenes, can i use new/instantiate or do i need to have a "physical" asset of the scriptable object that I reset everytime i need to reset it? Honestly I have never used new/instantiate with SO so idk how it works

Edit: i think using actual assets might be better idk

night relic
#

Any idea about the adding force problem above?

west lotus
hexed pecan
#

Or reply to your question or something

stuck forum
night relic
# hexed pecan Ask it again?

I am having a space simulator, so free space without any objects nearby. I am firing "bullets" by AddForce. Everything worked great with Unity 2021.3.1f1, however then I needed to upgrade to 2022.2.6f1. Without any code change the "bullets" do not move any more. Code is executed - I added print statement just before adding the force, however the velocity remains 0.

#

here are the details:

#

First screenshot shows the bullet prefab config, the second the script which should move the bullet

hexed pecan
# night relic

Looks like you are dealing with super large numbers... What if you try with a number that is not half a million (maxSpeed)?

night relic
#

let me try

#

same thing: fixed upd: 0, force: (0.00, 0.00, -1.67)

#

first zero is the velocity

#

this is with max speed 50

hexed pecan
#

Hmm. What íf you rebuild the object from scratch?

#

Like make a new empty object, add each component to it and see if it works

#

@night relic Also put the log after the AddForce, not before

whole portal
#

How can I code this and can Unity do it ?

hexed pecan
#

Convert the bone's position to that object's local space with InverseTransformPoint
Clamp it
Convert it back to world position with TransformPoint
Apply the position back to the bone

night relic
whole portal
# hexed pecan Convert the bone's position to that object's local space with ``InverseTransform...

using UnityEngine;

public class EyeControl : MonoBehaviour
{
    public Transform headBone; // the head bone object
    public Transform leftEyeBone; // the left eye bone object
    public Transform rightEyeBone; // the right eye bone object
    public Transform leftEye; // the left eye object
    public Transform rightEye; // the right eye object
    public Transform target; // the target object for the eyes to look at

    public float eyeOffset = 0.1f; // how much to offset the eyes from the bone position
    public float maxLookDistance = 10.0f; // the maximum distance that the eyes can look at

    void Update()
    {
        // get the head bone position and rotation in world space
        Vector3 headPosition = headBone.position;
        Quaternion headRotation = headBone.rotation;

        // calculate the eye positions based on the target object position
        Vector3 targetPosition = target.position;
        Vector3 leftEyePosition = targetPosition + (headRotation * Vector3.left * eyeOffset);
        Vector3 rightEyePosition = targetPosition + (headRotation * Vector3.right * eyeOffset);

        // Lock the Z position of the eye bones
        leftEyePosition.z = leftEyeBone.position.z;
        rightEyePosition.z = rightEyeBone.position.z;

        // set the positions of the eye bones
        leftEyeBone.position = leftEyePosition;
        rightEyeBone.position = rightEyePosition;
    }
}```
#

@hexed pecan

#

So do I do that here inside my script ? I know how to add the public variables but I don't know how to make the clamp happen according to the targets in those fields which would be the meshes of the eye cages

hexed pecan
#

Doesn't look like youre doing what I explained

whole portal
#

@hexed pecan

#

Of course I am not because i do not know how to which is why I am asking, I am able to take it here so that I can add the meshes

#

But then I do not know how to tell unity to use those fields to clamp the movement for each bone

whole portal
#

How to tell unity to use those fields to clamp the movement for each bone (according to the screenshot I just showed you)

hexed pecan
#

Be more specific

whole portal
hexed pecan
#
Vector3 boneLocalPosInCage = cage.InverseTransformPoint(bone.position);
boneLocalPosInCage.x = Mathf.Clamp(boneLocalPosInCage.x, -1, 2);```
etc.
#

And you would apply it back with bone.position = cage.TransformPoint(boneLocalPosInCage);

whole portal
#

@hexed pecan

hexed pecan
#

Actually if you want to limit the iris to that outlined area, I would just do it with a shader

#

Have the iris on a texture and just change its texture offset

#

So you would have a mesh for each eye like the cage currently is (outlined) and just move a texture on it

whole portal
hexed pecan
#

Yes you could get the eye bone's position and send that to the material/shader

strange pine
#

hi, I've got this code to pick a random tile in my tilemap and return it's name, but it's just saying the object is null. It worked for about two test runs and then refuses to work now, nothing changed in between.

new to tile maps so I can imagine I'm doing something wrong but extensive googling hasn't helped 😛

https://pastebin.com/DuLievWa

whole portal
hexed pecan
whole portal
#

also sorry for the popping in that video

hexed pecan
#

Can try with standard shader first

#

Maybe with alpha clipping enabled, unless you add a white background to the eye

whole portal
strange pine
weak nacelle
shy gorge
#

For anyone who has this same issue: You must either use yield on the manager.Initialize function since it returns an IEnumerator, or invoke it using StartCoroutine if you're not calling it from inside another method that returns an IEnumerator.

whole portal
#

@hexed pecan I just realised that complicates the customization part of my character creation process as now I'd need to swap textures around each time the user changes something to the eyes

#

I'd prefer using my texture atlas and no other texture

hexed pecan
whole portal
#

Because I am using a single texture atlas for all the custom choices when it comes to how the clothing and the eyes colour looks like, having the iris as a separate texture would complicate the system too much

#

This is the reason why I had the eyes as actual meshes instead of textures

#

So that I can still use the same texture atlas to swap the eyes colour around

hexed pecan
#

Idk then. Look at tutorials on "cartoon eyes" im sure youll find something that works for you.

whole portal
#

I tried, nobody does what I am doing

hexed pecan
#

Apart from the first solution that I said but apparently that doesn't fit your needs

whole portal
#

I'll try the first solution

sonic stream
icy sundial
#

i added option for players to move the 3D camera to the sides. However I want to limit it, but since the camera is rotated, I dont know how to calculate limits since its moving on multiple axis. Any math genius?

#

aka only want the camera to be able to move in perpendicular direction to where it's facing

woven kayak
#

Can anyone tell me why

using UnityEngine;
using UnityEngine.Events;

public class OnLayerDoX : MonoBehaviour
{
    public LayerMask layerMask;
    public UnityEvent layerEnterCollision;
    public UnityEvent layerExitCollision;

    void OnTriggerEnter(Collider other)
    {
        if ((layerMask.value & (1 << other.transform.gameObject.layer)) > 0)
        {
            Debug.Log("Hit with Layermask");
            layerEnterCollision.Invoke();
        }
    }

    void OnTriggerExit(Collider other)
    {
        if ((layerMask.value & (1 << other.transform.gameObject.layer)) > 0)
        {
            Debug.Log("Left contact with Layermask");
            layerExitCollision.Invoke();
        }
    }
}

Wouldn't even show the debug log.
The objects have layers and colliders, the object hitting the specified layer has a rigidbody and trigger collider but nothing happens?

thin aurora
woven kayak
thin aurora
#

Check if these are the case

woven kayak
#

Wouldn't that be the point of Debug.Log("Hit with Layermask");

#
void OnTriggerEnter(Collider other)
    {
        Debug.Log("OnTrigger Valid");
        if ((layerMask.value & (1 << other.transform.gameObject.layer)) > 0)
        {
            Debug.Log("how would I check layerMask.value?");
            layerEnterCollision.Invoke();
        }
    }
#

Neither of those logs show but the object is clearly resting on the desired layer?

devout solstice
#

Also what is the most useful thing (in unity c# of course) functions, statements, etc

mellow sigil
whole portal
#

@hexed pecan I'm almost there, but there seems to be an issue with the Z position when the eyes move to the right, did I clamped the positions wrong ?


using UnityEngine;
using UnityEngine.XR;

public class EyeControl : MonoBehaviour
{
    public Transform headBone; // the head bone object
    public Transform leftEyeBone; // the left eye bone object
    public Transform rightEyeBone; // the right eye bone object
    public Transform leftEye; // the left eye object
    public Transform rightEye; // the right eye object
    public Transform target; // the target object for the eyes to look at

    public float eyeOffset = 0.1f; // how much to offset the eyes from the bone position
    public float maxLookDistance = 10.0f; // the maximum distance that the eyes can look at

    void Update()
    {
        // get the head bone position and rotation in world space
        Vector3 headPosition = headBone.position;
        Quaternion headRotation = headBone.rotation;

        // calculate the eye positions based on the target object position
        Vector3 targetPosition = target.position;
        Vector3 leftEyePosition = targetPosition + (headRotation * Vector3.left * eyeOffset);
        Vector3 rightEyePosition = targetPosition + (headRotation * Vector3.right * eyeOffset);

        // Lock the Z position of the eye bones
        leftEyePosition.z = leftEyeBone.position.z;
        rightEyePosition.z = rightEyeBone.position.z;

        // set the positions of the eye bones
        var x = Mathf.Clamp(leftEyePosition.x, -0.0072f, -0.0544f);
        var y = Mathf.Clamp(leftEyePosition.y, 0.0683f, 0.0786f);
        var z = Mathf.Clamp(leftEyePosition.z, 0.0955f, 0.0711f);

        leftEyeBone.localPosition = new Vector3(x, y, z);

        rightEyeBone.localPosition = rightEyePosition;
    }
}```
#

The clamping is correct for other positions

woven kayak
#

When I press play the torque wrench is set to grabbable layer.

leaden ice
#

(to see if the layer is contained in the mask, assuming that's what you want)

woven kayak
#

Hmm. That doesn't seem to work either. I think its right but I must have something else messed up in my scene?

thin aurora
woven kayak
woven kayak
mellow sigil
# woven kayak

A couple of things that might cause it:

  • the wrench has a Rect Transform, is it a UI element? That won't collide with "normal" objects
  • the sphere collider radius is tiny
#

the layer has nothing to do with it if the event doesn't trigger

whole portal
#

(in local space)

#

The eye does not go outside the face for the minimal clamping values (even if I change those values it seems to stay in local space) but for the other values it goes beserk, it seems to get out of the local space into global space and I don't understand why that happens.

#

(the values inside the rectangle are the minimal clamping values)

tiny delta
#

https://hatebin.com/aubjunnaqq
Hey there! I'm probably just going mad, but for some reason I can't get buttons to work with my controls script. I have a script which is basically empty with some variables and functions. However, when I set my "Controls Logic" up in my button, no functions show up. Is there something I have to change with the the code or unity to make it see these functions?

mellow sigil
#

The functions can have at most 1 parameter for them to show up there.

leaden ice
tiny delta
#

That would explain it, thank you

#

I suppose I would need to make a separate set control function for each button then, no?

#

Never mind, I think I have an idea

tiny delta
#

I'll just add a SerializeField in my Controls Logic gameobject for each text object on buttons

wet knoll
#

hi, i just wanted to ask what the best way to do asynchronous file operations is. can i use the System.IO namespace, using FileStream objects in IJob implementations?

#

i'm having an open world system where the player needs to save and load world data from files as they walk around

#

please @wet knoll if you have an answer for me

icy sundial
#

how can I restrict movement of an object to a plane?

leaden ice
#

if it's the latter, simply don't move it except on the two axes of the plane

icy sundial
#

its a Camera, i want to move it perpendicular to where its facing

#

but since its rotated, i cant just use X/Z axis that easily

leaden ice
#

you can use the world x/z

icy sundial
#

yeah but Im a math idiot haha

leaden ice
#

well that's a different story 😉

#

maybe show the code you have right now?

icy sundial
#
// Camera movement with mouse
Vector3 diff = (cam.ScreenToWorldPoint(Input.mousePosition)) - cam.transform.position;

if (Input.GetMouseButton(0))
{
    if (drag == false)
    {
        drag = true;
        dragOrigin = cam.ScreenToWorldPoint(Input.mousePosition);
    }
}
else
{
    drag = false;
}

if (drag)
{
    transform.position = dragOrigin - diff;
}```
#

that works just fine but if I want to limit the movements, im not sure how to calculate it

#

(that code is inside LateUpdate)

wet knoll
#

you can do var displacement = gameObject.transform.rotation * Vector3.forward * distanceToMoveItPerSecond * Time.deltaTime;

leaden ice
#

is this using an orthographic camera?

icy sundial
#

yes

hexed pecan
woven kayak
steep herald
#

Say a component is enabled by another component at runtime. Will update in the former be called the same frame it was enabled in 100% of the cases, or does it follow some internal script execution order and if the latter component runs after the former, then it'll wait until next frame to call update?

leaden ice
thick socket
#

😄 thats what I was gunna say.

leaden ice
#

if you enable it in Update I think it's guaranteed not to update this frame

#

if you enable it in FixedUpdate then it might?

#

I'm not 100% sure

steep herald
#

Okay, doubt is good enough of an answer for me either way

leaden ice
#

but even then it might just always wait till next frame. Worth experimenting with Time.frameCount if you want to be sure

thick socket
#

easy way to do it would just check if the component is active, if not wait a frame and try again

#

probably not best solution...but certainly the easiest

devout solstice
dull stratus
#

Hello fellows creators, I have a simple question: I want to have access to my UI scripts and methods, should I use singletons on menu scripts or make a script that contains all my menu scripts?

devout solstice
#

depends how many instances you’re going to have of said script, i think

woven kayak
devout solstice
#

there’s something bad about using singletons, if that means static, i think i saw someone use singleton in place of static

mellow sigil
#

"the event" = OnTriggerEnter

dull stratus
#

That's why I'm wondering

devout solstice
#

it’s either multiple things named the same or multiple instances

thick socket
dull stratus
#

I don't have a lot of menus yet, but if the UI progress I will add menus with each having a script

devout solstice
#

yea

devout solstice
thick socket
#

I have everything thats a singleton in some sort of fancy script thing that creates Don'tdestroyonload when the game starts reguardless of scene or anything 🙂

#

no chance of doubles or anything

dull stratus
#

Maybe it's better to make a scripts containing all my menus in a scene, it's only one singleton and this one knows all the UI elements

devout solstice
#

is there a way to save a what a variable is set to, for variables changed in the inspector, even after closing unity?

dull stratus
#

Yes, you have to use the PlayerPrefs

devout solstice
#

oh god not that

dull stratus
#

I did it for my options : PlayerPrefs.GetInt("FPS") and PlayerPrefs.SetInt("FPS")

#

Well not that much solutions, maybe you can create your own saving system with a json

devout solstice
#

i haven’t dealt with actually creating files through a script yet to save things

#

or in general

woven kayak
karmic bloom
devout solstice
#

I think I understand how it work

sonic stream
woven kayak
dull stratus
#

@devout solstice It's pretty easy used this way, and it works but you need to "load" where the game starts

devout solstice
#

wdym load

#

like use it where the game starts?

sonic stream
woven kayak
devout solstice
sonic stream
devout solstice
#

why

#

can you even read any of that

ripe vale
#

@leaden ice Another question if you dont mind, according to the unity docs the point1 and point2 of capsule cast are the center of the sphere. This means that if i place point1 at transform.position of the player(this being the ground) the capsule will be slightly under the ground because transform.position will be the center not the bottom

#

how do I make sure the capsulecast bottom starts at exactly the same position as the player that sending it (meaning it will just be around the player and not slightly underground because of the above

woven kayak
# devout solstice why

Its to help him know if its in play mode and not try to make updates before stopping play mode.

ripe vale
#

do I just add an offset to it? is there a proper way to know this offset or just trial and error

slow crag
#

How can I use RotateAround, but lerp it? I want my camera to rotate by 90 degrees each time a key is pressed, but smoothly ease in and out instead of doing it instantly.

devout solstice
#

set the thing you’re trying to move to a variable then put that variable into rotate around and set the rotate around to a variable, then lerp that variable and set the objects position to that variable

#

maybe

#

idk i think that would work

whole portal
# hexed pecan You are mixing world positions and local positions here... Why not do it like i ...

Thank you, I did try and it works a bit better now (the eyes are starting to move smoothly now but it still clips.

using UnityEngine;

public class EyeControl : MonoBehaviour
{
    public Transform headBone;
    public Transform leftEyeBone;
    public Transform rightEyeBone;
    public Transform leftEye;
    public Transform rightEye;
    public Transform target;
    public float eyeOffset = 0.1f;
    public float maxLookDistance = 10.0f; // the maximum distance that the eyes can look at

    void Update()
    {
        // get the head bone position and rotation in world space
        Vector3 headPosition = headBone.position;
        Quaternion headRotation = headBone.rotation;

        // calculate the eye positions based on the target object position
        Vector3 targetPosition = target.position;
        Vector3 leftEyePosition = targetPosition + (headRotation * Vector3.left * eyeOffset);
        Vector3 rightEyePosition = targetPosition + (headRotation * Vector3.right * eyeOffset);

        // Lock the Z position of the eye bones
        leftEyePosition.z = leftEyeBone.position.z;
        rightEyePosition.z = rightEyeBone.position.z;

        // convert world space eye positions to local positions
        Vector3 leftEyeLocalPosition = leftEyeBone.InverseTransformPoint(leftEyePosition);
        Vector3 rightEyeLocalPosition = rightEyeBone.InverseTransformPoint(rightEyePosition);

        // set the local positions of the eye bones
        leftEyeBone.localPosition = leftEyeLocalPosition;
        rightEyeBone.localPosition = rightEyeLocalPosition;

        // clamp the position of the left eye bone
        Vector3 clampedPosition = leftEyeBone.localPosition;
        clampedPosition.x = Mathf.Clamp(clampedPosition.x, -0.0102f, -0.0539f);
        clampedPosition.y = Mathf.Clamp(clampedPosition.y, 0.0567f, 0.073f);
        clampedPosition.z = Mathf.Clamp(clampedPosition.z, 0.0946f, 0.0716f);
        leftEyeBone.localPosition = clampedPosition;
    }
}```
sonic stream
devout solstice
#

does the value need to be negative?

#

does the max number need to be positive

#

positive

sonic stream
devout solstice
#

oh

hexed pecan
devout solstice
#

if that doesn’t work try making it so the max number is -16 instead

whole portal
woven kayak
#

The error message indicates that the index "{0}" is out of range of the sequence "{1}". This can happen if the code is trying to access an element of a list or an array using an index that is larger than the length of the sequence. the index might be out of range in the line print(names[2]) if the names list has less than three elements (i.e., if it has an index from 0 to 2). The error at line 97 could just be stopping at that line but seeing an index in any of the int2 before it.

hexed pecan
#

So basically rotate the mesh in a 3D software so that the object's forward axis is aligned to the surface

#

Looks like its currently tilted

sonic stream
woven kayak
#

Likely failing as early as return new int2(x,y);

#

What tutorial?

tepid river
#

hello,
i have a prefab which i want to instantiate multiple times (asteroids)
is there a way to dynamically read the size (bounds.extents) of the prefab?
it return Vecto3.zero

woven kayak
sonic stream
# woven kayak What tutorial?

✅ Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=1bO1FdEThnU
Let's implement Pathfinding in Unity DOTS, we're going to write everything in a Data Oriented way (Structs) in order to benefit from massive performance!

Here's the follow up video covering Pathfinding in Unity ECS
https://www.youtube.com/watch?v=ubUPVu...

▶ Play video
kind wolf
#

is the resource folder a bad thing to use?

#

ive seen some stuff online about how you shouldnt really use it too much but its kinda required for my project

hexed pecan
#

Yo I don't have time to watch a 6 minute video

devout solstice
#

why not

hexed pecan
#

Text is always better

whole portal
#

My bad

woven kayak
whole portal
# hexed pecan Text is always better

Long story short: I am not supposed to do anything on the eye meshes because they simply follow their parents (the bones) and the bones were already oriented using the normal of the eye socket in Blender, the bones have the correct orientation otherwise when I'd move them in Unity in their local space they'd clip out but they don't.

tepid river
kind wolf
whole portal
#

@hexed pecan

patent fable
#

how would i go about making a game view in an editor window ? i'm trying to make a custom tileset editor, that includes triggers and spawnpoints for various objects

#

(the triggers would be objects and the tiles would be tiles, im just not sure how to mix both without having to make a separate editor for it)

woven kayak
patent fable
#

i guess it'd be better to have a scene view, since in game view you can't move the camera around

hexed pecan
#

Lets say you have object eye.
Now lets say theres another object socket, which is rotated so that its forward axis faces outwards (where an eye would look).

To clamp eye's position in the space of socket, you first convert its position to socket's space:

var eyePosInSocket = socket.InverseTransformPoint(eye.position);```
Now you can perform clamping, lets clamp it in the X for example -0.01 to 0.01 range:
```cs
eyePosInSocket.x = Mathf.Clamp(eyePosInSocket.x, -0.01f, 0.01f);```
Now convert it back to world space and apply it to eye:
```cs
eye.position = socket.TransformPoint(eyePosInSocket);```
#

@whole portal

leaden solstice
thick socket
#

I use it purely to create Don'tDestroyOnLoad objects once when the game starts

kind wolf
whole portal
leaden solstice
# kind wolf so it *can* have negative effects?

If you are at the scale that you need to worry about how much memory the resources takes, or having to patch you resources with live-ops operations then yes, Resources folder has it’s limitations

hexed pecan
kind wolf
hexed pecan
whole portal
hexed pecan
#

Notice how its forward is actually up

#

And up is back

kind wolf
#

my issue is just with the amount of stuff in the resource folder

leaden solstice
whole portal
#

The eye bone seems to be okay though

kind wolf
#

oh ok

hexed pecan
hexed pecan
#

So is there an eye, a socket, and a bone?

#

3 objects?

whole portal
#

yes

hexed pecan
whole portal
#

but I am not using the sockets at all in my code, I just have them inside Unity

hexed pecan
#

Blue should look forward

hexed pecan
#

It's about the socket and the eye

whole portal
# hexed pecan Blue should look forward

The reason I am not using the socket is because they will not be animated, I'll be using blend shapes for eyes (sockets) opened/closed and I am using the eye bones only for moving the eye mesh.

hexed pecan
#

Whatever you call it, you need an object that represents the plane that your eye is allowed to move on

whole portal
hexed pecan
#

At first

#

I dont really care what you call it

whole portal
#

Oh I see

#

So how do I fix the blue arrow for the bones do I just reset all the transform of the eye bones inside Blender an re-import the model ? I wanted to do that but I was afraid not to lose the local orientation information of the bone in the process.

hexed pecan
#

Yes fix it in a 3D modeler as I said

#

The code you showed also looks nothing like what I suggested

whole portal
#

This is how the eye bone orientation looks now, I performed a reset on all transforms of the rig. @hexed pecan

hexed pecan
#

Again. Blue should be forward.

#

Green should be up.

whole portal
#

Everything but the eye bones works like you said after resetting the transforms on everything. I don't know why the eye bones appear to be facing downwards in Unity.

#

I did check the apply transform box as well but still the same result

neon plank
#

Question, Allocator.TempJob from NativeArray<T>, the documentation says it last 4 frames... so...
Is it 4 frames including the frame which called the constructor of the array or 4 frames after that frame?
And, does the allocation becomes invalid at the start of the last frame, or at the end (start of the 5th)?

whole portal
#

And then if I manually change the rotation in Unity then it meses up the iris mesh @hexed pecan

leaden ice
#

if your character's pivot is touching the ground then the offset would be exactly equal to the capsule radius
If your character's pivot is in the center of the character or something then you'd do the height of the pivot minus the capsule radius

gusty hazel
#

Anyone have any experience or know if its possible to use a development server (ReactJS, NextJS, etc...) with Unity editor for WebGL games?

woven kayak
leaden ice
gusty hazel
#

Blockchain wallet integration for a game

leaden ice
#

If you want to have a server that your game can make HTTP requests to, of course you can

#

it's just a normal web application

gusty hazel
#

Right now I have to build and then deploy onto our server to test

leaden ice
#

and you can communicate with it through HTTP like always

#

(using UnityWebRequest)

gusty hazel
#

I have no experience with that lol. Can I find that in the Unity docs?

woven kayak
#

I tried it but didn't really care for it.

leaden ice
#

I mean there's pretty much infinite things you can use for a web app framework. That as a universe is as big or bigger than game development

gusty hazel
#

I'll read through the unity docs first

leaden ice
#

assuming you're hosting a server at that host/port number, absolutely

potent sleet
#

connect is very broad term

#

make an API for your requests in ur JS server

leaden ice
#

Isn't ReactJS more for making frontend GUIs? Node JS is for servers.

potent sleet
#

indeed React is a clientside frontend

gusty hazel
#

Sorry guys coding isn't my day job. More of a hobby really. So I don't know if I'm describing what I'm trying to do correctly.

potent sleet
#

probably not lol

leaden ice
#

In the context of WebGL you might have to be familiar with web development things like CORS though to get it working properly

potent sleet
#

another possibility instead is ASPNET , you can use Swagger which is really nice to work with

#

keeping everything c#

#

I believe azure gives you a way to host an aspnet server free

gusty hazel
#

We have a webGL slot machine game. Theres a UI (using blockfrost API, Lucid, MeshJS, React, etc...) that allows users to connect to cardano wallets (nami/eternl). They can then deposit our token into the game. Bet, Spin, etc... and then they can withdraw that token from the UI. Right now the only way I can test the wallet UI is to build and deploy the game on a server. I'm just trying to research some info if that's possible to test directly in the Unity editor.

#

I could just upload all the code lol

potent sleet
gusty hazel
#

Ok I don't have any experience with that. i'll just read up on it.

leaden ice
#

have it point to a staging or local dev server

gusty hazel
#

I can run the game in the editor but there's no functionality with the wallet in that enviroment

gusty hazel
#

There isn't a ton of API's or SDK's for the cardano blockchain. Dapps are still very new on the blockchain.

leaden ice
#

but... you just use that as your URL instead of whatever you're using now

#

You can also build the game and just either run it on a local web server or using Chrome's "load from directory" features.

#

and still - repointing your web requests to localhost

gusty hazel
#

I want to be able to connect to these brower wallet api within Unity's editor

leaden ice
#

i mean if there's no browser

#

you won't be able to communicate with browser stuff

#

assuming you're talking about browser extensions etc

#

if it's not browser extensions then it's just a matter of pointing your game's API requests at the appropriate URL

gusty hazel
#

So I can't test it within Unity's editor. I have to build and deploy.

potent sleet
polar marten
# gusty hazel We have a webGL slot machine game. Theres a UI (using blockfrost API, Lucid, Me...

I'm just trying to research some info if that's possible to test directly in the Unity editor.
you cannot test using their web based UIs and integrations. as you know those SDKs inject code into the page that other javascript apps, like your webgl game, can interact with. while you can recreate that context in unity, you cannot recreate the chrome extension environment that those wallets use as an approach to trust.

simple egret
#

You surely can test within the Editor. Just make your webrequest point to the URL and send requests away

gusty hazel
polar marten
#

you can always write a way to gather the user credentials yourself for the purposes of testing, and then try to invoke their transaction apis directly

gusty hazel
#

They don't. There is minimal stuff on Cardano

polar marten
#

they would need to explicitly support that on their backend, or give you a token as part of their login process. this usually looks like OIDC

gusty hazel
#

Again a lot of this stuff is beyond my scope. We paid someone to create the UI and wallet integration and then he ghosted us.

polar marten
#

if i were you i would stub out this functionality in editor

#

i.e. stub out the jslib invocations you normally would do

#

and write a small mock for the wallet

#

because that way you can easily force error conditions anyway

#

i suspect moralis already does this

#

and may already support cardano

#

i don't know if any of it actually works

#

in this model, you don't need a backend server at all

#

the webgl unity game is a bunch of static assets that runs entirely on the client's computer. it can query balances, for example, directly through the wallet's SDK living on the page / your mock in the editor

#

@gusty hazel does this make sense?

#

however, engineering a p2p blackjack game that is cheatproof requires some very specialized knowledge

gusty hazel
#

Clear as mud lol. I'm looking at Moralis. Doesn't look like its compatible with Cardano

polar marten
#

hmm

#

well what would be helpful lol

sonic stream
polar marten
#

because there's stuff that @gusty hazel finds interesting, and there's stuff that @polar marten finds interesting

#

and they're different things

#

most blockchain based games do not / cannot interact with the blockchain using gameplay. traditional gambling games can, but the way they do is complex

polar marten
#

is that true?

gusty hazel
#

Utility for our token

#

Eventually we would like to build a full casino utilizing our token. One third of decentraland's daily users were from casinos. I'd like to see the same on Cardano. Help grow the blockchain, metaverses, partner projects, etc...

polar marten
#

hmm

gusty hazel
#

The problem we're running into is the majority of people that develop on "web3" are completely full of sh*t.

#

At least those we've interacted with so far on the Cardano blockchain. I can't speak on other blockchains.

polar marten
#

well other than litigating something like that to death, what is something that would be helpful to know

gusty hazel
#

All you guys have been helpful and I appreciate that. Right now I'm just going to dig into Unity docs and educate myself more on the editor and it's capabilities.

polar marten
gusty hazel
#

lol I can only imagine at this point. thanks again!

devout solstice
devout solstice
tiny delta
#

Hey there folks! I was thinking about it, and I may try using the new input system. Is there any major downsides to it that's worth knowing about?

#

I thought using the legacy system would be easier, but now it's looking like I would need around 8-10 functions in a script just to make the controls menu and I think the new system would simplify it a lot.

shy gorge
#

Whenever I try to schedule notifications with unity.mobile.notifications through Android, they're unreliable. They don't fire when they're scheduled to fire, and they don't repeat the way they should. It feels like they only fire when I close and reopen the app. Is this a known issue, am I missing something obvious?

potent sleet
tiny delta
#

It just sucks because I spent all morning designing an input customizer for the old system

marble panther
#

I'm new to a lot of unity, too. Is it possible to input a point and detect whether or not an object is located there?

marble panther
hexed pecan
#

^It returns a Collider2D which belongs the object you hit

#

And you can access the name property of that collider. It is the name of the gameobject
It's generally bad to use object names for logic though. There's also "tags" and "layers" which you can use

woven kayak
sonic stream
devout solstice
#

Are a lot of dictionaries ok to have?

velvet jackal
#

Can someone suggest a guide to make a a chat app like discord / wlm 2012 with unity 2017.1.0

devout solstice
#

Why

leaden ice
leaden ice
devout solstice
#

Aight just didn't know if they'd impact performance or be bad to have a lot of in some way

leaden ice
#

how you use it is important of course

#

there's nothing intrinsically bad about dictionaries but too much of anything is bad of course

devout solstice
#

Yea

#

I just realized thus far I only have one

leaden ice
#

you need to test/profile your game on your target hardware to determine if you've reached "too much" yet

devout solstice
#

I'm trying to have one object follow another do I have to have it in update?

leaden ice
devout solstice
#

Aight

leaden ice
#

You could also consider using the PositionConstraint component

#

rather than writing the code yourself

devout solstice
#

Ok

#

I just realized it does need to update because the list of items I'm trying to have follow something changes during runtime

velvet jackal
pearl radish
#

I doubt the free version is too expensive

simple egret
#

Unless you're a company that does more than $100k/year in gross revenue, then you can get the Community edition for free

wheat cargo
#

Is it possible to create an attribute that can execute code on a MonoBehaviour's Awake() message?

potent sleet
potent sleet
wheat cargo
#

No like,

[MyAttribute]
class MyClass : MonoBehaviour
{
}

I want the attribute to execute some code when the Awake happens.

polar marten
#

attributes can't execute code that way

leaden ice
potent sleet
wheat cargo
#

Yeah I thought that might be the case, basically I wanted to add a component with a supplied type based on if the application is the server or not. I didn't want to have that logic to every class that needs it

#

I can just make a method that the awake method calls though. I was just curious if something like that was possible

#

Thanks guys!

polar marten
wheat cargo
polar marten
steep prism
#

is there an equivalent of Object.DontDestroyOnLoad, but for an entire scene?

brittle nebula
steep prism
wheat cargo
#

You probably want to unload that scene after calling it since it'll be empty

steep prism
#

I have decided to use Let'sBlend's option of putting my objects under a top component alongside a singleton to destroy it were it to be the case that I get to that scene again (even though it shouldn't)

public class DontDestroyInstance : MonoBehaviour
{
public static DontDestroyInstance Instance { get; private set; }

    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
    }
}
steep prism
wheat cargo
#

Yeah but your classes that have that state should be singletons in that case not the gameobject that contains them

steep prism
#

true true

wheat cargo
#

Why don't you just make an abstract singleton base class?

#

Like Singleton<T>

dreamy vapor
#

Here's my scene/game view.

#

I'm trying to spawn primitive objects by right-clicking somewhere on the canvas by shooting rays, and wherever the ray connects to a collider, it should spawn a shape.

#

However, right now, nothing is spawning. No objects whatsoever.

#

Normally they appear as children of my "click manager" object (which this script is attached to).

polar marten
polar marten
#

use prefabs instead

#

put your whole menu hierarchy in your game scene

wheat cargo
#

@steep prism

public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
    public static T Instance { get; private set; }

    protected virtual void Awake()
    {
        if (Instance == null)
        {
            Instance = this as T;
            DontDestroyOnLoad(this);
        }
        else
        {
            Destroy(this);
        }
    }
}

public class MySingleton : Singleton<MySingleton>
{
    protected override void Awake()
    {
        base.Awake();
        // additional awake logic here if needed
    }
}
dreamy vapor
left abyss
#

Hello guys
i just built with XCode and it failed it without any Errors..

polar marten
#

shooting rays... what are you trying to do

#

draw on this board right?

#

i have a hard time telling if it's a 3d object or not

dreamy vapor
# polar marten draw on this board right?

yes, and i'm trying to spawn 3D primitives (like the sphere, cube, cyllinder, capsule) on the canvas you see in my game view. only on the canvas too (i'm trying to make the ray only hit a particular layer)

polar marten
#

@dreamy vapor the component on the drawing board should look something like

public class DrawingBoard : UIBehaviour, IPointerClickHandler {
 public GameObject toSpawnOnClick;

 protected override void Awake() {
  // set up your scene for events in 3D
  var physicsRaycaster = FindObjectOfType<PhysicsRaycaster>();
  if (!physicsRaycaster) {
   foreach (var camera in FindObjectsOfType<Camera>()) {
    var raycaster = camera.AddComponent<PhysicsRaycaster>();
    raycaster.eventCamera = camera;
   }
  }

  var collider = this.GetCollider<Collider>();
  if (!collider) {
   var meshCollider = AddComponent<MeshCollider>();
   meshCollider.convex = true;
  }
 }

 protected override void OnPointerClick(PointerEventData pointerEventData) {
  var worldPosition = pointerEventData.pointerCurrentRaycast.worldPosition;
  var newPrimitive = Instantiate(toSpawnOnClick);
  toSpawnOnClick.transform.position = worldPosition;
 }
}
polar marten
#

to describe the drawing board

#

you don't need to do raycasts

#

or clicking or Input.mousePosition or any of that nonsense

#

EventSystem which you already have because you have UGUI elements gives you all that already

dreamy vapor
#

these are just the methods they taught us in my class. i think they're expecting us to use methods like these

#

i meant the ones i mentioned, btw

#

like raycasting

polar marten
#

i think you'll figure it out

polar marten
#

@steep prism you shouldn't use an abstract base singleton whatever

dreamy vapor
polar marten
#

i can't really tell what's going on. i wrote the way i would do it

dreamy vapor
#

that's fair. thank you.

tawny jewel
#

hey, so i have a problem with i cannot seem to solve. basically i have a floppy bird type of game and i have the enemy spawning in and trying to reach pipes, but i also wanted it to avoid those pipes. but when the enemys ray is on top of the pipe it tries to move towards the bird and go up/down at the same time with makes it look like its having a stroke. i tried to solve that with the isbirdaccesable method you can see in my code. but right now it just always returns true. i also tried this code, with also didnt work:

    {
        RaycastHit2D hit = Physics2D.Linecast(hitinfo.point, bird.position, layerMask);
        return hit.collider == null || hit.collider.name == "bottom pipe" || hit.collider.name == "top pipe";
    }```

my code: https://hastebin.com/share/wowifukaco.java

i would be very thankful for any help
golden garnet
#

Hey! I asked this in #💥┃post-processing , but I just wanted to see if anyone in here also has any idea about this...
Can I lerp a chromatic aberration effect during runtime? Like maybe through an animation or something?

leaden ice
golden garnet
golden garnet
#

I'm not sure, I've tried it and it doesn't work. I could send code to check if there might be an issue.

golden garnet
#

Here's a basic version:

    {
        if (Input.GetKeyDown(KeyCode.O))
        {
            AbIntensity(2f);
        }
    }
    public void AbIntensity(float time)
    {
        Mathf.Lerp(_chromaticAb.intensity.value, 1f, time);
    }```
#

Pressing "O" doesn't do anything in this instance.

leaden ice
#

Also using 2 as the Lerp parameter is pointless

stuck forum
#

are there any huge differences between interfaces and abstract methods? (unity wise). only thing i can think of is with doing e.g IDamageable and have anything damageable implement that, no matter how far related they are, but using abstract methods are more tightly coupled to whatever class inherits that abstract class that has the abstract method and is usually closer related

leaden ice
#

And you can only actually inherit from one class

#

You can implement as many interfaces as you want

stuck forum
#

true true

#

abstract methods can also implement logic which interfaces cant

leaden ice
golden garnet
#

Oh! So what should I do to clarify? Something like _chromaticAb.intensity.value = ??? after the Mathf?

earnest epoch
golden garnet
#

I feel like that may be a little resource instensive

leaden ice
earnest epoch
#

You can think of abstract classes and interfaces as a top-down / bottom-up approach to describing an object. Abstract classes make for a common underlying framework for whatever inherits from it while interfaces mark that a class can suffice to squeeze through a certain-shaped hole. Interfaces declare that a class is suitable for a certain behaviour, such as being "IDamageable", etc.

golden garnet
leaden ice
#

It makes things like this quite easy

golden garnet
#

Oh, alright. Here I'll look into it right now.

stuck forum
earnest epoch
#

You're always "tacking on" behaviour with an interface in the opposite direction that an abstract base class would be "building it up".

stuck forum
#

i see

#

i think i understand

earnest epoch
#

@stuck forum For a concrete example, let's say that you have an enemy that the player can attack as well as a special breakable wall.

#

The enemy, being an entity of sorts might inherit from some base class that has a health pool, but the wall isn't similar enough to an enemy to inherit also.

#

To spread the behaviour of being able to take damage around, you can have both the base enemy and your wall implement an IDamageable interface which handles what happens when the player attacks. In the case of the enemy, it might subtract health. In the case of the wall, it might trigger some other behaviour that never uses a health pool so to speak.

#

The player attack could target any IDamageable in this case and both objects would receive the method invocation. You can keep your classes that define enemy behaviours totally separate from any description of what can take damage this way.

idle meteor
#

Hello, I am trying to integrate the multiplayer system with unity. I came across Netcode but it's only about Unity. I want to run the multiplayer infrastructure on Steam. What can I do for it?

earnest epoch
stuck forum
#

@earnest epoch i see, that does make a lot of sense

#

i guess i was just over thinking a bit since i saw some c# tutorials about interfaces and abstract methods, but usually in Unity you do GetComponent for interfaces so it's easier done that way, but standard c# doesn't have that so i just struggled to see the use case outside of unity

earnest epoch
tawny jewel
earnest epoch
#

Components provide behaviour to game objects as interfaces provide definition to classes, but Components are implementations and interfaces are not. An interface is a contract that states that any class that implements it will define a body for whatever methods are declared by the interface.

#

Again, C# is a single-inheritance language. Multiple-inheritance like LUA allow exactly what you're thinking of, but there are pitfalls for OO that come with developing that way.

stuck forum
#

i do know what interfaces do, i guess i just, for some reason, see a blurred line between abstract methods and interfaces, even tho it shouldn't be a blur

earnest epoch
stuck forum
#

ah

earnest epoch
#

On this note, all abstract means is that the base class makes no sense by itself and doesn't really affect inheritance.

vagrant agate
#

abstract classes main use case is for classes that will share a lot of similar logic. Interfaces are just a blueprint that forces you to override those methods.

cold parrot
# stuck forum i do know what interfaces do, i guess i just, for some reason, see a blurred lin...

Maybe you have a hard time wrapping your head around their purpose because Interfaces solve a problem that you only really come into contact with if you work on projects that involve multiple people and changing specifications over time. They allow you to define a minimal set of specifications that need to stay the same for a system to remain operable while everything else that’s not exposed by the interface can change. You can achieve such decoupling without having interfaces as a language feature but in OOP having them as a language feature is very convenient.

stuck forum
#

I see that does make sense.. hmm

#

I'll definitely read on about abstract/interfaces since i rarely use them and it would be great to know more about them

earnest epoch
golden garnet
#

What's the best way of linking one variable to another that takes up the least amount of resources? Like, for example, if I wanted a to be equal to b at all times, what would be the most efficient way of doing it?
(I ask because I feel like a = b in Update() might be a little too resource-intensive)

mental rover
golden garnet
#

this would all be chill if i could just directly animate post processing values from the inspector but for some reason i can't

north moss
#
GameObject unGo = new GameObject();
        unGo.name = "newFou";
        System.Type fouClass = Type.GetType("Fou");
        
        Piece fou = (Piece)unGo.AddComponent(fouClass);
        fou.dxDalles = dxDalles;
        Debug.Log(fou);

Hello, just to be sure, is this a bad way to use AddComponent? I used a GetType of a string to add it. I know using a string with AddComponent is obsolete, but this one works when I use the type from GetType("My string

potent sleet
north moss
#

Yeah but let's say I can't just used that because I want to add dynamically scripts wich arnt gonna be the same.
Piece here is a parent of Fou, and many more

potent sleet
#

oh you want to add component using a string ?

north moss
#

Well that's the most legit way i found

#

im not sure if it's still considered legit tho

potent sleet
#

what's the intended usecase

earnest epoch
north moss
#

Right now it's mostly for fun, but I found that it could indeed work for adding Monobehavior script in with a ScritpableObject

potent sleet
#

It works but isn't really the best way to do it lol

north moss
#

I call this a win lol

earnest epoch
#

If it's for fun, I encourage you to look into the System.Reflection namespace, but know that 99% of the time this is not what you want.

north moss
#

My curiousness will lead to my fall lol

earnest epoch
tiny delta
#

I've been looking around for over half an hour and I'm probably just blind and terrible at google, but I can't find anything about how to make a controls menu using the new input system. I have a vector2 and a button input, and I want to figure out how to change them in my script, and I can figure out the rest for making the menu from there. Does anyone know how to do this or have a link to a docs page that explains it?

tiny delta
#

Yup, I'm working on it there now, somehow I didn't see that channel

sweet perch
#

im using the particle system and the particles are following the player without me doing anything. anyone know why thats happening?

west sparrow
#

In the video, you have a search term blocking the hierarchy view.

west sparrow
# north moss I call this a win lol

Small detail, but, if you do go down that path, just consider the gettype might fail or return null. So you might want to put something defensive in there. If it is being open ended and all.

#

Creative solution though imo

sweet perch
#

is a component in the torch

#

and the torch is in a chunk game object

barren vapor
#

dw i figured it out 😛

polar marten
polar marten
novel raven
#

whats the correct way to do this? (new input system)

void Start()
    {
        input = new IInput();
        input.Main.Enable();
        input.Main.LeftGrab.performed += Grab(1); //these errors
        input.Main.RightGrab.performed += Grab(2); //
    }

    void Grab(int side)
    {
        // 1 = left, 2 = right
    }
leaden ice
earnest epoch
#

The problem being that you can't unsubscribe a lambda.

leaden ice
#

The main problem is that you passed in void to the += operator instead of what the event actually needs which is a delegate.

earnest epoch
#

@novel raven Ideally, you would point that to a method to handle the performed call and then contain the Grab(2) part. For example:

public void DoLeftGrab(InputAction.CallbackContext context) {
  Grab(1);
}

You could then unsubscribe with input.Main.LeftGrab.performed -= DoLeftGrab; when cleaning up your class.

#

The subscription / unsubscription can go in either Awake and OnDestory, or you could set them up in OnEnable / OnDisable. The point is, every += should have an equivalent -= to clear it when cleaning up your class.

novel raven
#

would the subscription persist across sceneloads? because that would be the only reason i would need to unsubscribe

leaden ice
earnest epoch
wintry sun
#

people

#

i have ui problem

#

my text doesn

#

t

#

interact with code

void basalt
#

So I've been getting mixed answers. Are basic floating point operations deterministic or not?

Like if I do 1.32894828 * 100, will that always be the same outcome regardless of hardware vendor?

leaden ice
#

Different CPUs do floating point math at different levels of precision.

void basalt
#

The guys in the C# discord are claiming it's completely deterministic regardless of hardware

#

and cited a IEEE standard

leaden ice
#

Are they claiming floating point ops in general, or this particular operation?
1.32894828 * 100

void basalt
#

in general

leaden ice
#

whoever "they" are, they're wrong

void basalt
#

hmm

#

not to throw anyone under the bus

#

I just need a solid answer

leaden ice
#

what he isn't taking into account with his answer is that not all processors support the same formats for the calculations

void basalt
#

apparently the tanner guy is also the numerics lead

leaden ice
#

also correct about the sin/cosine stuff

devout solstice
#

Bro I cant figure out whats wrong with this god damn string

void basalt
#

So like, if it's an AMD or Intel CPU, it should be deterministic?

#

I don't plan on writing code for a 1970s mainframe anytime soon

leaden ice
#

it should be deterministic on the same model

void basalt
#

right

devout solstice
#

my brain hurts and theres about to be a new hole in my wall

leaden ice
#

best to work through that with a professional

devout solstice
#

Praetor

#

How tf am I supposed to not be angry, when this string, is refusing to get set

#

this fucking string has issues

leaden ice
#

Seems more likely you have a misunderstanding about how C# or Unity works

devout solstice
#

I am doing it exactly how Im supposed to

potent sleet
devout solstice
#

Don't make jokes in the unity discord, noted.

void basalt
#

Pretty hard to sarcasm over text

#

and doing /s is cringe

devout solstice
#

Fair enough

#

But why would I punch a hole in my wall

potent sleet
#

maybe your parent canceled your wow account

devout solstice
#

wow

quartz folio
#

If you don't have code or a question, this convo can be avoided

devout solstice
#

OMG i DID IT

#

I have a lot of for and foreach is that ok?

leaden ice
#

no there's a limit of 10 for loops in the whole program

#

(this is sarcasm)

devout solstice
#

lmao

#

This error message isn't telling me where the out of range index is

#

Its only when the DropItem method is run so it has to do with it, but no where in there do I mess with any indexs, I check if a list contains an item and remove items from 2 lists but thats it, the object cant be out of the index or it wouldn't have been added and it would throw the error when the pickupobject is run

leaden ice
#

(though that line might pint to the } at the end of the method

#

its in a place where you try to access a particular item (hence the get_item call in the trace)

devout solstice
#

but that for loop has been working for a while and I haven't touched it

leaden ice
#

but the data going into it might be different now

#

the error never lies

devout solstice
#

Thats run in onvalidate

leaden ice
#

the error is from a button click handler

devout solstice
#

wtf is wrong with the button damn it

leaden ice
#

nothing's wrong with the button but the code it's invoking is encountering an error

devout solstice
#

oh shit I was looking at the wrong script

dreamy osprey
#

Hey, so i downloaded unity just now (used it before dont worry, and know some stuff on c# and cpp XD)
But i was wondering how to make a shader, so i downloaded a URP and well, you can see what i mean. I use a default shader from that render pipelineand it goes coconut texture style 💀💀

#

please dm if you know what did i do wrong (cant check this server 24/7)

potent sleet
earnest epoch
main shuttle
jovial spear
#

Physics.OverlapSphere in editortime doesn't filter the layer

#

does it happen to you too?

earnest epoch
jovial spear
#

what you mean with semantic issue?

earnest epoch
main shuttle
jovial spear
#

ah ah
anyway I found the problem. my code was for replicate the triggerenter and triggerexit in editortime and i miss that one gameobject calling the overlapshpere was on ignoretrigger layer that is correct for my purpose on play, but with overlap it doesn't care about the self layer (correctly). thanks for confirming that overlapSphere was right

earnest epoch
jovial spear
#

yesterday i got stucked on 2 unity's "bug" (in my opinion bad choices) so i gave the guilt to unity's method too fast xd

#

the bugs are:

  1. collider with radius = 0 still trigger if inside other collider
  2. OnEnable in a class with [ExecuteAlways] gets called twice at start playmode
earnest epoch
plucky inlet
earnest epoch
#

My intuition suggests this conflicts with Collider volumes not being convex.

plucky inlet
plucky inlet
slow pagoda
#

Is there a way to access code from a package that has an asmdef file without creating another asmdef file?

slow pagoda
#

?

ripe vale
#

Hey guys, I've been programming a custom player controller without a rigidbody and a character controller(basically just raycasts and capsule casts) with some vector math to make wall slide, check if on ground, apply gravity etc. Needless to say this is horribly painful to think about ahah but im doing it as a learning experience. But it got me thinking, is this normally done ? Or do real games normally use rigidbody or character controller,if they do which ones of this two is most used ? I would assume rigidbody since it seems less restrictive but I would like some examples of games and what they use
if you guys dont mind

mental rover
fiery saddle
#

I have base class A and B as class that inherits.

How can i execute only variable = 1 in base class, then for instance variable=2 in inherited class and then invoke back in base class?

public void Foo(){
   variable = 1;
   Event?.Invoke();
}
#

Dont know to explain it differently
I thought about subscribing function in inherited class as first function in event but dont like that method because seems clunky and prone to error.

Thought about having aditional protected event that calls internal functions and triggers, before public event but that doubles event count.

Or i have to override function in inherited class but i dont like that approach as i have to change something in multiple places if i change something in base class

left abyss
#

Hello guys, in Mac, anyone got an issue like that ? the app started with an black screen ?

plucky inlet
leaden ice
plucky inlet
#

!code

tawny elkBOT
#
Posting code

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

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

leaden ice
#
public virtual int Example => 1;

public override int Example => 2;```
@fiery saddle
digital meadow
#

Pleae help I get a null reference when trying to use this and I cant figure out why?

    public Vector2 NearestCheckpoint(Vector2 position)
    {
        float nearestDistance = Vector2.Distance(position, Spawn.position);
        Vector2 nearestCheckpoint = Spawn.position;

        foreach (Checkpoint checkpoint in _checkpoints)
        {
            float distance = Vector2.Distance(checkpoint.transform.position, position);

            if (distance < nearestDistance)
            {
                nearestDistance = distance;
                nearestCheckpoint = checkpoint.transform.position;
            }
        }

        return nearestCheckpoint;
    }
plucky inlet
fiery saddle
plucky inlet
digital meadow
# plucky inlet Where do you get the null reference?

NullReferenceException: Object reference not set to an instance of an object
GameManager.NearestCheckpoint (UnityEngine.Vector2 position) (at Assets/Scripts/GameManager.cs:41)
GameManager.Update () (at Assets/Scripts/GameManager.cs:64)

    void Update()
    {
        if (Lifes < 0)
        {
            //Game Over
        }

        Debug.Log(NearestCheckpoint(Spawn.position));
    }
plucky inlet
digital meadow
#

float distance = Vector2.Distance(checkpoint.transform.position, position);

leaden ice
plucky inlet
digital meadow
late lion
worthy cape
#

I want to multiply a direction to get a position from direction

            Vector3 ramDirection = (_sm.target.position - _sm.transform.position).normalized;
            _ramPosition = ramDirection * _sm.ramAttackDistance;
            _ramPosition.y = _sm.transform.position.y;

I use this code but it gives a position far from the direction

#

anyone knows why?

leaden ice
plucky inlet
late lion
worthy cape
leaden ice
leaden ice
leaden ice
#
Vector3 ramPos = Vector3.MoveTowards(sm.transform.position, sm.target.position, ramAttackDistance);```
#

Unless you want to be able to overshoot

worthy cape
#

ohh I will try it, thanks man!

jovial spear
#

Hi have problems changing a gameobject layer

leaden ice
jovial spear
#

I have this code inside coroutine:

[...]
            yield return new WaitForSeconds(TIME);
            gameObject.layer = LayerMask.NameToLayer(LAYER_NAME);
            [...]
            yield return new WaitForSeconds(duration);
            gameObject.layer = LayerMask.NameToLayer(LAYER_NAME_IGNORE);
[...]
#

the gameobject change it's layer the first time

#

but he doesn't swicht back

leaden ice
jovial spear
#

the code is executed until the end

leaden ice
jovial spear
#

debug.logs

leaden ice
#

Ok good

#

So

#

The only answer is that you are changing the layer back somewhere

hidden kindle
#

I do I prevent GameManager based scripting from becoming spaghetti code?

leaden ice
#

Either running this code multiple times (starting coroutine in Update perhaps?) Or some other code

plucky inlet
jovial spear
#

"Ignore Raycast" is the correct name for the default unity layer Ignore Raycast?

plucky inlet
#

Like a coroutine still running while you start a new one?

leaden ice
plucky inlet
#

I think he means singleton pattern for global manager scripts

hidden kindle
jovial spear
plucky inlet
jovial spear
#

the second layer is Ignore Raycast

leaden ice
hidden kindle
leaden ice
#

can you show examples

hidden kindle
plucky inlet
leaden ice
plucky inlet
jovial spear
# leaden ice show your console window with these debug.logs etc
        private IEnumerator TestCO()
        {
            Debug.Log($"Layers: {LayerMask.NameToLayer(LightManager.LAYER_NAME)}, {LayerMask.NameToLayer(LightManager.LAYER_NAME_IGNORE)}");
            Debug.Log($"TestCO. pre change 1 layer={gameObject.layer}", gameObject);
            gameObject.layer = LayerMask.NameToLayer(LightManager.LAYER_NAME);
            Debug.Log($"TestCO. post change 1 layer={gameObject.layer}", gameObject);
            yield return new WaitForSeconds(duration);
            Debug.Log($"TestCO. pre change 2 layer={gameObject.layer}", gameObject);
            gameObject.layer = LayerMask.NameToLayer(LightManager.LAYER_NAME_IGNORE);
            Debug.Log($"TestCO. post change 2 layer={gameObject.layer}", gameObject);
        }

It seems correct reading logs, but in the inspector top left i see the layer 17 on the gameobject

leaden ice
#

if the layer is something different later on, it's because some other code is changing it, or you're looking at the wrong object.

jovial spear
sudden meadow
#

What's the correct way to write #if UNITY_EDITOR #endif and then have an if for it being a build instead of editor?

leaden ice
thin aurora
#

Checks if the preprocessor does not exist basically

sudden meadow
#

@thin aurora oh does that work, ok thanks

leaden ice
#
#if UNITY_EDITOR
 // editor stuff
#else
 // non editor stuff
#endif```
sudden meadow
#

i tried #else but it just greys it out and didn't know if it works or not

thin aurora
#

Yes it greys out in the editor because it exists 🙃

#

But it will work in a build application

sudden meadow
#

fair, thanks

thin aurora
#

If you need to validate the code syntax you can always change the block to be in reverse and the other part will grey out, allowing intellisense to work on it.

coral hornet
#

whats the best way to do an inverse kinematics animation approach

jovial spear
coral hornet
#

i have an enemy that will violently hunt down the player, and the idea is that he will use his full body to mobilize himself more