DontDestroyOnLoad

when trying to set up DontDestroyOnLoad using the code specified on the character page, I get the error "Assets\Opsive\UltimateCharacterController\Demo\Scripts\DontDestroyOnLoad.cs(1,18): error CS0116: A namespace cannot directly contain members such as fields or methods" is this a result of the code? or is this something I'm doing wrong? I'm new to creating games with multiple scenes so it's entirely possible I'm at fault.
 
Yeah this will be an error from the script, specifically line 18. If you could paste the full script here I can point out the problem. However a quick guess would be that you haven't actually included the class definition in the script, i.e.

C#:
public class MyClassName : MonoBehaviour
{
    void MyMethod() {
        // stuff
    }
}
 
Top