#💻┃code-beginner
1 messages · Page 8 of 1
this
yeah 100% ima get that done then, that will help me lots
yeah ill go do that thanks :>
Is AssetDatabase.LoadAssetAtPath loads ScriptableObject? Why it fails in
PrefabsContainer prefabs = AssetDatabase.LoadAssetAtPath<PrefabsContainer>("Assets/Resources/PrefabsContainer.asset");
i can send you
hi
so i just started trying to code in unity so like
i am trying to make my camera follow an object
im not familiar with the api
so like is there anything i can use to make the camera follow an object?
Learn to use Cinemachine. No code required for the most part
isnt there a way to do it with code
!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.
Of course there is but Cinemachine is better
You may just set your camera as the child of your player.
by now i want to just use plain unity
yes but thats a bit goofy cuz
hmm
i want to make a object that moves
and i want the camera to follow it
i dont want the object to be anchored into the camera or something
Look up a tutorial on doing it with a script or with Cinemachine. Nobody here is going to walk you through it line by line
im not saying that
Cinemachine is a official part of unity so it is plain unity. It is also all the camera code you will ever need
im not familiar with the api
guya please help em
So learn it and do t bother
i wanted to know if there is like some sort of class or anything to make a object point to another object
!learn to get started learning the unity api
🧑🏫 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/
gaming
i did what the link you sent did and installed the stuff
but now my code is jsut blue
You can create an empty object called "CameraTarget" or something, and get its Transform. Then create a class CameraController derived from MonoBehaviour and attach it to your camera. In Update of CameraController, you can transform.position = cameraTarget.position
i dont know if that matters tho
of course you need to get Tranform of CameraTarget first in CameraController
(and set CameraTarget as the child of your player)
Welp, it did not work because the error you're having isn't highlighted. Restart your computer and see if that solves it
thats the only change it seemed to have made, yeah ill retard my pc
why each player has different results of raycast when they start from exact same spot for everybody
Physics.Raycast(allparticles[i].position, allparticles[i].velocity, out hit, allparticles[i].velocity.magnitude * Time.deltaTime, 1 << 0)
does anyone know if unity editor 2019.4.31 is compatible with Windows 11?
somebody else couldnt run it on windows 11
yes for me it works
@short hazel thank you so much, I solved the issue because of you,
I thought that if I had the struct in a Serializable class I don't need to serialize the stuct as well. The other huge mistake that I did was writing the wrong string in the save script (passed the "data" which was the class b4 converting it to JSON instead of dataToSave which a JSON string). It works fine now
It does? huh..idk why. when i try to downlad itm it says Download Failed and something about Validation
Check the editor logs (links pinned to #💻┃unity-talk) for any errors. Conversation should be moved to #💻┃unity-talk as it's not a code issue
didnt solve it :/ ill try it all again
I'll check it and then move there
i have a question, is it possible to have a unity 2d game thats multiplayer but player 1 and player 2 have own special movement like player 1 cannot move while player 2 can move?
Good. Not sure why you added this on line 27 though, you were meant to edit line 26 using my example
Or doing
= Instantiate(bullet, spawnPoint.position, spawnPoint.rotation), you choose
You already have a part of it on line 26, add the missing stuff
my bad, didnt follow instructions properly, its working like a charm!!!! thank you so much, helped a bunch and have my VS set up with unity which is also a huge help, thank you so much for yout time :D!
It's possible. Kinda like a turn based game
Why are the enemys not waiting 1 to 3 second before they spawn? They are just spawning nonstop without any cooldown at all
hey me and my friend are wanting to make a game like bit life using unity where have some hardship with getting the basic done like the aging system can any one help with that, i feel like i tried everything but we cant achive that bitlife aging and the years going up fase
You're starting a new coroutine every frame on update
what should i do?
You're starting another copy of the coroutine every frame
Start the coroutine once in Start, put a loop inside it to repeat the code
You can make a bool like "isCoolingDown" and set it to true before calling the coroutine and to false inside the coroutine at the end. And check if the bool is false before calling the coroutine
Or just use a timer in update and ditch the coroutine entirely
Or that
ty!
In this case, what happens if the object is destroyed?
When an object is destroyed all coroutines automatically stop?
Coroutine stops
Yes the coroutine lifecycle is tied to the GameObject
thanks
Show the Creature script code
MainCharacterController.mainCharacter = MonoBehaviour.Instantiate(JsonUtility.FromJson<Creature>(value));
what part :>
ye
You won't be able to deserialize a mono behavior
They can only be created with Instantiate or in the editor
Or AddComponent
🥹
Move the data you want to serialize into a POCO.
ig json won work on my save system 🥹
anyway, this is the json https://gdl.space/qanexisufu.json
Can i somehow salvage a specific parts of it?
like forcefully changing the fields in the monobehaviour?
hopefully without reflection
are there life hax?
hi, i'm doing here a list of a list, but it don't show up in the inspector :/
unity cant serialize list
of list
use a class that hold a list and make a list of that class instead
what should i do, if i want my enemy prefab to move towards the player but can't get a reference to the player, because it's a prefab?
Are marker interfaces that terrible? They really seem to be useful for a situation I'm having to deal with.
As in interfaces that don't force you to implement anything?
What's "the situation" here?
See pinned messages for a guide on referring to members on other scripts
An abstract base class can also be an alternative
Then look at dependency injection @onyx prairie
I'm already inherinting from a class saddly
I have two types of "super" tiles, water and land. I have two tiles inheriting from water: shallow water tile and ocean tile.
I need checks for both the water and land tile, and also checks for the tiles inheriting from water. It is also a form to make some sort of parameter for the types so that I can use in the Tilemap.GetTile<T> generic.
i.e tile = tilemap.GetTile<ICustomTile)
tile.MyOverrideFunction
Or whatever
Anyways
Is there any way of turning yaw, roll and pitch into mouse axis while an object is moving? I've tried using tutorials but the system that functions on the WASD doesn't function as well on mouse axis.
I've used that but when it is applied, problems persist with the transform.rotate system.
Let's say if i do:
x = Input.GetAxis("Mouse X");
y = Input.GetAxis("Mouse Y");
transform.Rotate(x, x y);
transform.position += transforn.forward * speed * time.deltaTime;
the object will just go into a random spiral when i turn
The first param should be the axis which you want to rotate around. Or in your override, it might be transform.Rotate(x,y,0) (maybe -x, y, 0 or x, -y, 0, I always mix that up)
so that should fix the pitch and yaw but how do I allow the roll to still work then?
Sorry I can't understand this sentence. This code should work for pitch and yaw. What does "allow the yaw to still work then" mean
sorry, i meant to say roll
Do you mean rotate the camera clockwise or counterclockwise? You can't roll while modifying yaw and pitch.
oh
Your can rotate around z-axis to roll
im having trouble with 2d collisions, both player and npc have box collider, isTrigger is off and rigidbody2d set to dynamic, but the collision message is not showing on console logs
player controller script: https://gdl.space/lefiyicasu.cs
collider script: https://gdl.space/imepopuwuy.cpp
So you are rotating a plane instead of a camera? You can only roll the plane when for example Q is pressed. Then you may write:
x = Input.GetAxis("Mouse X");
y = Input.GetAxis("Mouse Y");
if (Input.GetKey(KeyCode.Q))
{
transform.Rotate(Vector3.forward, x);
}
else
{
transform.Rotate(x, y, 0);
// maybe negetive x or y
}
ok, thanks
📃 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.
private void AlignGodRaysWithLight()
{
float lightRotationY = directionalLight.transform.rotation.eulerAngles.y;
ParticleSystem.MainModule mainModule = godRays.main;
mainModule.startRotationY = lightRotationY;
}``` im trying to align my godrays with my lightsource, the code is working but the angle is not even close to being correct
how to keep the player's position at the center of the tilemap when moving diagonally?
Hi. Im making a stamina bar.. if the player hold shift and is grounder and other conditions are met.... stamina decreases. Good, I made a slider that give feedback to player how much stam he has. Now sliders use floats as value as far as i know between 0-1.
I dont want the player to see 85.45344% i just simply want to 85% displayed so i made another variable called staminaFloor so i can use that to floor down and display that value as feedback: staminaText.text = staminaFloor.ToString() + "%";
Im passing stamina's value to staminaFloor to do a accurate flooring but when i want to update the slider decreasing and say: staminaSlider.value = stamina / 100; i have a error that stamina cannot be a double... but i cannot do flooring on floats. So any idea how to convert floats to double or vica versa?
why is stamina a double in the first place?
at first it was a float but i want to floor it and i cant floor a float
You don't need another variable btw, you can just pass a format string that says "display no decimals"
.ToString("F0")
well if that is true
then turn stamina back to a float
then you can Floor(double)stamina)
Or actually here, "P0" and it'll display the percent sign for you depending on the user's language!
(some languages put the % sign before, or after the value with no space)
ah i just noticed that if i change the X rotation of my lights the rays change aswell
Preeeetty sure you can.
There is this
https://learn.microsoft.com/en-us/dotnet/api/system.mathf.floor?view=net-7.0
https://www.geeksforgeeks.org/mathf-floor-method-in-c-sharp-with-examples/
well there's also https://docs.unity3d.com/ScriptReference/Mathf.Floor.html
and (int)floatVariable
I used Math.Floor maybe that caused the problem
Mathf is for float math?
yes, unity has its own Mathf class specifically to work with floats since c# didn't get a MathF class until much later
Yeah, I dunno why i generally use MathF
Okay, i can confirm everything wokring with mathf... i think very long time ago i saw a javascript video and there Math.Floor was used thats why it stick to me. But its good to know Mathf exist. i prefer floats over doubles so...
Actually just tested, the P formatter actually expects a number between 0 and 1 for a regular percentage, so just use F
Plus it's easy if you want to display a decimal, it's just F1, change the number to display more or less
((4.25f).ToString("P0") -> 425%)
thats why i divide it lol staminaSlider.value = stamina / 100;
P0 does rounding instead of flooring though
The point is, its working now and if it not broken ain't fix it! I will keep this P0 and F0 in my head tho. It's good to have a community like this where i can get quick answeres 🙂
{
if (size.x > point.x && size.y > point.y)
{
if (pixels.GetLength(0) > point.x && pixels.GetLength(1) > point.y)
{
var pixel = pixels[point.x, point.y];
if (!pixel.destroyed || pixel.color.a != 0) return true;
}
}
return false;
}``` why does this keep telling me the index of `var pixel = pixels[point.x, point.y];` is out of bounds even with all the restrictions???
The conditions are not perfect, they should be >=
Or, better reversed point.x < pixels.GetLength(0)
why would there be a difference if its reversed
still says that
"if my value is less than the length" is more comprehensible than "if the range is greater than my value"
{
if (size.x > point.x && size.y > point.y)
{
if (point.x < pixels.GetLength(0) && point.y < pixels.GetLength(1))
{
var pixel = pixels[point.x, point.y];
if (!pixel.destroyed || pixel.color.a != 0) return true;
}
}
return false;
}```
2 possibilities, the value is less than 0, or the array is empty
You should be logging that vector to see what it contains
the array shouldn't be empty since I initialize the thing
which fills it with the pixels
Prove it with logs
this is weird
it shouldn't be negative
I'll try to log it before I turn it from a local position to a pixel position
I'm trying to make my per-pixel destruction work with joints
size probably a non-negative vector2int
so if one of the components of point is negative it always <size.corresponding component
ok, remember when I try to make a weak point of an object? (if it receives a single shot the object is destroyed) well now I adapted it to this script but it doesn't work for me.
It is to try to script the parent object to explode if (hit.transform.gameObject.CompareTag("WeakPoint")) { var v = hit.transform.gameObject.GetComponentInParent<ToiletExplodes>(); v.hitsReceived = v.maximalHitsToDestroy; }^ all of it on the update method
For my project, I am trying to make my player automatically jump when they touch an object that is part of a certain layer, the problem is I believe I am referencing it wrong. Here is the code.
https://paste.ofcode.org/b4H6VTTpQeTFU6caRZsMgB
{
var anchor = pd.LocalToPixel(pd.transform.InverseTransformPoint(transform.TransformPoint(j.anchor)));
if (pd.IsTherePixel(anchor))
{
var joint = pd.gameObject.AddComponent<HingeJoint2D>();
Stuff.CopyHingeJoint(j, joint);
}
}```
is there a way to handle this better
first I move the anchor to world space, then I move the anchor to the local space of the new part, and then I move the anchor to the pixel space of the new part.
it works if its on the right side of the thing aka the positive side
https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-startRotationY.html should this still be expressed as a radian if i have it assigned as a constant in the inspector?
private void AlignGodRaysWithLight()
{
float lightRotationYRad = directionalLight.transform.rotation.eulerAngles.y * Mathf.Deg2Rad;
float lightRotationXRad = directionalLight.transform.rotation.eulerAngles.x * Mathf.Deg2Rad;
ParticleSystem.MainModule mainModule = godRays.main;
mainModule.startRotationY = new ParticleSystem.MinMaxCurve(lightRotationYRad, lightRotationYRad);
mainModule.startRotationX = new ParticleSystem.MinMaxCurve(lightRotationXRad, lightRotationXRad);
}``` i tried this but the angles still dont match
hey, how do you change a mesh filter's mesh? it doesn't seem to be as simple as object.mesh = gameObject
I think this might be it
public void ChangeModel(GameObject item)
{
currentModel.mesh = item.GetComponent<MeshFilter>().mesh;
}
could anyone please help me ?
Ask your question.
need help to shoot right with my player
could anyone help me ?
my weapon is right now rotate
i can show you
this is what I have
the pistol is not ready to shoot forward
then rotate it so that it's pointing forward..?
what's the proper code for "destroy instance if more than once instance exists in a scene"? is it some kind of count? onEnable count++ to keep track of how many are active then destroying a select instance?
This seems to destroy every single one, and I don't want to place it into "do not destroy" in this case. just locally clean out any duplicates
private void OnEnable()
{
if (Instance != null)
Destroy(gameObject);
}
Google singleton
a singleton which destroys itself on awake if the instance isnt null is pretty easy
How?
is the problem that it's rotated wrong after you parent it to the player's hand?
i have this item previewer that pops up, and its bugging out for some reason, so i want to destroy the previous instance and instantiate the new one. It would be onEnable instead of awake
yes
The gun is not my shoot diretcion
Add an empty game object to your hand and rotate it. Parent the gun to that.
That's the usual way to do it.
So the hierarchy will be something like
Upper Arm -> Lower Arm -> Hand -> Gun Holder
Attach the gun to Gun Holder, then rotate it until it looks right
then exit play mode and set the same rotation
i have this code and my MAIN point is the fire rate, right now oyu can spam fire the gun where i want to make it so you can only fire the gun every 0.5 seconds no matter if you spam the trigger. yet the code i wrote set to "0.5" does nothing you can still spam, what did i do wrong?
your if statement is not doing what you think it does
An if statement applies to the next statement
Could uou help me ?
I don't see what the problem is. Rotate gunContainer until it's correct
Oh, one other thing
yeah as soon as i posted this i saw that all my text was blue
After you parent the gun, set its transform's localRotation to Quaternion.identity
That will zero out the local rotation
how to actually shoot with the gun right?
That may be the problem.
if (foo)
Debug.Log("I'm affected");
Debug.Log("I'm not affected");
so yeah, block statement
Different scripts for each waepon?
Hmm this check doesn't seem to work. its still stacking, neither awake nor onEnable is preventing the instantiation stacking.
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(this);
}
else
{
Instance = this;
}
}
maybe a check for "does this item exist in the scene -> destroy it" then running the cached instantiate?
Like adding it to a private list to keep track on instantiate, then run a destroy + clear to force its destruction/debug
pls help me aim right with guns
im not sure what i should do instead
Could you help me
Don't spam.
You should use a block statement.
if (foo)
{
One();
Two();
Three();
}
i dont have any idea my man, im brand new to this stuff
This also applies for things like for loops
You can also just use them whenever you want
Guyz I have a question
{
int x = 3;
}
x = 4; // error, x is gone
how do I use script for each weapon?
it should be different functionallies
For example:
a sniper needs to have a scope while ak does not
Make two different scripts
They should be on the weapon to start with
you mean I should not add compnents ?
A weapon prefab you Instantiate(), and this way it'll enable the script when the object is in the scene
What I do is use one prefab for the pickup (has only the visual and a pickup detection script), and another for the real weapon
Oh lord
Im using switch to add weapon component for each different script
!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.
what
Yeah no definitely use prefabs for this
what
im not sure what you mean by "instantiation stacking". You could do a FindObjectByType to see if it exists anywhere in scene but checking the static variable should suffice.
Don't do it all from the code. It's very ugly and repeated and error-prone
Use prefabs. These GameObjects should already have the component attached to them . . .
If the pickup is the weapon with the shooting script disabled, then yes you need to enable it on pickup
Yea, so i used a for loop + list to force destroy the cached instances. I was var cached = Instantiate(thing); and it would keep creating prefabs.
But by adding it to a list cacheList.Add(cached) I could run a destroy Destroy(cached[i]) in the for loop 1 step before starting the instantiation (if cachedList.Count > 0 then Destroy)
The problem was that it kept spamming instantiations and those spawned items had no way of self deleting or seeing other instances of the same thing (same class shared across all instantiations, they all were Instance in awake). But the list + delete method works and now it only spawns 1
But again I'd use two different prefabs, or a prefab variant of the weapon. So it keeps the matters separate between "I'm a pickup" and "I'm the weapon"
like this?
Right, but now you'll want to move the rest of that logic into the block as well
Right now, the block statement only contains one line: nextFire = Time.time + fireRate;
The rest of your code is running unconditionally.
Indeed.
Im not really sure what you're doing tbh because the code snippet just checking in awake should work, so you're probably doing something else for that to not work. 🤷♂️ if what you wrote works then I guess its solved
thank you so much!
could anyone show me code or video for weapon system
to shooting with differnt weapons
Seeing your past questions, sound like you need to !learn the basics
🧑🏫 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/
No one is going to make you some code for free
We do not accept job or collab posts on discord.
Please use the forums:
• Commercial Job Seeking
• Commercial Job Offering
• Non Commercial Collaboration
you are going to get nowhere if you just ask vague questions without putting in any real effort
They've been doing this for a few days straight lol
Maybe once they see it gets nowhere, they'll stop and ask more elaborate questions
could someone help me with innvenyoruy
<@&502884371011731486> spam
i was getting DMs from him too when i asked for help earlier :/
uh oh!
Yeah they've been warned before, seems like they can't behave properly
oh hm
dude legit has like no people xp
private void AlignGodRaysWithLight()
{
lightRotationY = directionalLight.transform.rotation.eulerAngles.y;
lightRotationX = directionalLight.transform.rotation.eulerAngles.x;
var main = godRays.main;
main.startRotationY = lightRotationY * Mathf.Deg2Rad;
main.startRotationX = lightRotationX * Mathf.Deg2Rad;
Debug.Log("Light Rotation (Y): " + lightRotationY);
Debug.Log("Light Rotation (X): " + lightRotationX);
}``` how do i correctly convert the angles of my light to the radiants the startrotation needs?
are you aiming a particle system here?
namespace UnityEditor.Extension
{
public class X
{
...
}
}
If extend a class to the UnityEditor.Extension like the above example, will it only work for editor or do i need to wrap with symbols?
I don't think the namespace affects anything.
Putting it in an Editor folder would prevent it from being included in the built game, though.
#archived-works-in-progress message for this system, i want to set the rotation of my rays ( for which i need the 3d start rotation ) to match the rotation of my directional lighting
This class will be used in runtime as a component (like a information class that is serializable) this is why i did that 😦
i'm confused, then: why are you asking if it'll only work in the editor?
the code works and im changing the values. but cant get the correct angle
i'm not very familiar with getting specific rotations from particle systems
perhaps they're in the wrong space?
i.e. those rotations are relative to the particle system's transform
I needed to show some information about a runtime class and i wrap these informations into a serializable class that way i could be a little organized.
We cannot dragNdrop a component from editor folder and we cannot use a class that is from editor folder inside a runtime class. That is why i did that...
I could have done a simple EditorGUI script
I still do not understand. If this is not supposed to be an editor-only script, then don't make it editor-only. That's all.
Am I missing something here?
with how ive set up the renderer the transform of the particle system does not influence the rotation of the rays. afaik i can only change their directions with the 3dstartrotation
Maybe you are right i shouldn't have done this
Hey guys I have a question, I had a problem with remote configuration, so I asked for help in "unity gaming services", sadly nobody has answered because usually almost nobody looks at that channel.
Is it ok if I ask the same question in a channel where there are more people?
I'm talking about asking the question in a programming channel and not in the UGM.
https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-startRotationY.html according to the docs i need radians for those values. if i have x = 130 and y = 130 in the inspector for my directional light. what radians correspond to those values?
I would do it if i had done so much research and found a result of none
is anyone well versed in diagonal rotation? Like Quaternion.LookRotation(transform.forward + -transform.right, Vector3.up) where you look at that specific direction when two keys are pressed? I'm having difficulty registering that data as the look at point/direction
There is a deg to radians function
The conversion here is correct.
Oh they already use it
I have been searching for an answer for like 4 or 5 days, the issue is that most tutorials are from more than 2 years ago and recently the plugin has updated so even if I follow the tutorial I never get the result that I want
I wonder if the particles need to have a rotation offset
Try setting the start rotation to all zeroes and seeing what you get
Does it line up with the direction that the light source is at with an all-zero rotation?
already tried that, i think im going to calc myself what x= 130 and y = 130 should be in radians and see how much of an offset i have
was it correct?
i tried my own values there aswell as set them all to 0, but they just get overwritten by the script ( as should happen)
? How can I make a script that rotates the camera (Right and left ) in the direction the player moves in ?
hello, i would like to ask if there is a script that can bake, or apply transform to a gameobject
i did that in blender but for some reason the values changed in unity
I would like to get your idea on this.
I have 2 class that belongs to a base interface. Lets say its ClassA : BaseInterface and ClassB : BaseInterface
I created a PropertyDrawer for the BaseInterface so that way i will need only one property drawer that handles everything.
This two classes will have same editor-only fields that will be informations about that class.
Ex: its name, age etc... But it is not defined in every class so i just learned some editor tricks to manage the null references so it wont show if it does not defined.
The information will be editor only. It wont be used in Runtime. Information can be made from 3-4 or more fields which means i need to write to every class since i cant use abstraction it breaks the dependency of eachother.
So i thought about creating an editor-only class that will be information for these classes.
Should i go without an editor-only class? Sorry if its too dumb 
This question is very unclear what you're trying to do, I assume your mesh is offset from where you want it. This should be solved in blender
sorry lemme explain a bit more:
the gameobject is a bone, which the scale is 1,1,1 in blender
after i did some parenting of the bone to another armature in unity, the scale became 0.01,0.01,0.01, while the parent bone is 1,1,1
as the mesh is skinned, changing the values deformed the meshes as well.
i want to head bone to become scale 1,1,1 while keeping the mesh intact, similar to blender's apply pose to rest pose
ive set both the x and y of my lights to 130, i did some testing and need about a radiant of 50 for both x and y to get the correct angle, but my formula with the euler angles outputs 50 and 310 for the y? @swift crag
then are the docs not correct? if i input lower numbers there they basically dont move
the UI shows you the values in degrees, for sure.
this might be a long shot but try exporting your objects with transform applied (in blender). that 0.01 indicates to me that something was scaled up x100 which is something ive seen before if not exported correctly
this is more of a model issue than unity/code
try switching this to "FBX All". I am very fuzzy on how these different scaling modes work, but that's the one I default to
and it results in armatures with a 1,1,1 scale
now that you mentioned it yea i think i forgot to apply transform for the root empty 😭
only did to the armature and mesh
strange that it did not affect other bones however
ok so blender is totally my field, that being said animations are not, but these are my blender export settings for unity if it helps with anything
make sure to select all the objects you want to export
and you can save the settings as a preset for future use if it works well
I want to instantiate a prefab for a little sphere entity that changes size. What's the best way to pass a value to a prefab you're instantiating with code? I just want to pass a single float.
I think I can do GetComponent<Orb>().SetRateOfChange(5) or something,
but that seems a bit inefficent
uh you could create a constructor for the class that takes a float as a parameter I think
If the prefab field is of type Orb then you don't need the GetComponent. And you don't need a setter method if the variable is public. Otherwise that's the way to do it.
real!
MonoBehaviours can't have constructors
I forgot that was a thing
just redid and it works like a charm! thanks for the ideas
Hello everyone, i need help to make portals in URP. I tried to follow first Sebastian Lague's tutorial but i don't know how convert Portal camera rendering things from built-in to URP, so suddenly i followed Daniel Ilett's tutorial but i don't know how convert RenderSingleCamera method now that it's deprecated.
Cinemachine doesn't have anything to do with videos. https://docs.unity3d.com/Manual/VideoPlayer.html
@swift cragi think i found the issue, i've fixed the y axis by adding a * -1 when i noticed that was inverted. problem now is that the x is inverted aswell and adding a * -1 there flips the y again 🤨
bro you have no idea how much I spent making portals work in URP
that being said
I still can't do portal recursion
private void AlignGodRaysWithLight()
{
lightRotationY = directionalLight.transform.rotation.eulerAngles.y;
lightRotationX = directionalLight.transform.rotation.eulerAngles.x;
var main = godRays.main;
main.startRotationY = lightRotationY * Mathf.Deg2Rad *-1;
main.startRotationX = lightRotationX * Mathf.Deg2Rad; // adding *-1 here flips the y again
Debug.Log("Light Rotation (Y): " + lightRotationY);
Debug.Log("Light Rotation (X): " + lightRotationX);
}```
quick question,
how can I both import this circle with proper transparency, and make it into a particle that always faces the camera?
this is a code channel
no, you are asking about importing assets and setting up a particle system
neither of these involve any code
can i code something to fix unity rn?
what does this mean?
Internal error. Probably not your fault.
looks like an editor error, if you aren't writing editor code you can clear the console
I can clear the error when I click on Clear, so there's nothing to worry about?
you can usually just ignore most editor errors if they have something to do with GUIUtility
Yes
anyone know why this line is giving me an error?
Assets\Scripts\Weapons\Melee Combat.cs(103,65): error CS0119: 'Camera' is a type, which is not valid in the given context
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code*
• JetBrains Rider
• Other/None
*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.
you should be getting a red underline
Ik i just tried to configure it but it didn't work
should I be using visual studio instead of visual studio code?
VSCode support changed, you need to install different packages
Redo the configuration guide to be up to date
Why is the terrain not setting the neighbors properly for the LODs, i don't know if there is something wrong in the code
foreach(KeyValuePair<string, GameObject> ChunkDictionary in Chunks)
{
string[] ChunkID = ChunkDictionary.Key.Split(",");
int ChunkX = int.Parse(ChunkID[0]);
int ChunkY = int.Parse(ChunkID[1]);
string TopKey = (ChunkX) + "," + (ChunkY + 1);
string RightKey = (ChunkX + 1) + "," + (ChunkY);
string LeftKey = (ChunkX - 1) + "," + (ChunkY + 1);
string BottomKey = (ChunkX) + "," + (ChunkY - 1);
GameObject ChunkTop = null;
GameObject ChunkRight = null;
GameObject ChunkLeft = null;
GameObject ChunkBottom = null;
Terrain ChunkTopTerrain = null;
Terrain ChunkRightTerrain = null;
Terrain ChunkLeftTerrain = null;
Terrain ChunkBottomTerrain = null;
Chunks.TryGetValue(TopKey, out ChunkTop);
Chunks.TryGetValue(RightKey, out ChunkRight);
Chunks.TryGetValue(LeftKey, out ChunkLeft);
Chunks.TryGetValue(BottomKey, out ChunkBottom);
if (ChunkTop != null)
{
ChunkTopTerrain = ChunkTop.GetComponent<Terrain>();
}
if (ChunkRight != null)
{
ChunkRightTerrain = ChunkRight.GetComponent<Terrain>();
}
if (ChunkLeft != null)
{
ChunkLeftTerrain = ChunkLeft.GetComponent<Terrain>();
}
if (ChunkBottom != null)
{
ChunkBottomTerrain = ChunkBottom.GetComponent<Terrain>();
}
GameObject Chunk = ChunkDictionary.Value;
Terrain terrain = Chunk.GetComponent<Terrain>();
terrain.SetNeighbors(ChunkLeftTerrain, ChunkTopTerrain, ChunkRightTerrain, ChunkBottomTerrain);
terrain.Flush();
}
jetbrains rider dll error???
gg
this script is so messy, what can i do to make it shorter but work similar
https://hastebin.skyra.pw/ujedazofih.pgsql
Simple improvement is to make a class for your hunger and thirst since they share the same logic
That's a terrible name
why
sounds like a method
It doesn't remove as much repetition
and you're going to end up with a function signature like HandleVitals(ref float current, float max, Slider slider, Vector2 interval, ref float timer)
hi everyone - so a normalized vector will haul a vector back to magnitude one, but if the vector is LESS than one, it doesn't seem to push it up to one
is there something that will take a vector and always set its magnitude to 1?
vector3
It does
The only edge case where it does not set the magnitude to 1, is if you normalize a zero-vector like Vector3.zero
Try, Debug.Log(new Vector3(0.2f, 0.2f).normalized) and you'll see it returns something like (0.707, 0.707, 0) which is a normalized vector
Not a code question, but why do you want to do that? You can edit a lot of stuff throught the import settings
thanks @short hazel i've solved my issue, i only wanted x and z affected, if it zap y before normalizing then I do get the vector i want
I've been having issues with the second raycast, anyone know (from what I'm showing) if I'm doing something improper?
Maybe tell us the issue
not detecting even when I stand right in front and click on an object in the otherPlayer's layermask
Yeah so the second one is gonna be on a different layermask, but I was having issues so I changed the layermask as part of the debugging process. Right now, I was testing the coesmeticAttackResult raycasthit variable
they both works when i punch other players (who are marked in the otherPlayer layer), they do not work when I hit a cube marked in the same layer
If the only difference is a change in layer, make sure the layer is correct. Log the layer etc
You're probably better off showing the actual code that isn't working, the inspector setup, hierarchy, logs etc
this is my code for my weapon to aim where my mouse hit the ground, keep in mind the weapon is a child of the player
i want to make it so that it only changes the X rotation value, leaving the y,z of same previous rotation, how can i do that?
Maybe modify the direction vector to have the same y and z values as your forward direction
weapon have default 0,90,90 rotation, x is what tilte it left and right (top down 3d game)
how?
How what? What are you not certain of?
what you suggested
Either flatten the vector by setting Y and Z to 0, then by assigning to .localRotation
Or flatten the vector by projecting it using Vector3.ProjectOnPlane(dir, transform.up) so it's flat towards where you're looking, and assign to .rotation like you're doing
I talked with Chatgbt and talked with it about some fixes it need to do, what you all all think of the falling platform, is there something it need to be fixed or adjusted?
Sometimes they don't fall or respawn too fast
Sometimes they don't fall or respawn too fast?, that sentence got me confused
looks like there are some bugs
like when you jump up again, the first 3 don't fall after you step on them
uhhh... even though it did show the falling red color?
Yeah
9 seconds into the video
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
public float moveSpeed;
public float jumpForce;
public float gravityScale;
public float maxFallSpeed;
public bool candash = false;
public bool isGrounded=false;
public CharacterController controller;
private Vector3 moveDirection;
void Start()
{
controller = GetComponent<CharacterController>();
}
void Update()
{
isGrounded = controller.isGrounded;
if (controller.isGrounded)
{
}
//moveDirection = new Vector3(Input.GetAxis("Horizontal") * moveSpeed, moveDirection.y, Input.GetAxis("Vertical") * moveSpeed);
float ystore = moveDirection.y;
moveDirection = (transform.forward * Input.GetAxisRaw("Vertical") * moveSpeed) + (transform.right * Input.GetAxisRaw("Horizontal") * moveSpeed);
moveDirection = moveDirection.normalized * moveSpeed;
moveDirection.y = ystore;
if (controller.isGrounded)
{
moveDirection.y = 0;
if (Input.GetButtonDown("Jump"))
{
moveDirection.y = jumpForce;
}
}
else
{
if(moveDirection.y>-maxFallSpeed)
{
moveDirection.y -= gravityScale;
}
}
controller.Move(moveDirection * Time.deltaTime);
}
}
im making a 3d movement engine, and for some reason the isGrounded boolean on the character controller keeps flashing on and off, despite the y value never changing
worked, thank you
oh, then should I show the script?
AI generated code is not allowed in this server
but you should probably fix it
ok
nevermind i fixed it
i changed moveDirection.y = 0; to moveDirection.y = -1;
Could someone explain how the collision effect matrix effects raycasts?
does a raycast belong to the layer it hits?
You determine the layers you raycast on
If you don't determine any, it will probably hit everything
well that would be the layermask, but I was wondering more the impact the collision matrix has on the raycast
can a transform's position not be set to something else if it is moving while being set?
Yeah, the layermask is what impacts the raycast. Otherwise it hits all layers.
Except the IgnoreRaycast layer I guess
It can be
weird
Setting transform is just teleporting an object essentially. Whether it is small segements or large
{
if (other.gameObject.tag == "Player")
{
rangeCollider.enabled = false;
playerT.transform.position = playerBC.transform.position;
enemyT.transform.position = enemyBC.transform.position;
Debug.Log("Enemy Triggered");
}
}```this is what I have right now but its not teleporting the player as it does the enemy
yeah, perhaps I'm misunderstanding, but my question is does the layer collision matrix also affect which layers the raycast can hit in tandem with the layermask?
No
Ok, thank you
Other than the IgnoreRaycast layer maybe, but I've never used it. So I dunno if that is just for a user to implement haha
Is the debug showing in the console?
yeah, the enemy is meant to be teleported at the same time as the player
im wondering if its because of my movement script
Ah, so only the enemy is. Gotcha
yeah p much
im just using someone else's movement script because im just experimenting with stuff and i dont wanna write my own one right now
so im just wondering if its interfering somehow
If you are teleporting the player to a specific spot in the movement script (which is abnormal. Usually it is an offset), maybe. It could be overwriting it.
You should add the playerBC position and playerT position in the debug too
playerBC is just a transform that holds the coords of where the player is to be teleported to
playerT is the player's transform
No yeah, I got that. Those are the most likely things they could have been. Still log their positions
👍
playerT doesn't move on trigger
neither does playerBC
im gonna try something
ahh i knew it
right before i teleported the player I disabled the movement script
it seems the character controller overrides a teleport, maybe because even though your coords have changed, the character controller was moving you towards a different coordinate and the teleport gets overriden
What fundamentals should I learn in C# before hopping into unity
I have never used C# before though i have used GDScript and python before a bit
idk why put when i type i code it doesnt work as the tut said
Nobody can help if you don't elaborate
i dont get it?
please help me, I am using LootLocker SDK
OH MY FUCKING GOD THE TIMESCALE WAS STILL )
0
IM FUCKING RETARDED

that was like 30 minutes of my game jam
cvxc,m
Just to clarify what Vertx meant, and I say this to be helpful:
No one can help with the tiny amount of information you provided, you need to provide more for anyone to be able to help you. You can include code, or a more thorough description. What you said is so vague it is nearly meaningless. The code you're talking about could be ANYTHING, and any of those things could have dozens of reasons it doesn't work. It is impossible to even start to respond
This channel can help you know what to include in a question. At the top is the section for asking
https://discord.com/channels/489222168727519232/854851968446365696
Hey i having a problem with making the score system and reset game for tron
Gonna need some more info
!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.
So i was trying make a score system where everytime they collider to the wall or collider to the player wall, the game would give the user the score and would reset the player back to it position but it not working right i tried looking up links but i can't find any of it.
my public tmpro wont let me actually put it there
did i declare the wrong namespace in the beginning?
lines 1, 24, and 60
its TextMeshProUGUI
anyone free to help?
I'm working on a 2D project and my randomly wandering AIs keep going through the walls in spite of the colliders. any ideas what might be going on there and how to fix it?
Someone probably is, just follow this:
#💻┃code-beginner message
!cs
!cs error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
!learn
🧑🏫 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/
Ok, sounds like an easy fix. Show the code causing the error.
Gotta show code
Hi, I have CollectableChoice.cs and ManageMaterials.cs:
namespace HyperCasualRunner
{
public class CollectableChoice : MonoBehaviour
{
private void Start()
{
TestNameSpace.ManageMaterials.GetInstance();
}
}
}```
and
```using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyAttributes;
namespace TestNameSpace
{
public class ManageMaterials : MonoBehaviour
{
public Material TransparentGreen;
public Material TransparentRed;
static ManageMaterials instance;
public static ManageMaterials GetInstance()
{
return instance;
}
private void Awake()
{
instance = this;
}
}
}```
My error is that TestNameSpace and ManageMaterials can't be found, therefor the line "TestNameSpace.ManageMaterials.GetInstance();" in CollectableChoice.cs throws and error.
ok
@summer stump
what is it
how can i do that?
You're following a tutorial, look at it and compare
You put semicolons there. Remove them
The tutorial did NOT put them there
i am following a brackyes tut
Also, if your IDE is not underlining errors and giving proper autocomplete you need to configure it
If your IDE is not autocompleting code
or underlining errors, please configure it:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code*
• JetBrains Rider
• Other/None
*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.
Yep, they are not there
Remove the semicolons
Compare that to this:
#💻┃code-beginner message
Also, brackey is infamous for bad habits like adding deltaTime to mouse input
Wait, no
You need to configure your IDE
If your IDE is not autocompleting code
or underlining errors, please configure it:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code*
• JetBrains Rider
• Other/None
*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.
which semiclonse
These ones
oke
You need to configure your IDE. Then you need to compare with the tutorial you have that will work.
You still need to configure your IDE before doing any more programming
@queen adder
The bot told you
#💻┃code-beginner message
ok
Btw are namespace problems like this #💻┃code-beginner or #archived-code-general ?
Why are you using namespaces at all? Are they needed in Unity? 
Namespaces are a good practice in any coding scenario
I have no idea what the issue is, the code looks fine
Who will tell you a video on movement a character in 3d isometric using a new input controller?
Maybe they're using assembly definitions incorrectly?
I imported an extenstion from the unity asset store that used these namespaces
Google I guess. Are you asking for one or posing philosophical ponderings?
why one bro has random symbol generator as their name and another speaks in puzzles
I'm asking what you can offer me?
The error is pretty weird, I can't even do "using TestNameSpace;" in CollectableCoin.cs because that throws an error too.
i finished the ide tut
There are tons of new input tutorials out there. Any of them are generic enough to work in your situation
Don't try to find a specific one and you'll be fine
Are they in similar locations in the project, or is one in the plugin youre talking about?
I only find videos with an old input
If you have the words "new input" in your search, you will find it.
I promise you there are tons
Edit:
https://duckduckgo.com/?q=new input unity tutorial&ko=-1&ia=web
I don't see a single old input one on the page
Let me check real quick
isometric?
One is under Assets, the other is under Assets\HyperCasualRunner\Scripts
And in HyperCasualRunner or HyperCasualRunner\Scripts is there an Assembly Definition file?
There is an Assembly Definition Asset, if you mean that
Are we talking about the new input system that is there for 5 years? 
and one assembly isn't referencing the other
As I said, don't be specific. It is irrelevant whether it is isometric or not. You are just capturing inputs. Learn new input first, then learn how to process ANY input in an isometric game. Processing the input will be the same in the new and old system.
does anyone have a youtube tutoral or something to help me get started with game develpment and just get the basics down
Oh ok, do you happen to know how I can fix this?
Yes, that is unfortunately how it is referred to (even sort of in unity's settings, calling one old, and the other system). I do wish it had a better name difference. But if you're researching it, calling it new input is a safe bet for finding resources
If you don't need to put the scripts under the assembly definition, don't. If you do, then it gets complicated https://unity.huh.how/compiler-errors/cs0246-assembly-definitions
Ok perfect, I'll just try to avoid using the assembly definition, thanks a lot for the help 🙂
ok so the code is working perfectly but i cant turn my mouse right niether left
Could be a few reasons. Show the updated !code (what you did earlier only shows a download link for me on my phone. It's only viewable in discord on the desktop app)
📃 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.
anyone have a good guide on rendering 3d object in ui? like an inventory of items?
What kind of phone do you have it shows you a download link instead of a screenshot? 
Unless the object needs to be rotating or something, create a PNG sprite from the prefab and just use that
for all 300 items?
Not the screenshots. I can see that.
This
#💻┃code-beginner message
Pretty sure all phones do that. It's just how the discord app works
I wrote an editor script to automate creating the pngs for one of my games
It will be vastly more performant anyway
Oh, yeah, it's a .cs file that needs to be downloaded on phone but works fine on PC
So it's worth it for that reason alone
Yep
oh, that is super useful! guess ill have to find a guide to create a png with editor scripts
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class MouseController : MonoBehaviour
{
public float mouseSenstivity = 100f;
public Transform PlayerBody;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis("Mouse X"); * mouseSenstivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y"); * mouseSenstivity * Time.deltaTime;
PlayerBody.Rotate(Vector3.up * mouseX);
}
}
```its content
That isn't the updated code. I was asking for the new one after the changes they made
It should be only one change, but who knows
Edit: I do appreciate the assist though!
Alright
Seeing this error: InvalidCastException: Specified cast is not valid.
The code:
foreach (CardHolder holder in HandHolderHolder.transform) { if (holder.owner == GetActiveCharacter()) { holder.gameObject.SetActive(true); } else { holder.gameObject.SetActive(false); } }
I thought I could do a foreach on a transform and it would be the children?
It can only be Transform, you can't foreach component children like that
so:
foreach (Transform holder in HandHolderHolder.transform) { if (holder.GetComponent<CardHolder>().owner == GetActiveCharacter()) { holder.gameObject.SetActive(true); } else { holder.gameObject.SetActive(false); } }
Yes, if the children all have the CardHolder component that should work
Even if it's going to work this would be performance expensive
is there a better way of grabbing data from each child?
Probably already have a list of your CardHolder instances and iterate through that list
that way you access your list instead of getting CardHolder component each iteration
Something like List<CardHolder> cardsHolderList = new(); and in your CardHolder class use OnEnable() and OnDisable() methods to add itself to that list
But that's optimization matter, if your script is going to work and not iterate a lot then should be fine anyway
Depends how many iterations or if it's a mobile project or PC
at most we're talking single digits, each of these holders represent 1 party member
it's a worthwhile concern though and I'm glad you mentioned it to me!
thanks for the help!
you're welcome
unrelated, ocassionally I see this error:
ArgumentNullException: Value cannot be null. Parameter name: _unity_self UnityEditor.SerializedObject.FindProperty (System.String propertyPath) (at <fe7039efe678478d9c83e73bc6a6566d>:0)
this is just Unity having trouble for no reason and is nothing to worry about, right?
As with any error if it's not originating from code you control it's more than likely just an editor bug that you can clear and ignore unless it's actually stopping you
I have this error present since forever, I couldn't get rid of it but my scripts work anyway 
should not be capturing when there is hot control 
is there some known weirdness for when something is instantiated already colliding with an object in 2d and the collision isn't reported?
Having trouble with some 2d collision. the code is really barebones:
void OnCollisionEnter2D( Collision2D other ) { if (other.gameObject.tag == "CardHolder") { // we are back! print("card zone"); } }
am I missing something really obvious?
oh whoops I think it's the trigger checkbox
nvm yep that was it, sorry about that
how do you check if code is being run in edit mode ? since i need to either use Destroy() or DestroyImmediate() depending on context
i am having an issue while building the game ,it show Grade Build Failed .
any solution for this i am trying for many days but nothing works
Hello! I am using github with unity to have two people working on one project, I just tried to do a commit but it said I was unable to as it was over the 100MB limit, what should I do to fix this issue?
I would like to ask if there is a way to have the ScrollView's Content's size automatically adjust according to the size of the sub-objects without using any LayoutGroup? Although LayoutGroup+ContentSize solves the problem, I don't want to have the LayoutGroup automatically resize the sub-objects
will i show u the error of Gradle Build Failed
layout group has a "child controls size" options that you can tick
Install git lfs in the repo
void GenerateMesh(GenerationSettings settings)
{
terrainGameObjects = new GameObject[settings.mapSizeSquared];
terrainMeshes = new Mesh[settings.mapSizeSquared];
vertices = new Vector3[(settings.chunkSize + 1) * (settings.chunkSize + 1)];
var offset = new Vector3();
for (int chunk = 0; chunk <= (int)settings.mapSizeSquared; chunk++)
{
offset = new Vector3((int)settings.map_size * chunk, 0, (int)settings.map_size * chunk);
for (int i = 0, z = 0; z <= settings.chunkSize; z++)
{
for (int x = 0; x <= settings.chunkSize; x++)
{
vertices[i] = new Vector3(x, 0, z) + offset;
i++;
}
}
triangles = new int[settings.chunkSize * settings.chunkSize * 6];
int vert = 0;
int tris = 0;
for (int z = 0; z < settings.chunkSize; z++)
{
for (int x = 0; x < settings.chunkSize; x++)
{
triangles[tris + 0] = vert + 0;
triangles[tris + 1] = vert + settings.chunkSize + 1;
triangles[tris + 2] = vert + 1;
triangles[tris + 3] = vert + 1;
triangles[tris + 4] = vert + settings.chunkSize + 1;
triangles[tris + 5] = vert + settings.chunkSize + 2;
vert++;
tris += 6;
}
vert++;
}
terrainGameObjects[chunk].AddComponent<MeshFilter>();
terrainGameObjects[chunk].GetComponent<MeshFilter>().mesh = terrainMeshes[chunk];
terrainMeshes[chunk].Clear();
terrainMeshes[chunk].vertices = vertices;
terrainMeshes[chunk].triangles = triangles;
terrainMeshes[chunk].RecalculateNormals();
}
}```
Not sure if I am going crazy or not, but I am getting a Object ref not set to instance of object on the "terrainGameObjects[chunk].AddComponent<MeshFilter>();" line. Am I doing something wrong?
well did you check if anything on that line is null?
you can use the debugger to step through and see values
When I checked with breakpoints nothing was
you're sure it's on that line?
I'll double check to make sure I didn't missing something tho
Thats what the console is telling me, but im not sure anymore
clear console, save all scripts, then try again
yeah im not sure ngl
I'm checking everything and there isn't one thing that is coming up null
Nothing on that line or anywhere else
oh you know what
I see my issue
The items in the index are null, but the index itself isnt
array *
how can I make a multicolor slider
showing this error whule building the game
Top one says configure project, it will probably say what's wrong. Normally a gradle error means you haven't setup your Android SDK in the Hub.
#📱┃mobile has a bunch of other people with the same error.
yo guys , i have one doubt so i have these 98 spheres and they have 1 script attached to them which is common to all. Now there is an array of size 98 in which i want to insert these prefabs but due to unity limitations i cant do that so is there any way that when i add prefabs to any one object it will get updated in the script to all the other objects?
i think you need to know what is static variable
if you want every object have an array that reference to other gameobjects consider fill one first then copy the array to others
or findobjectswithtag
is it normal for the void OnTriggerStay2D to be getting triggered when a child game object collides with something instead of just the gameobject that has the script witht that void?
if so how do I avoid it? I want it to only check the collisions of the gameobject that has the script
Not entirely sure but I believe it happens when you have a Rigidbody2D
then all collisions on child objects get "transfered" to the parent that has the rigidbody
You could probably avoid that by adding a rigidbody to the child
Hello. I'm just wondering how I can set a textmeshpro to only allow 4 characters at max. I'm doing a 4 digit keypad and at the moment, I can keep writing which will just overlap and look a mess. How do I prevent this?
just make a script with a reference to the textmeshpro component
and check if the text is the correct size
otherwise cut to 4
excuse me, could you help me? I don't understand why the door doesn't open
https://pastebin.com/1Ce1xhKw
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
currentY = Mathf.Lerp(rot.x, openY, 0.05f);
Shouldn't that be rot.y ?
Or currentY as in the CloseRoutine
Also
You're not assigning the new rotation to anything
You're just assigning it to the local variable newRot
Not to the actual door rotation
No wonder it doesn't rotate if you do not change it's rotation and just calculate it
You also don't need to type gameObject.transform
just transform is enough
and the if else in Toggle() could be changed for a ternary operation
StartCoroutine(open
? OpenRoutine()
: CloseRoutine());
or in 1 line if you prefer that
Oh yes! beginner errors, I didn't notice that I wasn't assigning the new rotation, so it should be: transform.localRotation = Quaternion.Euler(rot.x, currentY, rot.z);
right?
Also when exiting the while loop make sure to assign the rotation to the open/close rotation exactly
try it
Should work
coulda just use animator
btw im not at pc but u can use ternary operator like that? lol
That's also a way to do it ^
Yeah, why couldn't you?
As long as it doesn't return void
It has to be an assignment
You're assigning a method param
lol cool never thought about that 
I tried with the animation, but I didn't like the final effect, when the door was opening and I closed it, the animation finished its cycle first, so it opened completely and then closed
Seems just like a bad setup
If you want to have it close immediately then just change the transition between animations to immediate so it won't wait for the other one to finish
Unless you want to close it from any point of the rotation
Then that's beyond me, I'm not that into animations, but I believe it also should be possible
Unless you had just one animation and changed it's speed to negative
Yes, this was the flaw, closing the door at any point in the rotation
it works, even if the door opens too quickly
Oh, yeah, you should set up a time instead of checking the current rotation
and base the Lerp around the time progress instead
for (float t = 0; t < ANIMATION_TIME; t += Time.deltaTime)
{
float progress = t / ANIMATION_TIME;
float currentY = Mathf.Lerp(startY, endY, progress);
transform.localRotation = ...;
yield return null;
}
transform.localRotation = endRotation;
Yeah, I now see how it could be done via the animator
Be it even with 2 separate animations
Two animations of one keyframe, one for the open position, and the other for the closed position. The open/close duration being the animation transition time
how would u do that
My message describes it
you cant spam the animation then
lol
with the door for example
With transition interruptions yes
make it stuck midway
what would happen it would teleport
to keyframe and then animate
just control the animations played via code
setting the normalized time (progress) of the animation to what you need
Might as well just not use animations if it's just rotating around a pivot point lol
So for example, if the closing animations is 0.75 done, then play the open animation from 0.25
1 - currentProgress
aaaa might work
actually I kinda want it too now so asking
like if it was at frame 7 of opening but now im closing it it would go from that frame 7 back to 0
if the animation is "linear" (so no ease-in/out, etc) then simply 1 animation + messing with the speed would have the same effect
speed: 1 (open), -1 (close)
Hello guys a quick question
From where do you guys normally learn unity and c# for it?
Unity Learn
!learn
🧑🏫 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/
I'd advise learning C# alone first, then moving on to Unity
But if you do not know C#, then start with C#
Either a book or an online course/tutorial, whatever suits you
A supportive community for Blender artists of all levels. Share your work, ask for help, and learn from others! https://discord.com/invite/blender
ok, for the opening I solved it, for the closing however it doesn't close
https://pastebin.com/1Ce1xhKw
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Code in both coroutines is identical, that's why
You need to have a closeY variable and go towards that instead of openY in the closing coroutine
I thought it took the calculation on the y axis directly! , I solved it, thank you very much!
Hey I'm looking for some help. I want my player to be able to look at a wall/big box, and make a hole in it by shooting their gun essentially. It has to be just big enough for them to enter, which is my problem. The solution seems like creating two meshes, one with a hole and one without, but the problem with that is that I want it to be dynamic, so it can be placed on any valid wall/surface. Is there any way to 'delete' the space? Another solution for me would be to allow the user to pass through space that is occupied by two objects, one of which is passable because it is set to IsTrigger, and the other isn't passable. When these two objects are overlapping, is there a way I could make that space passable?
just so you know that isn't exactly an easy task. you'll likely need to modify the mesh's vertices and its collider. you could probably find an asset for something like that on the asset store or github or something if you don't want to take the time to learn how to manipulate meshes yourself.
Ok thanks. Does the second solution sound easier? To me it seems like it should be doable (although obviously I dont know anything), I just can't find any solution online. To give context, what I'm doing is making portals that are basically the same as in Valve's portal game. I want to give the illusion that the player is actually 'walking' into the portal instead of being teleported as soon as they collide with it. So they need to be able to walk right up to the walls when there is a portal.
there's very likely a better way of handling that, and i'd recommend reading up on it. proper portals like that take a lot of work and just cutting into the mesh that the portal is attached to won't solve most of the issues you'd have with it
a betatester showed me this and I also just noticed that like when I die and respawn this happens to the Devi enemies
is there a question here?
when i play the game, everything was fine and the enemies are fine but when I killed the devi enemies and when i die and respawn and when their respawn, they begin to glitch out like that
please see #854851968446365696 for what to include when asking for help
and also keep in mind that nobody here has context for what your game is supposed to do versus what it isn't supposed to do. so until you describe what it means to "glitch out like that" and what they are actually supposed to be doing nobody can really guess at what the fix is
Have anyone tried comparing performance of 1000 Update() vs 1000 Coroutine yield return null; loops?
gimme a few and i'll test it with the performance testing package. i imaging the performance is going to be pretty similar though
what is performance testing package?
ah nvm, I suck at installing packages, gl testing 
oldest version of that also appears to require 2018+ so unless you've decided to modernize a bit you can't use it anyway
why microgames are not available in editor 2022.3.10f1 ?
probably the templates have not been updated. this is a code channel though
oh my bad
Did ya run the test. Im interested in the results. My bet is update being a tad bit faster
just got done actually
the X1K versions of the tests are running with 1000 objects each running either an Update or Coroutine. all i did in each test was increment a counter 1000 times in either Update or a Coroutine. the results, as expected, are very similar. with the coroutines having a higher max frame time likely due to the initial StartCoroutine call
@queen adder
also timing is in milliseconds
i should also note that this is per frame timing
wait would take a while to digest
is that 26.28 bad?
kinda get it now
so they're pretty to almost similar on the runtime
yep, very similar in performance
why is there such a gap between min and max for update if u do same thing each frame lol
this doesn't account for memory impact though, which i'm sure the coroutine would have a higher impact due to the number of IEnumerator instances created
what if you have designed a coroutine loop that is purposed to run whole game?
My Camera is rotated by 45 Degrees, and, I am trying to rotate the controller input properly to account for that. Whats the easiest way to handle that?
will memory problem will be a matter of problem in that case?
Currently I have this, but it doesn't seem to be correct.
if (isController) {
if (Camera.main == null) return;
float radians = Camera.main.transform.localEulerAngles.y * Mathf.Deg2Rad;
Vector2 offset = new Vector2(Mathf.Sin(radians), Mathf.Cos(radians));
inContext += offset;
}
probably just whatever unity does on the first frame since those max times are pretty much all the first frame.
or it's also possibly (but unlikely) the jitter doing things since i didn't include any warmup on this
Thats actually funny that someone else asked that recently. Cheers. I'll take a peak.
a single coroutine will have less of a memory impact than 1000, yes. if you have actual performance concerns for how your game is set up though, use the profiler. this performance test is far from a real world example and should really only be taken as "the performance between a coroutine doing something versus update doing the exact same thing is very similar so choose whichever suits your needs best"
But still if you plan to have 1000 updates or coroutines I suggest you read this https://blog.unity.com/engine-platform/10000-update-calls
static bool IsCursorOverButton(Bounds customButton)
{
// Convert cursor position to world coordinates
Vector2 screenPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Vector3 mousePosition = UICamera.mainCamera.ScreenToWorldPoint(screenPosition);
Console.WriteLine($"mousePosition:" + mousePosition.ToString());
Console.WriteLine($"customButton:" + customButton.ToString());
mousePosition.z = 0; // Ensure the z-coordinate is 0 (2D space)
return customButton.Contains(new Vector2(mousePosition.x, mousePosition.y));
}
if (IsCursorOverButton(uiButton))
{
Console.WriteLine("IsCursorOverButton(uiButton)");
}
mousePosition:(0.61, -0.48, 0.00)
customButton:Center: (0.12, -0.52, 0.00), Extents: (0.19, 0.20, 0.00)
IsCursorOverButton(uiButton)
How is this possible?
How is what possible?
How is mouse position within the bound
Dose anyone knows why my gyroscope dosen't work on the Android Build,even that I get the SystemInfo.supportsGyroscope as true.
The amazing part is that when i connect the phone to the pc and I use Unity Remote to test it,it works fine
why this error coming whenever i am trying to interact with terrain and i can't edit the terrain
no where within the range to me
Your first editor error! There will be many more. Usually they don't affect anything so you can ignore them, but here since you cannot edit the terrain, restart Unity and that should fix it
and this
Does anybody have an idea on how to make an infinite generation map for a 2D game?
Sure, use noise functions like any other game that has infinite generation.
I liked this one about MineCraft and how it does generation + props: https://www.youtube.com/watch?v=CSa5O6knuwI
It's 3d, but you can just skip the third dimension, the idea is the same.
Read up on noise functions, wave function collapse, chunking systems, streaming systems
Seeded generation is also something useful
I was just thinking about Minecraft, thanks for the link
Im guessing perlin noise coutns as noise functions and ive learned that before, not really sure about the rest doe, but i'll try to look it up thanks!
It definitely does count yes. In fact I will say you cant have procedural map generation without it
I was also wondering if anybody have an idea on how to load and unload chunks of the map just like in Minecraft aswell
Hi. Does anyone know if there's a way to make a heavy function like run in the background please? Like, having a function that is kinda demanding and be able to run it without the whole game just freezing please
@tacit forge you around mate?
Can't sent you a private message regarding your post on the forum.
Async
okay thanks
What are you trying to do?
Careful with async it's not always the best option
load a whole terrain from an image and set it as a heightmap of a terrain
Yeah so async is made for that
Load then make sure your game state don't do stuff with the resource before it's loaded
so like a wait until?
Yep
If your systems need the heightmap if you don't wait for the resource to be loaded... Welp, not gonna work
makes sense. Thanks
Sounds obvious but double check that 😊
yeah
static bool IsCursorOverButton(Bounds customButton)
{
// Convert cursor position to world coordinates
Vector2 screenPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Vector3 mousePosition = UICamera.mainCamera.ScreenToWorldPoint(screenPosition);
Console.WriteLine($"mousePosition:" + mousePosition.ToString());
Console.WriteLine($"customButton:" + customButton.ToString());
mousePosition.z = 0; // Ensure the z-coordinate is 0 (2D space)
return customButton.Contains(new Vector2(mousePosition.x, mousePosition.y));
}
if (IsCursorOverButton(uiButton))
{
Console.WriteLine("IsCursorOverButton(uiButton)");
}
mousePosition:(0.61, -0.48, 0.00)
customButton:Center: (0.12, -0.52, 0.00), Extents: (0.19, 0.20, 0.00)
IsCursorOverButton(uiButton)
How is this possible?
What are we looking at here?
Hi. This is an extremely newbie question. I'm just trying to get my player to debug a message whenever it collides with a new tag. I've tried all sorts and spent hours looking and I'm getting 0 progress. i'm using the OnCollisionEnter method
show what you tried
u can go thru this as well
https://unity.huh.how/physics-messages
ok and what is this printing?
Just to tell me what object I'm colliding with then I can start coding
that's not an answer
what is this code printing?
It's not a quiz
I'm asking you to run the game
and are u in 2D or 3D ?
and tell us what it's printing
anyone knows this issue when the gyroscope is working fine on the game mode with phone connected trough Unity Remote but it dosen't work on the apk build?
3D and the console is empty
alr I would suggest you follow the link I've sent first to start debugging it
on it now. Thank you
hello friends, I have a list of objects. I want the last element of it , comes up in order and be the first element, how to do that!?
You want to move the last element to the beginning?
exactly
YOu can do it but it's kinda slow. There may be better data structures to use if you want that.
what do you mean?
but
var last = myList[^1];
myList.RemoveAt(myList.Count - 1);
myList.Insert(0, last);```
When you do this every element in the list needs to be shifted over
it's an O(n) operation
it can be quite slow if you do this frequently
So I'm asking WHY you're doing this, because there might be a more efficient way to solve your problem
hmmm, I have a deck of cards and there is a button, by pressing that button I want the top card ( last element of the list) goes to the bottom of the deck (first element)
It would be faster if you use a LinkedList instead of a List
but LinkedLists are slower for many typical operations
is using shader graph to create a masked material possible? or does it require shader code (as I've only seen online)?
It seems like the mask functionality breaks when a shader graph (nodes) material is used.
Or is it possible to create a custom mask script that forces the editor to render the mask component with a material?
so it's a tradeoff
I am beginner , no idea 😅 but thanks
I dont understand the first line
It's just a short way to get the last element of the list
Debug.Log("not so supper egg");
GameManager.Instance.Late(() => Debug.Log("SUper egg"));
public IEnumerator Late(System.Action act)
{
Debug.Log("swd");
yield return null;
act?.Invoke();
}
```Why doesnt this work? what did i miss?
Instance exist and enabled
Missing StartCoroutine
oh..
I also don't recommend starting coroutines owned by other objects
It will end up confusing you about which object the coroutine is tied to
Make the coroutine itself private and make a public function that starts the coroutine
i just use it to make sure a coroutine shouldnt be cancelled for any reason
called like stopped
And if you do it the way you're doing it now, you will not achieve this goal
Because the coroutine will not run on the game manager this way
not even this mess? GameManager.Instance.StartCoroutine(GameManager.Instance.Late(() => save.AllItems = retrieved[4]));
yes that will work but:
- you have to always remember to do it that way
- it's ugly as sin
If you do this in the GameManager:
public void DoLater(System.Action act) {
StartCoroutine(Late(act));
}
private IEnumerator Late(System.Action act)
{
Debug.Log("swd");
yield return null;
act?.Invoke();
}```
Now you just need to write:
```cs
GameManager.Instance.DoLater(() => Debug.Log("SUper egg"));```
And it's impossible to mess it up because "Late" is private
that is neater yea imma do that
kinda works now thanks!
public void Late(YieldInstruction delay, System.Action act)
{
StartCoroutine(late(delay, act));
}
public void Late(System.Action act)
{
StartCoroutine(late(act));
}
public void Late(float time, System.Action act)
{
StartCoroutine(late(time, act));
}
IEnumerator late(YieldInstruction delay, System.Action act)
{
yield return delay;
act?.Invoke();
}
IEnumerator late(System.Action act)
{
Debug.Log("swd");
yield return null;
act?.Invoke();
}
IEnumerator late(float time, System.Action act)
{
yield return new WaitForSeconds(time);
act?.Invoke();
}```Here btw if anyone needs some mess concept
How do I have a Rigidbody's Rotation be linked to what direction it is going in?
I think you can do
Quaternion newRotation = Quaternion.LookRotation(rb.velocity.normalized);
rb.MoveRotation(newRotation);```
rb.rotation = newRotation
I think works too
mayb someone has a better way :p
Good to do what exactly
eh id use a raycast when grounded
i don't see how that code would check if the player lands on the ground at all
it's also unclear when you're running it
Hi, I'm using the Unity Figma Bridge for my UI workflow... https://github.com/simonoliver/UnityFigmaBridge, it generates UI elements from my figma projects. When it generates an element with an image, it uses its special class FigmaImage (https://github.com/simonoliver/UnityFigmaBridge/blob/main/UnityFigmaBridge/Runtime/UI/FigmaImage.cs), it inherits form the base Image class from the UntiyEngine.UI namespace. I need to reference this script to be able to set some special properties, but I can't find it anywhere, it's intellisense isn't even detecting its namespace UnityFigmaBridge.Runtime.UI... I've noticed that the extension is separated into 3 folders: Assets, Editor, Runtime, the script is in the Runtime folder, maybe this has something to do with it... Thank you guys in advance
there are so many 'its' in there I have no idea what you are actually missing
The FigmaImage component script
Regenerate project files and try again. Preferences > External Tools
I would also close and reopen the code editor.
Hello. I have watched a youtube tutorial about making a small 2d game for mobile where you need to dodge some boxes falling from the skies. Everything works fine, but the only problem I have is that the score is increasing after the box reaches the middle of the screen. Scoring should be updated after the box passes the player not while generating the box, how to do that ?
Yeah, no, it's not an omnisharp error, I even checked omnisharp logs
can I write the code here (in the thread) or is there a forum for questions?
missing .csproj files wouldn't be an "error"
it would be no different from using any type that your editor isn't aware of
sounds like you want to use a trigger collider
I can show you the code, if you want
when the box enters the collider, add a point
Hello I have watched a youtube tutorial
could you check my thread please? I am still new to unity, so idk how should I add that trigger collider
Yeah, I know. The things is, I don't think this the assembly was even supposed to be in my project, maybe it was only supposed to be used by the unity runtime and the editor. When I say error, I meant that that I checked and both omnisharp and mono were getting the same assemblies.
I'm not really aware of how unity handles its packages, but I guess I can always fork the package and try to move the script to the Assets directory...
I'll Try that Out
This will work well. The only caveat is that it'll roll rapidly when flying straight up or straight down
You could use the current transform.up as the "up" direction for the look rotation
Quaternion.LookRotation(rb.velocity, rb.transform.up);
The resulting rotation will be rolled so that the "up" direction (from the perspective of the rotation) is pointing that way
ok that might work
but I actually want the MODEL to be looking in the direction of the Velocity
bascially I tried this but the model is not rotating
show your code.
`` public class Movement : MonoBehaviour
{
public Rigidbody player;
private Vector3 playermovement;
public float movementspeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float x_axis = Input.GetAxis("Horizontal");
float z_axis = Input.GetAxis("Vertical");
float timer = movementspeed * Time.deltaTime;
playermovement = Vector3.right * x_axis * timer + Vector3.forward * z_axis * timer;
player.position = player.position + playermovement;
Quaternion newDirection = Quaternion.LookRotation(player.velocity.normalized, player.transform.up);
player.rotation = newDirection;
}
}``
📃 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.
{
public Rigidbody player;
private Vector3 playermovement;
public float movementspeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float x_axis = Input.GetAxis("Horizontal");
float z_axis = Input.GetAxis("Vertical");
float timer = movementspeed * Time.deltaTime;
playermovement = Vector3.right * x_axis * timer + Vector3.forward * z_axis * timer;
player.position = player.position + playermovement;
Quaternion newDirection = Quaternion.LookRotation(player.velocity.normalized, player.transform.up);
player.rotation = newDirection;
}
}```
did the original suggestion work?
i.e. just doing Quaternion.LookRotation(player.velocity.normalized)
Ill check
nope its still the same rotation
Though I think the Look Rotation Vector is 0 thing might relate to it
internet died.
you are setting the position directly
so you have no velocity
you can use the playermovement vector instead of player.velocity
In md code blocks, you can specify the language by adding cs or whatever language specifier you'd like, js, cpp, asm, rust after the three `
Yeah Forgot to mention that I was using Rigid Body
oh, you're just setting the position of the rigidbody every frame
it's not going to have a velocity
and there comes back the internet
i would just set rb.velocity = playermovement (and get rid of the Time.deltaTime factor when calculating playermovment)
Setting the rigidbody's position teleports it, which makes it more likely for it to go through walls
Can you help me? I was going to duplicate an object and level it, but this error appeared. How to solve this error?
do u use visual scripting?
aa idk prolly can ignore it then
hello once again , short description of what im trying to do - carry out division operation of two spheres (one from left and one from right) one of the left is generated by user input and one on right is randomised the operation is carried out by assigning numeric values to spheres and then using formula in script which would execute after collision , so here is the recording of the issue im facing (apparently the bigger sphere should undergo division and should change into sphere of resulting number and the smaller sphere should get destroyed upon impact) , will send scripts later on if needed
noone can help you without the code bro + why do you need to divide instead of subtracting ?
Why did you ask if I use visual script?
I had same warning in like empty project few weeks ago but I dont use visual scripting so removed it
So how did you remove it? Maybe this might help.
at the top go to window -> package manager then type into search bar "visual scripting" and theres remove button bottom right
its just the game mechanics i wanted to implement idk
https://hastebin.com/share/ewofiwamor.csharp (sphere_launcher)
https://hastebin.com/share/zosucugeme.csharp (sphere_spawner)
https://hastebin.com/share/mogowiyufu.csharp (Numeric_sphere (division and prefab assign))
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I tried what you said and the problem was solved, thank you
So from what I see most tutorial and things on the internet, most grid systems create the grid from a corener of said gird. Is there a tutorial or something someone can point me to that had a grid generate "outward"?
from an origin of 0, 0
is there a version of this for the "actual" scale (as in if the parent alters the scale of the gameobject etc)
try lossyScale idk for sure tho, yea https://docs.unity3d.com/ScriptReference/Transform-lossyScale.html
any help would be really appreciated , its 12:30 am and i was working entire day so im completely exhausted. gn and leave a ping if u reply.
BlinDeex do you Know about gradle Build Failed. Plz dont ignore
#📱┃mobile for issues with building your game for a mobile platform. and post details
not getting resopnse from their
that doesn't mean you should start crossposting to irrelevant channels
when someone that has the knowledge see's it they'll respond..
like boxfriend said, if the post office is closed you don't drive down the road to the animal shelter and ask them to mail it instead lol
what if I want to ship a dog?
😏
i am also beginner so i came here
this is a code channel. not a gradle build error channel
thats fair.. just try to keep things relevant to the channel.. odds are that in the wrong channel ppl just arent familiar
i myself have never built a mobile game
hey friends, this is a bit embarrasing for me but i've made a new enemy for my platformer but it wont stop falling through platforms. https://hastebin.com/share/iguqorecij.csharp i've got a player character AND coins that stop on the platform but for some reason this new enemy falls through it
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hey guys how would I tie colour to a float value? I want to have it that it goes from a default colour (white right now, but should be modifiable) to red (also modifiable), based on a character's "heat" level (float). at 0 heat, colour should be fully white, at X heat, colour should be fully red.
what collision detection are you using for the enemy?
Color.Lerp exists
is the object on a layer that can collide with your platforms?
i've got a blank child GroundCheck object, like i do with my player character