- Home /
The class defined in script file named 'PrefabId' does not match the file name! in xcode only
I downloaded the Prefab in Prefab addon (Nested prefabs) and it works fine. When I build and run it in xcode for ios I get the above error in the output (only on xcode!).
The class defined in script file named 'PrefabId' does not match the file name!
The file itself looks like this (with censored code because it's not my class):
using UnityEngine;
using System.Collections;
using System;
[AddComponentMenu("Prefabs/PrefabId")]
public class PrefabId : MonoBehaviour
{
[HideInInspector]
public string id = Guid.NewGuid().ToString();
[HideInInspector]
public string assetPath = "";
void Awake()
{
// Code
}
public void MoveTo(string newAssetPath)
{
// Code
}
public void GiveNewId()
{
// Code
}
}
What is the problem?
Comment
What's the exact name of the script file. If it is not PrefabId.cs
then that's your problem. I assume the case is wrong.
Answer by Sisso · Dec 11, 2013 at 01:56 PM
"The class defined in script file named 'PrefabId' does not match the file name!"
So, you must change the file name to match. Rename it to PrefabId.cs
Your answer
![](https://koobas.hobune.stream/wayback/20220613123930im_/https://answers.unity.com/themes/thub/images/avi.jpg)