- Home /
Question by
LyMinhKhang · Dec 16, 2021 at 10:03 AM ·
error
I don't know why i have this error: Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Drawcard : MonoBehaviour { public GameObject Card1; public GameObject Card2; public GameObject PlayerArea; public GameObject EnemyArea;
// Start is called before the first frame update
void Start()
{
}
public void OnClick()
{
{
GameObject playerCard = Instantiate(Card1, new Vector3(0, 0, 0), Quaternion.identity);
playerCard.transform.SetParent(PlayerArea.transform, false);
}
}
} ,using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Drawcard : MonoBehaviour { public GameObject Card1; public GameObject Card2; public GameObject PlayerArea; public GameObject EnemyArea;
void Start()
{
cards.Add(Card1);
cards.Add(Card2);
}
public void OnClick()
{
GameObject playerCard = Instantiate(Card1, new Vector3(0, 0, 0), Quaternion.identity);
playerCard.transform.SetParent(PlayerArea.transform, false);
}
}
Comment
Your answer
Follow this Question
Related Questions
2D bullet script errors. 1 Answer
tornado twins worm game tutorial turret not firing 2 Answers
Problem with saving List of objects !!! 2 Answers
Photon, failed to network remove object. 0 Answers
Sync with visual studio 2010 error 1 Answer