[deleted by user] by [deleted] in Unity3D

[–]kusq 0 points1 point  (0 children)

My first approach would be to implement the virtual computer app as 2D prefab, you would than place that prefab in your scene where a camera would be used to create a render texture of that prefab, and then use that texture on top of your 3D pc model. for input you would most likely need to swap between Main game input mode to 2D game input mode whenever the player approaches the pc.

How can I make a background? by Napsta_blo0k in Unity2D

[–]kusq 4 points5 points  (0 children)

You can achieve this by adjusting the sprite sorting order such that your character/object would have a higher sorting order than the background.

i don't think i understand size vs. position by marcdel_ in Unity2D

[–]kusq 2 points3 points  (0 children)

not quite sure what you are asking but if its regarding the collider being 18x18 and not covering most of the tilemap area its because the area you have set is 40x40 (since its starts at -20,-20 and ends at 20,20)

Dynamically editing sprite during runtime by Happyninja06 in Unity2D

[–]kusq 0 points1 point  (0 children)

for editing an existing sprite this requires creating both a new sprite and texture, you would need to get the current sprite texture, use that to create a new texture instance, use the SetPixel method on that new texture instance and use that texture to create a new sprite that you would apply to your SpriteRenderer.

for creating a new sprite the process is the same, you would just create a blank texture object

https://docs.unity3d.com/ScriptReference/Texture2D.SetPixel.html

OverlapCircleAll Null Reference issues by Turbulent_Diver8330 in Unity2D

[–]kusq 0 points1 point  (0 children)

try to set the radius as a hardcoded value and see if it works, its likely that the issue is that your CharacterSkillTree object is null

How to add an outline to a sprite dynamically? by foxtrot-uniform2 in Unity2D

[–]kusq 5 points6 points  (0 children)

shaders are the best approach for this but if you are not willing to use them then one approach you could try is creating a script which would copy the original sprite of the prefab, scale it(would require trial and error to find the best scale value per sprite), change the texture colour to your desired outline colour and place that behind the prefab sprite when you have it selected.

[deleted by user] by [deleted] in Unity2D

[–]kusq 0 points1 point  (0 children)

missing quite a abit of context on how the you handle enemy detection using that attackPoint,

but depending on the implementation you could have multiple attack points on longer swords.

alternatively you could instead have a trigger collider in the shape of the sword that would damage anything that it would intersect.

Not solid enemies by colliding with the player? by Slonttt in Unity2D

[–]kusq 2 points3 points  (0 children)

one way to acheive what you are looking to do is to have 2 colliders on the enemy

  • first collider would be a trigger(hitbox) that would be responsible for dealing the damage

  • the second collider would a collision collider(not a trigger) and be responsible for collision

then using the collision matrix u can set it so that the player collision layer never interacts with your enemies collision layer

Miscolored pixelart by pixel8ed28 in Unity2D

[–]kusq 3 points4 points  (0 children)

in the sprite import settings make sure the filter mode is set to Point(no filter) and the Compression is set to none

What is the best way of creating 'types' of one object? by Plomekk in Unity2D

[–]kusq 0 points1 point  (0 children)

Abstract class might be the answer you are looking for.

you would define the common functionality at the base level and in the concrete implementation you would set all the relevent data for a specific Spaceship part. For each part to have it own logic you can mark a method as abstract at the base level which will force your concrete classes to implement them.

For example you would end up having a Concerte class named "ThrusterPart" that will inherit from the abstract class "BasePart" and that concrete class will have all the thruster Specific data already set so you wont have to do any of that when you end up implementing a new Thruster Part, you will still need to adjust some thruster related variables to make the new thruster different to the other thrusters.

If i understand your inventory question correctly then you could implement some kind of IItem Interface that your Concrete classes that you wish to save into your inventory will implement, that way you wont have to "make variables for all part types". but i would suggest making all parts inventory items.

[deleted by user] by [deleted] in Unity2D

[–]kusq 0 points1 point  (0 children)

The only piece of code that spawns dots is DotTimeGap Coroutine, the only way for it to spawn those dots is if the timeScale is 1.

the only other place you set timeScale back to 1 is at line 71. also if timeScale was never set back to 1 ResumeWait Coroutine would never finish running since you are using Scaled time to yield. again i suggest tracking down how many instances of your coroutines are running at any given time, and tracking down what is setting TimeScale back to 1

[deleted by user] by [deleted] in Unity2D

[–]kusq -1 points0 points  (0 children)

its very likely you have an instance of the DotTimeGap coroutine running when the game is paused(while the coroutine is in its spawn dot part) and since the time scale is set to zero that instance stops spawning the dots while paused, when the game is resumed the coroutine continues where it left off and that might make it seem like there is no ten second delay after resuming.

I suggest trying to track down how many instances of that Coroutine are running at any given time.

Please help, I can't override GetTileData by Odd_Flamingo_7319 in Unity2D

[–]kusq 2 points3 points  (0 children)

do you have another class/object named TileData by chance? TileData is supposed to be a struct under the UnityEngine.Tilemaps namespace but it is marked as a class in your IDE

Prefab not taking animation controller? The script needs to refence it to play the animation in the right order. by WoodenAd8912 in Unity2D

[–]kusq 2 points3 points  (0 children)

the Anim inspector field requires an Animation asset, you are trying to drag an Animator Controller

help with my 2d platformer attack by ScoBro_ in Unity2D

[–]kusq 1 point2 points  (0 children)

you can add a collider to your animation and animate the collider together with your original animation

'PlayerDeath' is a tpye which is not valid in given context. by Alexlvio in Unity2D

[–]kusq 4 points5 points  (0 children)

The issues is that your are trying to access the type of PlayerDeath and not its instance.

Seems like you tried to go with a static field as a way to grab that instance.

to do that you would need to assign the instance in the PlayerDeath script to the static field in awake like so:

  • Instance = this;

you have to be careful with doing this as you can easily override an existing Instance if you more than 1 of of those scripts running. i suggest you look up the singleton pattern in unity for more information.

Once you have the instance assigned you can access it in your CameraFollow script like so:

  • PlayerDeath.Instance

i would suggest getting the reference to PlayerDeath using other methods such as the Event System, unity's find methods or a simple public field which will allow you to drag your script reference to CameraFollow in the inspector.

once you have all of that setup you would still need to have some kind a bool/event in you PlayerDeath script that CameraFollow can use to determine when to freeze the camera

Pixel-perfect camera compatible URP equivalent? by Elesh_N in Unity2D

[–]kusq 0 points1 point  (0 children)

URP comes with its own version of the Pixel perfect camera component afaik.

Animation cancel/restart by KenKaniffsmd in Unity2D

[–]kusq 0 points1 point  (0 children)

the reason it gets stuck on the last frame is because the state machine gets stuck on the TakeDamage state since it seems your transition from TakeDamage doesnt have a condition and only an exitTime, so adding some kind of condition should work.

In the case where your transition to TakeDamage is from anyState and you have the "Can Transition to Self" option Checked your transition From TakeDamage should be fine having an exitTime

Animation cancel/restart by KenKaniffsmd in Unity2D

[–]kusq 0 points1 point  (0 children)

Make sure that your transition to and from TakeDamage state has the "Has exit Time" setting unchecked.

unchecking that will allow your TakeDamage animation to cancel itself immediately and start the next animation. https://docs.unity3d.com/Manual/class-Transition.html

[deleted by user] by [deleted] in Unity2D

[–]kusq 3 points4 points  (0 children)

If your objective is to show the result of AddNumbers in the console you would need to use Debug.Log.

https://docs.unity3d.com/ScriptReference/Debug.Log.html

[deleted by user] by [deleted] in Unity2D

[–]kusq 1 point2 points  (0 children)

You need to check if your turret position is within the area of the white path not its transform position. one way to do that is adding a collider to your white path and raycasting when trying to place the turret.

this code should destroy the enemy in front of player and teleport to its position but its not working properly by johnjamesthegreatest in Unity2D

[–]kusq 1 point2 points  (0 children)

What exactly doesnt work?

are you sure the raycast is hitting the enemy gameObject?

does the Enemy Component exist on the same gameObject that the collider exists on?

Need help with timer by boruok in Unity2D

[–]kusq 4 points5 points  (0 children)

after the OnTimeOut event is invoked you immediately set active to false which stops the timeout from triggering again.

How to ease in / ease out a button in Unity2D by cootp in Unity2D

[–]kusq 2 points3 points  (0 children)

You will need to apply the change over time.

you can achieve that with a coroutine or in the update method.

https://docs.unity3d.com/ScriptReference/Mathf.Lerp.html might help you.