아래의 api document를 활용하여 각각의 프로티에 대한 정보를 얻을 수 있다.

 

 

https://docs.unity3d.com/ScriptReference/RenderSettings.html

 

Unity - Scripting API: RenderSettings

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

 

아래의 사진은 ambientLight라는 속성의 예시이다.

'Study > ' 카테고리의 다른 글

[Tip] Mathf.DeltaAngle  (0) 2024.06.29
[Tip] Object.FindObjectOfType  (0) 2024.06.11
[팁] Slider.onValueChanged  (0) 2024.06.05
[Tip] 3D 프로젝트에서 SpriteAtals 패킹하는 법  (0) 2024.05.23
[Tip] 패키지에서 프리팹찾기  (0) 2024.04.18

https://docs.unity3d.com/560/Documentation/ScriptReference/UI.Slider-onValueChanged.html

 

Unity - Scripting API: UI.Slider.onValueChanged

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

'Study > ' 카테고리의 다른 글

[Tip] Object.FindObjectOfType  (0) 2024.06.11
[Tip] RenderSettings  (0) 2024.06.05
[Tip] 3D 프로젝트에서 SpriteAtals 패킹하는 법  (0) 2024.05.23
[Tip] 패키지에서 프리팹찾기  (0) 2024.04.18
[Tip] CameraShaker  (0) 2024.03.29

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CardData
{
    public int id;
    public string name;
    public string sprite_name;
}

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CardInfo
{
    public int id;

    public CardInfo(int id)
    {
        this.id = id;
    }
}

 

 

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Card : MonoBehaviour
{
    private CardInfo cardInfo;

    [SerializeField] private SpriteRenderer spriteRenderer;

    public void SetCardInfo(CardInfo cardInfo)
    {
        this.cardInfo = cardInfo;
    }

    public void SetSprite(Sprite sp)
    {
        spriteRenderer.sprite = sp;
    }
}

 

using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.U2D;

public class Main : MonoBehaviour
{
    [SerializeField] private GameObject cardPrefab;
    [SerializeField] private SpriteAtlas cardAtlas;

    void Start()
    {
        TextAsset ts = Resources.Load<TextAsset>("Data/card_data");
        string json = ts.text;
        Debug.Log(json);

        Dictionary<int, CardData> dicCardDatas = JsonConvert.DeserializeObject<List<CardData>>(json).ToDictionary(x => x.id);

        GameObject cardGo = Instantiate(cardPrefab);
        Card card = cardGo.GetComponent<Card>(); //생성된 프리팹에
        CardInfo cardInfo = new CardInfo(100);

        card.SetCardInfo(cardInfo);
        CardData cardData = dicCardDatas[101];
        Sprite sp = cardAtlas.GetSprite(cardData.sprite_name);
        card.SetSprite(sp);
        

    }

}

'Study > ' 카테고리의 다른 글

[Tip] Object.FindObjectOfType  (0) 2024.06.11
[Tip] RenderSettings  (0) 2024.06.05
[팁] Slider.onValueChanged  (0) 2024.06.05
[Tip] 패키지에서 프리팹찾기  (0) 2024.04.18
[Tip] CameraShaker  (0) 2024.03.29

Ctrl + K 혹은

 

 

 

 


 

 

 

 

 

 

'Study > ' 카테고리의 다른 글

[Tip] Object.FindObjectOfType  (0) 2024.06.11
[Tip] RenderSettings  (0) 2024.06.05
[팁] Slider.onValueChanged  (0) 2024.06.05
[Tip] 3D 프로젝트에서 SpriteAtals 패킹하는 법  (0) 2024.05.23
[Tip] CameraShaker  (0) 2024.03.29

Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.

 

카메라의 Transform을 Public으로 설정하여

인스펙터에서 메인카메라를 할당한다면

메인카메라로 보는 오브젝트들의 흔들림을 조정할 수 있습니다.

Shake Duration : 지속 시간

Shake Amount : 흔들림 강도

Decrease Factor : 흘러가는 시간을 조정(Shake Duration 수치 조정)

팀 프로젝트를 하며 적용을 한 장면입니다.

 

using UnityEngine;
using System.Collections;

public class CameraShake : MonoBehaviour
{
	// Transform of the camera to shake. Grabs the gameObject's transform
	// if null.
	public Transform camTransform;
	
	// How long the object should shake for.
	public float shakeDuration = 0f;
	
	// Amplitude of the shake. A larger value shakes the camera harder.
	public float shakeAmount = 0.7f;
	public float decreaseFactor = 1.0f;
	
	Vector3 originalPos;
	
	void Awake()
	{
		if (camTransform == null)
		{
			camTransform = GetComponent(typeof(Transform)) as Transform;
		}
	}
	
	void OnEnable()
	{
		originalPos = camTransform.localPosition;
	}

	void Update()
	{
		if (shakeDuration > 0)
		{
			camTransform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
			
			shakeDuration -= Time.deltaTime * decreaseFactor;
		}
		else
		{
			shakeDuration = 0f;
			camTransform.localPosition = originalPos;
		}
	}
}

 

 

https://gist.github.com/ftvs/5822103

 

Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration

Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking i...

gist.github.com

 

 

'Study > ' 카테고리의 다른 글

[Tip] Object.FindObjectOfType  (0) 2024.06.11
[Tip] RenderSettings  (0) 2024.06.05
[팁] Slider.onValueChanged  (0) 2024.06.05
[Tip] 3D 프로젝트에서 SpriteAtals 패킹하는 법  (0) 2024.05.23
[Tip] 패키지에서 프리팹찾기  (0) 2024.04.18

+ Recent posts