Nos_E3ks
Nos_E3ks
CC#
Created by Nos_E3ks on 4/13/2023 in #help
❔ trying to get my Dialog system to be with a key press and not just walking into the npc, unity 2d
I still quite neww to coding, thats why i asked lol,
7 replies
CC#
Created by Nos_E3ks on 4/13/2023 in #help
❔ trying to get my Dialog system to be with a key press and not just walking into the npc, unity 2d
that is true, just need to figure out how to set that up!
7 replies
CC#
Created by Nos_E3ks on 4/13/2023 in #help
❔ trying to get my Dialog system to be with a key press and not just walking into the npc, unity 2d
alright
7 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
alright thanks
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
This is the Code I used to get it work
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public enum FadeType
{
FadeIn,
FadeOut,
FadeInOut,
FadeOutIn
}

public class Fadeimg : MonoBehaviour
{
[Tooltip("The UI element you want to fade")]
[SerializeField]
private MaskableGraphic element;

[Tooltip("Fade type")]
[SerializeField]
private FadeType fadeType;

[Tooltip("Fade time")]
[SerializeField]
private float fadeTime = 1f;

[Tooltip("Loop wait time")]
[SerializeField]
private float WaitTime = 1f;

[Tooltip("Faded Time")]
[SerializeField]
private float FadedTime;

private Color color;

void Start()
{
color = element.color;
switch(fadeType)
{
case FadeType.FadeIn:
StartCoroutine(FadeIn());
break;
case FadeType.FadeOut:
StartCoroutine(FadeOut());
break;
case FadeType.FadeInOut:
StartCoroutine(FadeInOut());
break;
case FadeType.FadeOutIn:
StartCoroutine(FadeOutIn());
break;
}
}

private IEnumerator FadeOut()
{
for(float a = fadeTime; a >= 0; a -= Time.deltaTime)
{
element.color = new Color(color.r, color.g, color.b, a);
yield return null;
}
}

private IEnumerator FadeIn()
{
for(float a = 0; a <= fadeTime; a += Time.deltaTime)
{
element.color = new Color(color.r, color.g, color.b, a);
yield return null;
}
}

private IEnumerator FadeInOut()
{
StartCoroutine(FadeIn());
yield return new WaitForSeconds(fadeTime);
StartCoroutine(FadeOut());
}

private IEnumerator FadeOutIn()
{
StartCoroutine(FadeOut());
yield return new WaitForSeconds(fadeTime);
yield return new WaitForSeconds(FadedTime);
StartCoroutine(FadeIn());
yield return new WaitForSeconds(WaitTime);
StartCoroutine(FadeOutIn());
}
}

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public enum FadeType
{
FadeIn,
FadeOut,
FadeInOut,
FadeOutIn
}

public class Fadeimg : MonoBehaviour
{
[Tooltip("The UI element you want to fade")]
[SerializeField]
private MaskableGraphic element;

[Tooltip("Fade type")]
[SerializeField]
private FadeType fadeType;

[Tooltip("Fade time")]
[SerializeField]
private float fadeTime = 1f;

[Tooltip("Loop wait time")]
[SerializeField]
private float WaitTime = 1f;

[Tooltip("Faded Time")]
[SerializeField]
private float FadedTime;

private Color color;

void Start()
{
color = element.color;
switch(fadeType)
{
case FadeType.FadeIn:
StartCoroutine(FadeIn());
break;
case FadeType.FadeOut:
StartCoroutine(FadeOut());
break;
case FadeType.FadeInOut:
StartCoroutine(FadeInOut());
break;
case FadeType.FadeOutIn:
StartCoroutine(FadeOutIn());
break;
}
}

private IEnumerator FadeOut()
{
for(float a = fadeTime; a >= 0; a -= Time.deltaTime)
{
element.color = new Color(color.r, color.g, color.b, a);
yield return null;
}
}

private IEnumerator FadeIn()
{
for(float a = 0; a <= fadeTime; a += Time.deltaTime)
{
element.color = new Color(color.r, color.g, color.b, a);
yield return null;
}
}

private IEnumerator FadeInOut()
{
StartCoroutine(FadeIn());
yield return new WaitForSeconds(fadeTime);
StartCoroutine(FadeOut());
}

private IEnumerator FadeOutIn()
{
StartCoroutine(FadeOut());
yield return new WaitForSeconds(fadeTime);
yield return new WaitForSeconds(FadedTime);
StartCoroutine(FadeIn());
yield return new WaitForSeconds(WaitTime);
StartCoroutine(FadeOutIn());
}
}

23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
Thank you everyone that has Helped me. I got it all working now
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
So after a bit of testing I got a loop to work, now I want it to change colors
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
alright
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
Well it works, time to figure out how to loop it
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
alright will do, I will let ya know how it turns out
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
ah I see, understandable, thank you
23 replies
CC#
Created by Nos_E3ks on 8/31/2022 in #help
Trying to fade In and out Object
it works so far, Just trying to figure out how to get it to loop lol but thank you
23 replies