Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.1K
Vistas
Can't instantiate "scene object" [Unity Mirror Multiplayer]

I am trying to instantiate an object that already exists in the scene so that I can enlarge it and "zoom" in on it, but when I play the game and hover over an object, instead of showing the zoomed card, this error shows up:

Card1(Clone)(Clone) has already spawned. Don't call Instantiate for NetworkIdentities that were in the scene since the beginning (aka scene objects). Otherwise the client won't know which object to use for a SpawnSceneObject message.

NOTE: I am following a tutorial for a 2D Unity Card game with mirror (2019.2.15f1), and I am using a different version of Unity (2020.1.0f1).

First, I am instantiating objects into my game with this script, which never throws any errors.

[Command]
public void CmdDealCards()
{
    for (int i = 0; i < 4; i++)
    {
        GameObject card = Instantiate(playerDeck[Random.Range(0, playerDeck.Count)], new Vector2(0, 0), Quaternion.identity);
        NetworkServer.Spawn(card, connectionToClient);
        RpcShowCard(card, "Dealt");
    }
}

The problem comes when I try to instantiate these objects again later, here:

public void OnHoverEnter()
{
    zoomCard = Instantiate(gameObject, new Vector2(Input.mousePosition.x, 540), Quaternion.identity);
    zoomCard.transform.SetParent(Canvas.transform, true);
    zoomCard.layer = LayerMask.NameToLayer("Zoom");

    RectTransform rect = zoomCard.GetComponent<RectTransform>();
    rect.sizeDelta = new Vector2(240, 354);
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I know this is a really late answer, but I came across it while running into the same issue, and maybe in the future, someone will do the same as me, so:

What you've done is attached the wrong prefab to your CardZoom script in the Inspector. Image of Inspector with Zoom Card attached

What I did, and presumably you also, was to attach Card1 here, which is where it was failing to duplicate the NetworkIdentity

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda