Hey guys, I have recently purchased a new pc and upon copying over my project to it I have quite a few errors that I don’t know how to deal with. On my old computer, there are no issues and everything is fine. On my new computer, I have 67 errors in the console, all pertaining to type or namespace not existing. I have gone through and compared everything on both pcs and am not finding any differences beyond the error existence. I feel like it is an assembly issue. I’ll post a sample of just one of the errors
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Inventory.UI
{
public class UIInventoryDescription : MonoBehaviour
{
[SerializeField]
private Image itemImage;
[SerializeField]
private TMP_Text title;
[SerializeField]
private TMP_Text description;
public void Awake()
{
ResetDescription();
}
public void ResetDescription()
{
itemImage.gameObject.SetActive(false);
title.text = "";
description.text = "";
}
public void SetDescription(Sprite sprite, string itemName,
string itemDescription)
{
itemImage.gameObject.SetActive(true);
itemImage.sprite = sprite;
title.text = itemName;
description.text = itemDescription;
}
}
}
In this code, it is telling me that the type “TMP_Text” does not exist and even has TMPro at the top underlined. Again, this is one example, another being that GetComponent does not exist in the current context (on a class inheriting monobehaviour)
Hopefully this is a simple fix and I can just reload everything, but I don’t know how as I have never had to.
Hopefully you’re using source control and pulling from that source control onto the new computer.
Either way, sounds like you just didn’t install something correctly or failed to hook something up. Make sure in Unity it’s pointing to Visual studio under preferences → External tools. Also make sure all your packages are properly installed on the new computer. While this should go with the json file in the Packages folder, if you failed to move something over, you might get that error.
You should share projects between computers using source control and nothing else.
This might also be an issue:
Extra unwanted packages in new projects (collab, testing, rider and other junk):
About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.
Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:
PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL
I’m sorry you’ve had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.
Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).
You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.
As far as configuring Unity to play nice with git, keep this in mind:
I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.
Here is how I use git in one of my games, Jetpack Kurt:
Using fine-grained source control as you work to refine your engineering:
Share/Sharing source code between projects:
Setting up an appropriate .gitignore file for Unity3D:
Generally setting Unity up (includes above .gitignore concepts):
It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It’s simply ridiculous not to back up.
If you plan on joining the software industry, you will be required and expected to know how to use source control.
“Use source control or you will be really sad sooner or later.” - StarManta on the Unity3D forum boards
Not the best way of resolving this issue, but I basically brought over the hard drive from my old computer (didn’t need it other than for this project) and everything is fine now. I need SCM