DefaultPool fails to load my prefab once or twice then it works
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
DefaultPool fails to load my prefab once or twice then it works
bandozgames
2020-08-29 09:46:47
I updated to Unity 2020 from 19 because of an error that wouldn't let me open my project. I also removed all of the appdata to try and fix the problem. Since then, I have many issues but the most concerning one is that when I open the project and press play it fails to load my prefabs that are located in the root of a resources folder (that was working perfectly before). I try again and it fails again. Then usually around the 3rd time of trying it works perfectly fine.
How do I fix this?
Comments
DefaultPool failed to load "Player". Make sure it's in a "Resources" folder. Or use a custom IPunPrefabPool.
PhotonNetwork.Instantiate("Player", new Vector3(0.0f,0.0f,0.0f), rotation, 0);
I can confirm i get this error from time to time as well. Normally fixes its self after pressing play a few times.
But this time im stuck in this state. Not sure what to do :(
Also running Unity 2020.1.3f1 (i started in 2020 so did not migrate, but still get error)
[UPDATE]
I Shelved my latest, reverted back to last stable, and then unshelved. Nothing changed, but error went away.
KathleenWest
2020-09-12 21:05:11
I am also having this issue as well. I can confirm my Player prefab is in a Resources folder but it is under a custom folder structure (not the main Resources folder). The error happened only AFTER the upgrade to Unity 2020 and update to the September version of PUN.
KathleenWest
2020-09-12 22:22:10
Status Update: I found a code implementation workaround/fix and implemented it... it works in my solution so far... player prefab is loaded. Solution here: https://forum.photonengine.com/discussion/16037/non-resource-located-network-prefabs
OutOfTuneGames
2020-09-16 15:48:22
@KathleenWest Thanks for posting that solution, I'm seeing the same error here ( new project, Unity 2020.1.5f ).
With the code to register the prefab, it works every time!
infogamerhub
2020-10-27 05:26:13
I just changed the name of my Prefab and I changed the string used to Instantiate the prefab.
infogamerhub
2020-11-12 04:45:48
Here is a video on how to fix this
https://youtu.be/oF7_qcXoZ_E
Hi everyone, Trying reimport the prefab also work.
@preshu wrote: »
Hi everyone, Trying reimport the prefab also work.
That worked thanks
@infogamerhub wrote: »
I just changed the name of my Prefab and I changed the string used to Instantiate the prefab.
This problem stuck me whole night...
I also got problem like you, after renamed my prefab, it happend
re-import prefab is not worked for me TOT
Then I read some posts like KathleenWest shared above
I found there are Resource cache exist, it seems like the problem is casued by cache not be cleared in some reason
so, when I put these in my code before where I call "PhotonNetwork.Instantiate"
it works (YEAH~!) :
DefaultPool newDefaultPool = new DefaultPool();
newDefaultPool.ResourceCache.Clear();
PhotonNetwork.PrefabPool = newDefaultPool;
( after let it run once time, you can remove it, because it has already cleared the cache for you )
Back to top