Skip to content

MlleDR/Snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Snippets

Useful snippets that I often use in my projects and that I'm glad to share.

They are mostly begginers' code (well, just like me 😊) but I hope they might help others who, like me, started to learn coding from generous coders' community who shared and continue to share their experience freely.

In addition, please have a look at the use of coding in my personal work here and enjoy !

Sismograffiti and Tagcards

DCBL Project channel

Feel free to contact me for any questions or advice on improving the snippets posted.

Javascript folder

Unity/C# folder

Animation
  • RotateCameraAroundTarget.cs - Method to orbit camera (or any object of your choice) around a target. I usually put this script on my Main Camera to orbit (and debug) a specific scene component at runtime. It's also perfect for demos.
  • ConstantLerp.cs - Constant Vector3.Lerp from A to B with speed
  • DetectDirectionalRotation.cs - Detect if an object/player is rotating clockwise or anti-clockwise
Components

image

Maths
Camera
Input
  • CallKeyDownWithDelay.cs - Method to trigger a KeyDown (analog or bool) with a given delay. Let you control the rate a button triggers an action.
Utilities

Android Device

  • DetectDevice_PC_Android.cs - Detect easily if your app is running on an Android device or in Play mode in Unity engine. This little piece of code frees you from using public user booleans switched manually between PC and Android.

Creative Coding

Color
Canvas
  • ScreenArray.cs - Get a Screen Array from TopLeft to BottomRight corner with borders and illustrate with spheres on an Orthographic camera.

image

💡 Tips 💡

  • Editor folder - When using a plugin script that is not an asset from the Package Manager or that you got from the community, for ex this awesome script for Replacing a Prefab by another, don't forget to put it in a folder called Editor. Thus, it will not be compiled when building your game, nor will it prompt errors like are you missing an assembly reference?. More info on Replace With Prefab awesome adventure here.

Releases

No releases published

Packages

No packages published