Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Bolhuis · Aug 08, 2013 at 01:03 PM · errormultiplayerserver

Photon: Please verify you have this gameobject in a Resources folder (and not in a subfolder)

So I'm trying to get multiplayer in my game with Photon. But the player prefab that needs to be loaded wont load with the error: PhotonNetwork error: Could not Instantiate the prefab [YouTwo (UnityEngine.Transform)]. Please verify you have this gameobject in a Resources folder (and not in a subfolder) So I put the prefab in a new folder I called Resources. And it still wont work. There is not sub-directories, and the Resources folder is in the root of the assets folder.

Any help is greatly appriciated. If you need some more info to help please just say so.

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ScottYann · Aug 08, 2013 at 02:48 PM 0
Share

That is strange. Could you post the line of code you are using to instantiate your player?

avatar image Bolhuis · Aug 08, 2013 at 03:00 PM 0
Share
     public Transform playerPrefab;
 
 void OnJoinedRoom ()
     {
         PhotonNetwork.Instantiate(playerPrefab.ToString(), transform.position, Quaternion.identity, 0);
     }
avatar image ScottYann · Aug 08, 2013 at 04:15 PM 2
Share

print(playerPrefab.ToString());//you might find this to be not what you were expecting it to be.

The string should be the name of your prefab, letter for letter. Prefabs are GameObjects. And I don't think transforms have names but I could be wrong. GameObjects have names that's for sure.

avatar image Bunny83 · Aug 08, 2013 at 04:38 PM 1
Share

Transforms as well as all other components share the same name as the Gameobject, however ToString won't return the name AFAI$$anonymous$$ but would return something like "UnityEngine.Transform".

avatar image ScottYann · Aug 08, 2013 at 04:46 PM 1
Share

Yes that's right. GameObject is a property of pretty much all monobehaviors and quite a few components too. You can do transform.gameObject.GetComponent().gameObject.name and similar insane things. Actually it does come in handy.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Bunny83 · Aug 08, 2013 at 04:41 PM

Photon can't instantiate a prefab like Network.Instantiate does. Photon requires you to place your prefab in an Resources folder. When you call PhotonNetwork.Instantiate you have to pass the name of the prefab to the function. Like i said in the comment above. ToString won't return the name.

If you have the prefab you bound to the "playerPrefab" variable in a Resources folder, just try this:

 PhotonNetwork.Instantiate(playerPrefab.name, transform.position, Quaternion.identity, 0);
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bolhuis · Aug 08, 2013 at 05:45 PM 0
Share

That did the trick, thank you man!

avatar image nicmarxp · Jul 20, 2018 at 09:14 PM 0
Share

It seems like it needs to be in a folder called Resources without a subfolder, so either: Resources/YouTwo.prefab or Resources/Characters/Resources/YouTwo.prefab

$$anonymous$$inda weird that Resources/Characters/YouTwo.prefab is not working, which seems to work for other similar Unity operations.

avatar image
0

Answer by Info-Gamer · Nov 12, 2020 at 04:48 AM

Here is a helpful video for if ever you get this error when your prefab is already in the Resources folder

https://youtu.be/oF7_qcXoZ_E

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Which kind of error can cause a silent crash? 0 Answers

Network.Connect failed. 1 Answer

Method Not Found: 'Network.InitalizeServer' 0 Answers

attached prefabs before client joins 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges