Control how many entities can be cloned

I’m sure there is a simple solution to this problem I just do not know what it is obviously.

So I clearly cloned, and added an entity to itself, but it appears to be an infinite loop.

Here’s a screen shot. I was considering using an array, with a construction function, but I really don’t know how to do that in PlayCanvas

You are cloning an entity and then because of that script the clone clones itself and so on…

1 Like

Yea I get that lol

I guess my point is, how do I clone let’s say 5 only. and call it a day. :slight_smile:

Sorry I’m very noob at this.

Put the script on an entity that is not cloned. Find the entity you want to clone in the script and then clone the found entity 5 times.

These tutorial projects might be of use. Particularly the one entitled Procedural Levels.