[SerializeField] Transform _target; //<= обьект для слежения
[SerializeField] float _yOffset=1f;
private void LateUpdate()
{
transform.position = new Vector3(_target.position.x, _yOffset, _target.position.z);
}
using UnityEngine;
[System.Serializable]
public class Upgrade
{
[SerializeField] private string _typeName;
[SerializeField] private int _price;
[SerializeField] private float _damage;
}
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class UpgrageList : MonoBehaviour
{
string _name="Tower";
[SerializeField] List<Upgrade>_upgrades;
[ContextMenu("Save")]
public void SaveState()
{
var json = JsonUtility.ToJson(this);
File.WriteAllText(Application.persistentDataPath + $"{_name}.so", json);
Debug.Log(Application.persistentDataPath);
}
[ContextMenu("Load")]
public void LoadState()
{
var json = File.ReadAllText(Application.persistentDataPath + $"{_name}.so");
JsonUtility.FromJsonOverwrite(json, this);
}
}
{"_upgrades":[{"_typeName":"Fire","_price":5,"_damage":"30"},{"_typeName":"Ice","_price":5,"_damage":"40"},{"_typeName":"Earth","_price":2,"_damage":"10"}]}
doorAnim = gameObject.GetComponent();// не указан компонент
//надо
doorAnim = gameObject.GetComponent<Animator>();
if (!doOnce)
{
raycastedDoor = hit.collider.gameObject.GetComponent(); // тут аналогично что за компонент нужен ?
CrosshairChange(true);
}
if(Physics.Raycast(transform.position, fwd, out hit, rayLength, mask))
{
// Door
if (hit.collider.CompareTag(interactableTag)) это не надо тут и так выбор по маске идет зачем ещё и таг
{
ParticleSystem _pS;
void LateUpdate()
{
if (_pS.isPlaying)
{
Debug.LogError("ParticleSystem Is Play");
Debug.Log("System Location" + _pS.transform.position);
}
}
да и не надо это наверно если есть
PlayerPrefs.SetFloat("x", transform.position.x);