playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
I wan't to add a script to objects that creates in runtime!
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: I wan't to add a script to objects that creates in runtime! (Read 1074 times)
Silicon Power
Full Member
Posts: 186
I wan't to add a script to objects that creates in runtime!
«
on:
September 17, 2019, 07:59:37 AM »
Hi. I want to add a script to some game objects and that's easy with "add script" action but problem is those objects will generate randomly in runtime so I need to know how can I get and store all those game objects and then how should I add that script to all of them?
Logged
djaydino
Administrator
Hero Member
Posts: 7616
Re: I wan't to add a script to objects that creates in runtime!
«
Reply #1 on:
September 17, 2019, 08:07:24 AM »
Hi when you create object, store then in a variable.
Then add to an array.
Then you can loop thru the array with array get next and place script on each object.
you can use build in array or array maker. below are 2 videos about them and you can find more on youtube
//www.youtube.com/watch?v=yOZK8yr3IKo
//www.youtube.com/watch?v=X8rUuZDjS3Y
Logged
Join the PlayMaker Discord Channel!
Silicon Power
Full Member
Posts: 186
Re: I wan't to add a script to objects that creates in runtime!
«
Reply #2 on:
September 17, 2019, 08:33:46 AM »
Thanks. I can store those game objects inside an Array but know I need to figure out how can I get those game object by name from that array. there is two type on name in that array. 1- Cube 2-Sword. I want to add a different script for each name.
Logged
djaydino
Administrator
Hero Member
Posts: 7616
Re: I wan't to add a script to objects that creates in runtime!
«
Reply #3 on:
September 17, 2019, 08:37:06 AM »
Hi.
you could use multiple arrays so that when object created it is placed in the proper array.
or use tags and for example "Game Object Tag Switch" to know which type it is
Logged
Join the PlayMaker Discord Channel!
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
I wan't to add a script to objects that creates in runtime!