Skip to main content

Questions tagged [c#]

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform.

0 votes
1 answer
36 views

I want to limit my in-game FPS in my Unity game to 20 FPS, but this causes screen tearing in the build. How do I get rid of the tearing?

I have tried vSync, but in other forums I have read the vSync ignores the targetFramerate. Is there a way I can keep a 20 FPS cap without screen tearing? In my game I am trying to achieve a nostalgic ...
IcedSundae's user avatar
1 vote
0 answers
22 views

Finding objects with tags vs Layers vs Scripts in Unity?

I never know which one I should use. If a bullet flies towards a target, let's say a zombie, should the Zombie have a tag? Maybe an "enemy" tag, or "Damage" tag? Or should I look ...
MrV's user avatar
  • 47
1 vote
1 answer
47 views

How to structure a complex inventory system in Unity?

My inventory needs to deal with different Item types. Item is my base class, which is extended by Armor, Weapon, Spell, Scroll and I might add more in the future. All items have an interaction on ...
Pascal Claes's user avatar
0 votes
1 answer
32 views

How to filter/ignore child objects from an ML Agents RayPerceptionSensor in 3D?

I am making a snake AI with Unity ML Agents. There will be lots of snakes who will eat and dodge each other. A 3D RayPerceptionSensor detects everything, but there is a specific case where a problem ...
Ujjawal Saini's user avatar
0 votes
0 answers
40 views

How to make the character selection screen? [duplicate]

Hi to everyone i want to make the character selection screen the following 2 are scripts ...
Jano Wazir's user avatar
0 votes
1 answer
40 views

Prevent rotation after setting Human Pose

I'm attempting to move the fingers of a prefab using muscles with the SetHumanPose method. However, the prefab is rotated 90 degrees on each call to ...
wrappingduke's user avatar
-3 votes
1 answer
86 views

Character selection screen to choose what character loads in next scene

I am working on the character selection screen for my game. I want it so that, when the player clicks on the select button, the code checks if the imagecollection ...
Jano Wazir's user avatar
0 votes
1 answer
51 views

Is a conditional compilation directive needed to ensure editor script is not compiled into build?

Should an editor script contain #if UNITY_EDITOR to get excluded from build for Android and iOS? If so, where it should be written: ...
Ahmed Dyaa's user avatar
0 votes
1 answer
29 views

Cannot read value of type 'Vector3' error in Input System package

I'm a Unity newbie. This time, I'm trying to make the Player operable with an Xbox controller using PlayerInput. However, when I control the player, I get these errors: Errors that occurred: [20:35:...
Wazuku's user avatar
  • 1
0 votes
0 answers
27 views

Books/Videos to level up C#/Unity knowledge [closed]

Unity and C# is my first programming language and game engine and I have come to a part where I dont know what to do next. I know the basics of both C# and Unity, and also quite a few "Advanced&...
MrV's user avatar
  • 47
-2 votes
1 answer
69 views

Object refrence not set to an instance of an object

For some reason, the Unity console shows an "Object reference not set to an instance of an object error" when I run this line of code: ...
Jano Wazir's user avatar
0 votes
1 answer
58 views

Moving prefab body parts up and down — stops working when tied to a button click

I'm newbie to Unity and attempting to move a prefab's arm up and down on a button click but having some difficulty. The arm movement works when called from the Update() method without checking for a ...
wrappingduke's user avatar
3 votes
1 answer
2k views

How are GameManagers created in Unity?

I know the basics of C#(Syntax, 4 pillars, SOLID, Designs Patterns, etc...) and Unity. I can do basic stuff like Flappy bird or Fruit Ninja without any help. But problems arises when I want to create ...
MrV's user avatar
  • 47
0 votes
0 answers
79 views

How to protect Unity C# variables from TRIVIAL memory hack attempts?

DISCLAIMER: I am not trying to prevent all hacking. I am simple trying to make it a bit harder for beginners who watched 1 or 2 Cheat Engine tutorials to hack my game. I am aware it is impossible to ...
Pascal Claes's user avatar
0 votes
2 answers
58 views

Limiting number of Game Object

So I have this script that summons a stationary laser that the player is supposed to not get hit by, but since there's multiple game object with the code and they can all trigger at making it ...
Matt Sou's user avatar

15 30 50 per page
1
2 3 4 5
562