- Home /
Destroy instances created continuosly of a prefab in a network game...
Hi!.
I finally solved my problem: I know how to destroy a single object which is instantiated "on the run"...And before this to destroy an object which is there since the first time in the execution.
The problem arrives when I need to instantiate continuosly instances of one or some prefabs.
My webclient is blocked since the first time it tries to connect.
It's true that I arrive to instantiate 1300 instances within 73s...And all these instances with it's right viewID over the nertwork.
I would like to know how to liberate the memory I reserved for my purpose: If I make a
var viewID = Network.AllocateViewID();
before to instantiate I think I should delete this allocation in some way. Is there any way to do this in Unity3D?.
Thank you.
Hi again, after achieving the networking instantiation and its right destruction and the destruction of an already existent GameObject...
I've got now another problem related with massive instantiation of some random GameObjects from a set of GameObjects:
a).-I need to instantiate a huge number of instances each one inside an update function in a script. I use Network.Instantiate and before this I make an allocate for the viewID like this:
[CODE]var viewID = Network.AllocateViewID();[/CODE]
b).-They are instantiated from a grid located in an Empty GameObject. And here I dragged the a).- script
c).-They are destroyed in another script located in the prefabs taken for each instance. They, the instances of these prefabs are falling continuosly due to the Gravity Force and when they collide against the ground they must be destroyed.
In the server all it's ok. But it seems that the client has problems to follow the instances...It's like if its frames per second were reduced to 1 per hour!!. But I've checked that if I disconnect the server I can recover the control of my client's game and if I connect it as server I can found all my instances which has fallen from the spwamn grid and hasn't been destroyed being on the ground...
So two problems:
a).-Problems with the initial connection.
b).-$$anonymous$$aybe I can't destroy the instances when they collide against the ground.
Is it due to the sepration of the instantiation and the destruction in different scripts?.
I've got to say that I'm making tests with a webclient and my server in my Unity's editor window running simultaneously.
Any idea?. Please help me... ;-)
Your answer
Follow this Question
Related Questions
Network.Destroy doesn't remove objects on other systems? 2 Answers
How can I delete or destroy an instance of an object IN A MULTIPLAYER GAME?. 2 Answers
Player not deleting on server exit 1 Answer
How to properly destroy non-instantiated objects over a network? 1 Answer
Error in runtime:"View ID AllocatedID: 6316 not found during lookup. Strange behaviour may occur" 1 Answer