Help with charting a rhythm game
Hello I'm trying to chart my rhythm game but idk what the best way to do it would be. The original plan was to place notes and then slightly move them until they're all in time except that it would never be fully in time. I was thinking of using midi however I wasn't sure of how I could do long notes and transitions. The game is the basic 4 bars with notes dropping down plus player movement to left and right. Thanks!
https://redd.it/1hwv9yi
@r_Unity3D
Hello I'm trying to chart my rhythm game but idk what the best way to do it would be. The original plan was to place notes and then slightly move them until they're all in time except that it would never be fully in time. I was thinking of using midi however I wasn't sure of how I could do long notes and transitions. The game is the basic 4 bars with notes dropping down plus player movement to left and right. Thanks!
https://redd.it/1hwv9yi
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
This media is not supported in your browser
VIEW IN TELEGRAM
I Went Down the Physics Rabbit Hole Again, Came out with Sticky Rockets! Should this be a feature?
https://redd.it/1hwsohv
@r_Unity3D
https://redd.it/1hwsohv
@r_Unity3D
Join the 2nd Annual Aviator™ ARCADE Game Jam – $5,000 in Cash Prizes!
Calling all game developers! The 2nd Annual Aviator™ ARCADE Game Jam is starting on February 10, 2025, and we’re inviting YOU to join. Whether you’re a beginner or a seasoned developer, this is your chance to showcase your skills and win big!
👉 Sign up now on itch.io: https://itch.io/jam/arcade2
What Is Aviator Arcade?
Aviator Arcade™ is an online platform where developers can host their games for free, with or without our proprietary blockchain technology. We provide flexibility so you can create the game you want, your way.
Game Jam Details • Start Date: February 10, 2025 • End Date: March 3, 2025 • Requirements: • Include a competitive scoring or timing system. • Upload your game to Aviator Arcade, with or without blockchain integration.
Prizes
A total prize pool of $5,000 will be awarded across these categories: 1. Best Overall Experience • 1st Place: $1,000 • 2nd Place: $700 • 3rd Place: $500 2. Most Innovative Scoring System • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 3. Best Artistic Design • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 4. Most Addictive Gameplay • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 5. Community Favorite • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 6. Honorable Mentions • 5 Random Humble Bundle codes
How to Participate 1. Go solo or form a team of up to four members. 2. Develop your game using any engine. 3. Include a scoring or timing system in your game. 4. Submit your game to https://itch.io/jam/arcade2 and upload it to Aviator Arcade (with or without blockchain integration) within 48 hours of submission.
Why Join? • Win cash prizes and exclusive rewards. • Showcase your game on Aviator Arcade for free. • Explore blockchain integration or stick to traditional game development—it’s up to you. • Join a thriving community of developers and gamers.
Unleash your creativity, compete for amazing prizes, and join the excitement starting February 10, 2025!
For full details and official rules, visit the Game Jam Page.
https://redd.it/1hwy07x
@r_Unity3D
Calling all game developers! The 2nd Annual Aviator™ ARCADE Game Jam is starting on February 10, 2025, and we’re inviting YOU to join. Whether you’re a beginner or a seasoned developer, this is your chance to showcase your skills and win big!
👉 Sign up now on itch.io: https://itch.io/jam/arcade2
What Is Aviator Arcade?
Aviator Arcade™ is an online platform where developers can host their games for free, with or without our proprietary blockchain technology. We provide flexibility so you can create the game you want, your way.
Game Jam Details • Start Date: February 10, 2025 • End Date: March 3, 2025 • Requirements: • Include a competitive scoring or timing system. • Upload your game to Aviator Arcade, with or without blockchain integration.
Prizes
A total prize pool of $5,000 will be awarded across these categories: 1. Best Overall Experience • 1st Place: $1,000 • 2nd Place: $700 • 3rd Place: $500 2. Most Innovative Scoring System • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 3. Best Artistic Design • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 4. Most Addictive Gameplay • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 5. Community Favorite • 1st Place: $350 • 2nd Place: $250 • 3rd Place: $100 6. Honorable Mentions • 5 Random Humble Bundle codes
How to Participate 1. Go solo or form a team of up to four members. 2. Develop your game using any engine. 3. Include a scoring or timing system in your game. 4. Submit your game to https://itch.io/jam/arcade2 and upload it to Aviator Arcade (with or without blockchain integration) within 48 hours of submission.
Why Join? • Win cash prizes and exclusive rewards. • Showcase your game on Aviator Arcade for free. • Explore blockchain integration or stick to traditional game development—it’s up to you. • Join a thriving community of developers and gamers.
Unleash your creativity, compete for amazing prizes, and join the excitement starting February 10, 2025!
For full details and official rules, visit the Game Jam Page.
https://redd.it/1hwy07x
@r_Unity3D
itch.io
2nd Annual Aviator™ ARCADE Game Jam - $5k in Cash Prizes!! 🕹️
A game jam from 2025-02-10 to 2025-03-17 hosted by Stixil & Broski. Aviator Arcade ™ is a blockchain-based gaming platform that rewards developers and players alike. Created by Aviator Technologies, LLC in Albuquerqu...
Help with unity triggers
I'm trying to make this game and the OnTriggerEnter part of the SheepScript won't trigger. I've checked the RigidBody, the Colliders, and the Layer Collision Matrix, but there doesn't seem to be any problems. Does anyone know how I could solve this problem? Thank you very much.
https://redd.it/1hx1is8
@r_Unity3D
I'm trying to make this game and the OnTriggerEnter part of the SheepScript won't trigger. I've checked the RigidBody, the Colliders, and the Layer Collision Matrix, but there doesn't seem to be any problems. Does anyone know how I could solve this problem? Thank you very much.
https://redd.it/1hx1is8
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Noob
Hi guys, me and a group of friends plan to make a game using unity (a 2D game), this is the first time we will be using the c# language and any type of game engine anything we should know before we start or things that might be useful to know?
https://redd.it/1hx6khn
@r_Unity3D
Hi guys, me and a group of friends plan to make a game using unity (a 2D game), this is the first time we will be using the c# language and any type of game engine anything we should know before we start or things that might be useful to know?
https://redd.it/1hx6khn
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
How to set up background as toplayer/filter?
Hello everyone!
I'm about to create a point & click adventure game! For this I created a 2D URP Unity Project
I have pre-drawn a scene in my drawing program as in screenshot 1 (S1).
My layers in my artist program are normally like in screenshot 2 (S2) (In this screenshot the background is turned off, normally it is turned on)
As you can see, my top layer is a background with 66% opacity and the blend mode “Darken”.
I want to bring my drawings into the Unity Engine with the same effect. I want to have the background as the top layer that acts as a “filter” because in my game there are objects that move in the background.
Also, I have items/objects that have a white background to avoid a transparent body (like the birds, if they are not completely white, the nest will show through the body). The filter on top should then color the corresponding objects.
Trying to implement my assets in Unity leads to unsatisfactory results. As an example, you can see screenshot 3 (S3) where I tried to set the background to the highest level and play a bit with the alpha value in the rgba. But you can see that it doesn't look like S1. How can I make this work? I have absolutely no idea how to make this work as I am a Unity beginner.
Thanks for your help!
https://preview.redd.it/hbvm6hvrixbe1.png?width=788&format=png&auto=webp&s=51db96d525ba94ad25de66514a003944244e3781
https://preview.redd.it/wu7udzhsixbe1.png?width=298&format=png&auto=webp&s=ffd31e751fe2ea772835dc3a852881ed2d058d49
https://preview.redd.it/pb3p4k0tixbe1.png?width=927&format=png&auto=webp&s=884c34a0753705cc3bbaebdfba23d7002f4566f2
https://redd.it/1hx8em3
@r_Unity3D
Hello everyone!
I'm about to create a point & click adventure game! For this I created a 2D URP Unity Project
I have pre-drawn a scene in my drawing program as in screenshot 1 (S1).
My layers in my artist program are normally like in screenshot 2 (S2) (In this screenshot the background is turned off, normally it is turned on)
As you can see, my top layer is a background with 66% opacity and the blend mode “Darken”.
I want to bring my drawings into the Unity Engine with the same effect. I want to have the background as the top layer that acts as a “filter” because in my game there are objects that move in the background.
Also, I have items/objects that have a white background to avoid a transparent body (like the birds, if they are not completely white, the nest will show through the body). The filter on top should then color the corresponding objects.
Trying to implement my assets in Unity leads to unsatisfactory results. As an example, you can see screenshot 3 (S3) where I tried to set the background to the highest level and play a bit with the alpha value in the rgba. But you can see that it doesn't look like S1. How can I make this work? I have absolutely no idea how to make this work as I am a Unity beginner.
Thanks for your help!
https://preview.redd.it/hbvm6hvrixbe1.png?width=788&format=png&auto=webp&s=51db96d525ba94ad25de66514a003944244e3781
https://preview.redd.it/wu7udzhsixbe1.png?width=298&format=png&auto=webp&s=ffd31e751fe2ea772835dc3a852881ed2d058d49
https://preview.redd.it/pb3p4k0tixbe1.png?width=927&format=png&auto=webp&s=884c34a0753705cc3bbaebdfba23d7002f4566f2
https://redd.it/1hx8em3
@r_Unity3D
Help!
Very noob question and I'm sure it's been answered I just can't find the answer 😭. Light is affecting the sprites in the scene but any object that is imported from blender is not affected. I see that the sprites have sprite rendering which I have added the urp too but there is no option in either the imported material or object to attach the sprites lite, as a test I have created a simple sphere with an orange material no shaders etc. is there maybe a component I need to add to the material? Any help is appreciated.
https://redd.it/1hx9fio
@r_Unity3D
Very noob question and I'm sure it's been answered I just can't find the answer 😭. Light is affecting the sprites in the scene but any object that is imported from blender is not affected. I see that the sprites have sprite rendering which I have added the urp too but there is no option in either the imported material or object to attach the sprites lite, as a test I have created a simple sphere with an orange material no shaders etc. is there maybe a component I need to add to the material? Any help is appreciated.
https://redd.it/1hx9fio
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
How to Read and Send data with Unity Android from an arduino using an OTG cable
Hi, I have very limited knowledge of Unity and am making a shool project where I use buttons on my arduino to send data to a android tablet.
Ive looked for sources on how to do this but I keep finding different ways. I just want the most simple way of doing this.
What is the option I should use here?
https://redd.it/1hx8sux
@r_Unity3D
Hi, I have very limited knowledge of Unity and am making a shool project where I use buttons on my arduino to send data to a android tablet.
Ive looked for sources on how to do this but I keep finding different ways. I just want the most simple way of doing this.
What is the option I should use here?
https://redd.it/1hx8sux
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
This media is not supported in your browser
VIEW IN TELEGRAM
I add a Aim Constraints to viewers so they can track the ball. It boosted the feeling of viewers, what you guys think?
https://redd.it/1hx8tsg
@r_Unity3D
https://redd.it/1hx8tsg
@r_Unity3D
Unity Fishing Game Help
I want to make a simple game for an assignment. I want my fishing mechanic to be like the game CatGoesFishing, but I’m extremely stuck, I’ve been working on it for a long time. Any help is appreciated! I want to know how you would approach this when it comes to coding
Here’s a video to show how the fishing works (Cat Goes Fishing) https://drive.google.com/file/d/1TLdFBZCz7F1800xZdjsiCnuTClCx4zxy/view?usp=drivesdk
Right now I’m using a line renderer for my fishing line, I have an arm rotation noscript that managed with the arm and rod moving while the fishing mechanic is another noscript to reel, cast, and swing. Thanks so much for the help !!
https://redd.it/1hxehp4
@r_Unity3D
I want to make a simple game for an assignment. I want my fishing mechanic to be like the game CatGoesFishing, but I’m extremely stuck, I’ve been working on it for a long time. Any help is appreciated! I want to know how you would approach this when it comes to coding
Here’s a video to show how the fishing works (Cat Goes Fishing) https://drive.google.com/file/d/1TLdFBZCz7F1800xZdjsiCnuTClCx4zxy/view?usp=drivesdk
Right now I’m using a line renderer for my fishing line, I have an arm rotation noscript that managed with the arm and rod moving while the fishing mechanic is another noscript to reel, cast, and swing. Thanks so much for the help !!
https://redd.it/1hxehp4
@r_Unity3D
What is wrong with my game?
I made a tiled floor, and for some reason my player character clips into it when you walk into the block. unless you walk on top of it.
https://preview.redd.it/ljpwzqpdlzbe1.png?width=192&format=png&auto=webp&s=49018d8d67091c4beea95268a814cd3ccb7f78ed
https://preview.redd.it/zn9dk5felzbe1.png?width=240&format=png&auto=webp&s=11f2cadf3c57d76a3532c1487dfa369b99da9f64
https://redd.it/1hxfata
@r_Unity3D
I made a tiled floor, and for some reason my player character clips into it when you walk into the block. unless you walk on top of it.
https://preview.redd.it/ljpwzqpdlzbe1.png?width=192&format=png&auto=webp&s=49018d8d67091c4beea95268a814cd3ccb7f78ed
https://preview.redd.it/zn9dk5felzbe1.png?width=240&format=png&auto=webp&s=11f2cadf3c57d76a3532c1487dfa369b99da9f64
https://redd.it/1hxfata
@r_Unity3D
I want to implement something like blood or slashes on my 2d character in Unity 2D any idea how this can be achieved ?
https://redd.it/1hxgmq9
@r_Unity3D
https://redd.it/1hxgmq9
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Take a look at my little medieval idle game! It's a relaxing idle game that's all about you being an adventurer!
The first boss is to be a goblin king!
Do you have any good suggestions for the setting of the first boss or what makes the boss?
Work in Progress!
https://redd.it/1hxipzq
@r_Unity3D
The first boss is to be a goblin king!
Do you have any good suggestions for the setting of the first boss or what makes the boss?
Work in Progress!
https://redd.it/1hxipzq
@r_Unity3D
Feedback on my infinite scrolling background noscript
So I've been messing around with Unity for fun, working on a simple top-down 2D game just to learn some stuff. I've been using[ this pixel art sky asset pack ](https://free-game-assets.itch.io/free-sky-with-clouds-background-pixel-art-set)to create a noscript that makes an infinite scrolling effect for the back ground. The way it works is basically like this:
\- Create a parent canvas and attach the SkyController noscript to it
\- Create a child RawImage gameobject for each layer and attach the SkyLayer noscript to each layer. Set the load order for each layer, starting at 0
\- Create 4 folders somewhere in \`Resources\`: Morning, Day, Evening and Night, and set the path to those folders in the AssetPath field of the SkyController noscript
\- At SkyController start, it determines the current time of day and system hour, e.g if 6am, it'll look for \`Resources/\[YOUR\_ASSET\_PATH\]/Morning\`, and then loads all the image files into a Texture2D array. Each image must be named according to its load order, i.e 0 is the "lowest" layer.
\- At SkyLayer start (which executes after SkyController per Script Execution Order), it loads the texture from the Texture2D array according to its load order and file name
\- At SkyController Update, it checks if the current system time is equal to the previously set system hour at start. If the current hour is outside of the current time of day range, i.e if it's 10am now but started at 6am, it's now Day, and it reloads the updated texture array and sets the textureReload to true
\- At SkyLayer Update, it checks if textureReload is true. If so, it updates it's texture. Then, it creates the infinite scrolling effect by updating the uvRect.position based on speed, scaled by Time.deltaTime
I'll probably remove the logic to update the texture if the timeOfDay range changes. I don't imagine anyone would be sitting on the loading screen long enough for it to change automatically, just thought it would be a cool lil feature. This is the first noscript I've ever made so be a little gentle if it's bad lol
// SkyController.cs
using System;
using UnityEngine;
public class SkyController : MonoBehaviour
{
[SerializeField] private string assetPath;
[SerializeField] public bool hourOverride;
[SerializeField, Tooltip("Use 0-24H format")] private int hourCustom;
public int hourCurrent;
private string timeOfDay = "Day/";
private string assetPathStart = "";
private string assetPathDefault = "";
public Texture2D[] textures;
public bool textureReload = false;
public int textureCount;
void Start() {
assetPathStart = assetPath;
SetTimeAndPath();
LoadTextures();
}
void Update() {
if (!hourOverride && DateTime.Now.Hour != hourCurrent) {
SetTimeAndPath();
LoadTextures();
textureReload = true;
}
}
void SetTimeAndPath() {
hourCurrent = hourOverride ? hourCustom : DateTime.Now.Hour;
timeOfDay = hourCurrent switch {
<=5 => "Night/",
<=9 => "Morning/",
<=16 => "Day/",
<=20 => "Evening/",
_ => "Night/"
};
assetPath = string.IsNullOrEmpty(assetPath) ? assetPathDefault : assetPathStart;
assetPath += timeOfDay;
}
public Texture2D[] LoadTextures() {
textures = Resources.LoadAll<Texture2D>(assetPath);
return textures;
}
public Texture2D GetTexture(int loadOrder) {
Texture2D texture = (loadOrder < 0 || loadOrder >= textures.Length) ? texture = null : texture = textures[loadOrder];
return texture;
}
}
using System;
using
So I've been messing around with Unity for fun, working on a simple top-down 2D game just to learn some stuff. I've been using[ this pixel art sky asset pack ](https://free-game-assets.itch.io/free-sky-with-clouds-background-pixel-art-set)to create a noscript that makes an infinite scrolling effect for the back ground. The way it works is basically like this:
\- Create a parent canvas and attach the SkyController noscript to it
\- Create a child RawImage gameobject for each layer and attach the SkyLayer noscript to each layer. Set the load order for each layer, starting at 0
\- Create 4 folders somewhere in \`Resources\`: Morning, Day, Evening and Night, and set the path to those folders in the AssetPath field of the SkyController noscript
\- At SkyController start, it determines the current time of day and system hour, e.g if 6am, it'll look for \`Resources/\[YOUR\_ASSET\_PATH\]/Morning\`, and then loads all the image files into a Texture2D array. Each image must be named according to its load order, i.e 0 is the "lowest" layer.
\- At SkyLayer start (which executes after SkyController per Script Execution Order), it loads the texture from the Texture2D array according to its load order and file name
\- At SkyController Update, it checks if the current system time is equal to the previously set system hour at start. If the current hour is outside of the current time of day range, i.e if it's 10am now but started at 6am, it's now Day, and it reloads the updated texture array and sets the textureReload to true
\- At SkyLayer Update, it checks if textureReload is true. If so, it updates it's texture. Then, it creates the infinite scrolling effect by updating the uvRect.position based on speed, scaled by Time.deltaTime
I'll probably remove the logic to update the texture if the timeOfDay range changes. I don't imagine anyone would be sitting on the loading screen long enough for it to change automatically, just thought it would be a cool lil feature. This is the first noscript I've ever made so be a little gentle if it's bad lol
// SkyController.cs
using System;
using UnityEngine;
public class SkyController : MonoBehaviour
{
[SerializeField] private string assetPath;
[SerializeField] public bool hourOverride;
[SerializeField, Tooltip("Use 0-24H format")] private int hourCustom;
public int hourCurrent;
private string timeOfDay = "Day/";
private string assetPathStart = "";
private string assetPathDefault = "";
public Texture2D[] textures;
public bool textureReload = false;
public int textureCount;
void Start() {
assetPathStart = assetPath;
SetTimeAndPath();
LoadTextures();
}
void Update() {
if (!hourOverride && DateTime.Now.Hour != hourCurrent) {
SetTimeAndPath();
LoadTextures();
textureReload = true;
}
}
void SetTimeAndPath() {
hourCurrent = hourOverride ? hourCustom : DateTime.Now.Hour;
timeOfDay = hourCurrent switch {
<=5 => "Night/",
<=9 => "Morning/",
<=16 => "Day/",
<=20 => "Evening/",
_ => "Night/"
};
assetPath = string.IsNullOrEmpty(assetPath) ? assetPathDefault : assetPathStart;
assetPath += timeOfDay;
}
public Texture2D[] LoadTextures() {
textures = Resources.LoadAll<Texture2D>(assetPath);
return textures;
}
public Texture2D GetTexture(int loadOrder) {
Texture2D texture = (loadOrder < 0 || loadOrder >= textures.Length) ? texture = null : texture = textures[loadOrder];
return texture;
}
}
using System;
using
itch.io
Free Sky Backgrounds by Free Game Assets (GUI, Sprite, Tilesets)
Free Sky Backgrounds for your game projects
UnityEngine;
public class SkyController : MonoBehaviour
{
[SerializeField] private string assetPath;
[SerializeField] public bool hourOverride;
[SerializeField, Tooltip("Use 0-24H format")] private int hourCustom;
public int hourCurrent;
private string timeOfDay = "Day/";
private string assetPathStart = "";
private string assetPathDefault = "";
public Texture2D[] textures;
public bool textureReload = false;
public int textureCount;
void Start() {
assetPathStart = assetPath;
SetTimeAndPath();
LoadTextures();
}
void Update() {
if (!hourOverride && DateTime.Now.Hour != hourCurrent) {
SetTimeAndPath();
LoadTextures();
textureReload = true;
}
}
void SetTimeAndPath() {
hourCurrent = hourOverride ? hourCustom : DateTime.Now.Hour;
timeOfDay = hourCurrent switch {
<=5 => "Night/",
<=9 => "Morning/",
<=16 => "Day/",
<=20 => "Evening/",
_ => "Night/"
};
assetPath = string.IsNullOrEmpty(assetPath) ? assetPathDefault : assetPathStart;
assetPath += timeOfDay;
}
public Texture2D[] LoadTextures() {
textures = Resources.LoadAll<Texture2D>(assetPath);
return textures;
}
public Texture2D GetTexture(int loadOrder) {
Texture2D texture = (loadOrder < 0 || loadOrder >= textures.Length) ? texture = null : texture = textures[loadOrder];
return texture;
}
}
\---
/// SkyLayer.cs
using UnityEngine;
using UnityEngine.UI;
public class SkyLayer : MonoBehaviour
{
public SkyController skyController;
private RawImage rawImage;
[SerializeField] public bool disabled;
[SerializeField] public int loadOrder;
[SerializeField] public bool staticSet;
[SerializeField] public bool speedSet;
[SerializeField] public float speedCustom;
[SerializeField] public bool mirrorLayer;
[SerializeField] public int mirrorSpeed;
public float speed;
void Start() {
if (disabled) gameObject.SetActive(false);
skyController = FindFirstObjectByType<SkyController>();
rawImage = GetComponent<RawImage>();
SetTexture();
}
void Update() {
if (skyController.textureReload) {
SetTexture();
skyController.textureCount++;
if (skyController.textureCount > skyController.textures.Length) {
skyController.textureReload = false;
skyController.textureCount = 0;
}
}
rawImage.uvRect
= new Rect(rawImage.uvRect.position
+ new Vector2(SetSpeed(), 0)
* Time.deltaTime,rawImage.uvRect.size);
}
void SetTexture() {
if (skyController.GetTexture(loadOrder) == null) {
Destroy(gameObject);
return;
}
Texture2D texture = skyController.GetTexture(loadOrder);
rawImage.texture = texture;
texture.wrapMode = TextureWrapMode.Repeat;
texture.filterMode = FilterMode.Point;
RectTransform rawImageRect = GetComponent<RectTransform>();
RectTransform parentRect = transform.parent.GetComponent<RectTransform>();
rawImageRect.sizeDelta = parentRect.sizeDelta;
}
private float SetSpeed() {
speed = staticSet ? 0f :
public class SkyController : MonoBehaviour
{
[SerializeField] private string assetPath;
[SerializeField] public bool hourOverride;
[SerializeField, Tooltip("Use 0-24H format")] private int hourCustom;
public int hourCurrent;
private string timeOfDay = "Day/";
private string assetPathStart = "";
private string assetPathDefault = "";
public Texture2D[] textures;
public bool textureReload = false;
public int textureCount;
void Start() {
assetPathStart = assetPath;
SetTimeAndPath();
LoadTextures();
}
void Update() {
if (!hourOverride && DateTime.Now.Hour != hourCurrent) {
SetTimeAndPath();
LoadTextures();
textureReload = true;
}
}
void SetTimeAndPath() {
hourCurrent = hourOverride ? hourCustom : DateTime.Now.Hour;
timeOfDay = hourCurrent switch {
<=5 => "Night/",
<=9 => "Morning/",
<=16 => "Day/",
<=20 => "Evening/",
_ => "Night/"
};
assetPath = string.IsNullOrEmpty(assetPath) ? assetPathDefault : assetPathStart;
assetPath += timeOfDay;
}
public Texture2D[] LoadTextures() {
textures = Resources.LoadAll<Texture2D>(assetPath);
return textures;
}
public Texture2D GetTexture(int loadOrder) {
Texture2D texture = (loadOrder < 0 || loadOrder >= textures.Length) ? texture = null : texture = textures[loadOrder];
return texture;
}
}
\---
/// SkyLayer.cs
using UnityEngine;
using UnityEngine.UI;
public class SkyLayer : MonoBehaviour
{
public SkyController skyController;
private RawImage rawImage;
[SerializeField] public bool disabled;
[SerializeField] public int loadOrder;
[SerializeField] public bool staticSet;
[SerializeField] public bool speedSet;
[SerializeField] public float speedCustom;
[SerializeField] public bool mirrorLayer;
[SerializeField] public int mirrorSpeed;
public float speed;
void Start() {
if (disabled) gameObject.SetActive(false);
skyController = FindFirstObjectByType<SkyController>();
rawImage = GetComponent<RawImage>();
SetTexture();
}
void Update() {
if (skyController.textureReload) {
SetTexture();
skyController.textureCount++;
if (skyController.textureCount > skyController.textures.Length) {
skyController.textureReload = false;
skyController.textureCount = 0;
}
}
rawImage.uvRect
= new Rect(rawImage.uvRect.position
+ new Vector2(SetSpeed(), 0)
* Time.deltaTime,rawImage.uvRect.size);
}
void SetTexture() {
if (skyController.GetTexture(loadOrder) == null) {
Destroy(gameObject);
return;
}
Texture2D texture = skyController.GetTexture(loadOrder);
rawImage.texture = texture;
texture.wrapMode = TextureWrapMode.Repeat;
texture.filterMode = FilterMode.Point;
RectTransform rawImageRect = GetComponent<RectTransform>();
RectTransform parentRect = transform.parent.GetComponent<RectTransform>();
rawImageRect.sizeDelta = parentRect.sizeDelta;
}
private float SetSpeed() {
speed = staticSet ? 0f :
speedSet ? speedCustom :
mirrorLayer ? (mirrorSpeed + 1) * 0.005f :
(loadOrder + 1) * 0.005f;
return speed;
}
}
https://redd.it/1hxjaw2
@r_Unity3D
mirrorLayer ? (mirrorSpeed + 1) * 0.005f :
(loadOrder + 1) * 0.005f;
return speed;
}
}
https://redd.it/1hxjaw2
@r_Unity3D
Reddit
From the Unity2D community on Reddit: Feedback on my infinite scrolling background noscript
Explore this post and more from the Unity2D community
Weird way to set Cinemachine Camera's Tracking Target at Runtime
I feel like I am missing something. My player object gets spawned at runtime, and so I cant set the target in the inspector. Before using Cinemachine I had a CameraFollow noscript I just referenced. But with Cinemachine it feels so clunky
I have my Main camera that has the CinemachineBrain on it
I have a Vitural camera
I have a player spawn noscript that grabs a reference to the Main camera
That I want the noscript to, after it spawns the player, Pass the player transform to the Main camera, to the CinemachineBrain, which finds the current active camera, and then applies the player transform to the Tracking Target of that camera.
What I find weird is when you try to find the active Virtual Camera that the CinemachineBrain is using, it gives you an interface (ICinemachineCamera), not a reference to the actual VCam (CinemachineCamera)
And what makes it even worse is in older version of Cinemachine that ICinemachineCamera had a Follow and LookAt var, in fact if you head over to the documentation IT STILL SAYS IT HAS THIS! Yet, if you look at the actual noscript those are gone... like What?!?! What kind of software development does that, not a depreciated of Obsolete tag, just gone, and then not update your documentation even. This is why I hate using 3rd party systems, But this was bought by Unity and everyone says it's amazing so I started using it.
So the solution I found (Here) is so weird and messy, I am thinking there HAS to be a better way to do this, Surely setting follow targets at runtime is a common enough function there is a streamline way to do it.
My janky solution
at first I used this, but this is bad cause I want to be able to access the active camera, not keep log of the index and get it that way
https://redd.it/1hxjz1n
@r_Unity3D
I feel like I am missing something. My player object gets spawned at runtime, and so I cant set the target in the inspector. Before using Cinemachine I had a CameraFollow noscript I just referenced. But with Cinemachine it feels so clunky
I have my Main camera that has the CinemachineBrain on it
I have a Vitural camera
I have a player spawn noscript that grabs a reference to the Main camera
That I want the noscript to, after it spawns the player, Pass the player transform to the Main camera, to the CinemachineBrain, which finds the current active camera, and then applies the player transform to the Tracking Target of that camera.
What I find weird is when you try to find the active Virtual Camera that the CinemachineBrain is using, it gives you an interface (ICinemachineCamera), not a reference to the actual VCam (CinemachineCamera)
And what makes it even worse is in older version of Cinemachine that ICinemachineCamera had a Follow and LookAt var, in fact if you head over to the documentation IT STILL SAYS IT HAS THIS! Yet, if you look at the actual noscript those are gone... like What?!?! What kind of software development does that, not a depreciated of Obsolete tag, just gone, and then not update your documentation even. This is why I hate using 3rd party systems, But this was bought by Unity and everyone says it's amazing so I started using it.
So the solution I found (Here) is so weird and messy, I am thinking there HAS to be a better way to do this, Surely setting follow targets at runtime is a common enough function there is a streamline way to do it.
My janky solution
if (mainCamera != null){CinemachineBrain cinemachineBrain = mainCamera.GetComponent<CinemachineBrain>();if (cinemachineBrain != null){ICinemachineCamera virtualICamera = cinemachineBrain.ActiveVirtualCamera ;if (virtualICamera is Component component){component.GetComponent<CinemachineCamera>().Follow = playerObj.transform;}else{Debug.LogError("Active virtual camera is not a CinemachineVirtualCamera.");}}else{Debug.LogError("Main camera does not have a CinemachineBrain component.");}}at first I used this, but this is bad cause I want to be able to access the active camera, not keep log of the index and get it that way
CinemachineVirtualCameraBase cinemachineCamera = CinemachineCore.GetVirtualCamera(0);if (cinemachineCamera != null) {cinemachineCamera.Follow = playerObj.transform;}else{Debug.LogError("No active Cinemachine virtual camera found.");}https://redd.it/1hxjz1n
@r_Unity3D
Help with my game (pls)
Im making a flappy bird copy and I'm following a tutorial for an older version of unity which is why it probably isn't working right, but I'm not sure how to adapt it or do it properly for the newer versions. Here are some pics of the code.
https://preview.redd.it/3hfbojgh11ce1.png?width=1102&format=png&auto=webp&s=7a98eeea0e69d6386c871b64b423e03151522091
https://preview.redd.it/55dgmwwi11ce1.png?width=1018&format=png&auto=webp&s=37f81c560956eb7b168809a3efc927340c14106f
https://preview.redd.it/wdztjfck11ce1.png?width=1080&format=png&auto=webp&s=2d1a36df13d91e4297d8e4cb83fcc79b7448f01c
im trying to make a trigger to add a score for each obstacle you pass, and the code was working fine until I added the 'collisiontriggernoscript' and i got a bunch of errors,
any help or tips are much appreciated.
:)
https://redd.it/1hxm95z
@r_Unity3D
Im making a flappy bird copy and I'm following a tutorial for an older version of unity which is why it probably isn't working right, but I'm not sure how to adapt it or do it properly for the newer versions. Here are some pics of the code.
https://preview.redd.it/3hfbojgh11ce1.png?width=1102&format=png&auto=webp&s=7a98eeea0e69d6386c871b64b423e03151522091
https://preview.redd.it/55dgmwwi11ce1.png?width=1018&format=png&auto=webp&s=37f81c560956eb7b168809a3efc927340c14106f
https://preview.redd.it/wdztjfck11ce1.png?width=1080&format=png&auto=webp&s=2d1a36df13d91e4297d8e4cb83fcc79b7448f01c
im trying to make a trigger to add a score for each obstacle you pass, and the code was working fine until I added the 'collisiontriggernoscript' and i got a bunch of errors,
any help or tips are much appreciated.
:)
https://redd.it/1hxm95z
@r_Unity3D