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 News
»
General Discussion
»
Get Prefab by name and store it into GameObject Global Variable
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Get Prefab by name and store it into GameObject Global Variable (Read 2421 times)
Handrews
Playmaker Newbie
Posts: 36
3D Artist & Game Developer
Get Prefab by name and store it into GameObject Global Variable
«
on:
December 02, 2020, 06:45:39 PM »
Basically I need a way to find a Prefab on my Assets folder using his name and then store it into GameObject variable to use it on Create Object...
Logged
Fat Pug Studio
Beta Group
Hero Member
Posts: 1294
Re: Get Prefab by name and store it into GameObject Global Variable
«
Reply #1 on:
December 03, 2020, 03:31:14 AM »
Use Resources Load with asset path, then store it as you like.
Logged
Available for Playmaker work
Handrews
Playmaker Newbie
Posts: 36
3D Artist & Game Developer
Re: Get Prefab by name and store it into GameObject Global Variable
«
Reply #2 on:
December 03, 2020, 05:38:26 AM »
Yea but i need a way to find the prefab by name too
Logged
Handrews
Playmaker Newbie
Posts: 36
3D Artist & Game Developer
Re: Get Prefab by name and store it into GameObject Global Variable
«
Reply #3 on:
December 03, 2020, 05:55:04 AM »
Ok i made it using Build String to create a path using the name stored in the variable...but now "Resources Load" seems to not be working or not recognizing the path (Assets/FireBolt1.prefab) and i don't know why...
Logged
djaydino
Administrator
Hero Member
Posts: 7616
Re: Get Prefab by name and store it into GameObject Global Variable
«
Reply #4 on:
December 03, 2020, 08:27:37 AM »
Hi.
You need to place the things you want to load into a 'Resources' folder.
https://docs.unity3d.com/ScriptReference/Resources.Load.html
So for example if you have your fire bolt in a folder like this :
Assets/Some folder/Some subfolder/Resources/Bolts/FireBolt1.prefab
Then you would load it with "Bolts/FireBolt"
Logged
Join the PlayMaker Discord Channel!
Handrews
Playmaker Newbie
Posts: 36
3D Artist & Game Developer
Re: Get Prefab by name and store it into GameObject Global Variable
«
Reply #5 on:
December 03, 2020, 09:15:02 AM »
Nice! It works" Thx u very much!
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker News
»
General Discussion
»
Get Prefab by name and store it into GameObject Global Variable