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
(Moderator:
600
) »
help with custom action [SOLVED]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: help with custom action [SOLVED] (Read 1161 times)
cel
Full Member
Posts: 132
help with custom action [SOLVED]
«
on:
June 06, 2019, 01:35:58 PM »
I copied the action create advanced code in order to create primitives, it works but, when i change the spawn position (x=2,y=0,z=0) it creates two primitives. Could someone have a look at the attachment and find out what is going on wrong?
«
Last Edit: June 09, 2019, 06:22:36 AM by cel
»
Logged
Deek
Full Member
Posts: 133
Re: help with custom action
«
Reply #1 on:
June 07, 2019, 07:29:49 PM »
The problem is that "GameObject.CreatePrimitive()" already creates an instance of the given primitive type and as you later instantiate a new GameObject you end up with two new objects, regardless of the specified position (you likely just noticed because they weren't overlapping anymore).
The solution is to use the reference to the created primitive (the variable "go") instead of instantiating a it a second time.
I've added the fixed script to the attachments and took some liberties with the naming and improved the formatting, as well as adding comments to make it more clear what's going on.
You might compare the two versions to better understand what was causing that behavior.
Logged
cel
Full Member
Posts: 132
Re: help with custom action (solved)
«
Reply #2 on:
June 09, 2019, 06:14:36 AM »
brilliant, thanks for your help Deek
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
help with custom action [SOLVED]